16

First things first: I know that you can install a sort-of-a Loopback Adapter in Windows.

But what I really found strange is that there exists nothing like lo on Windows. At all. From The missing network loopback interface:

Windows TCP/IP stack does not implement a network loopback interface, as found in other TCP/IP stack like lo* interfaces in BSD systems.

...

The Microsoft Loopback Adapter can be installed on Windows systems, to run network applications when no physical adapter is present or active on the system. This adapter is not the equivalent of a network loopback interface and IPv4 address 127.0.0.1 can not be assigned to it. Also, it is not possible to sniff network traffic on it, at least with WinPcap.

I'd be really interested if somebody knew why this choice was made or why it never seemed necessary to include a loopback device in Windows. Because it comes in so handy to be actually able to capture packets you send from/to it in order to develop or debug network applications.

So if anybody has an experience in networking, TCP/IP stacks, etc. and is able to provide some insight, that would be much appreciated.

slhck
  • 235,242

3 Answers3

12

Historical reasons. From the ground up unix/linux has always been about the network. Whereas MS-DOS/Windows bolted the network on as an afterthought, initially with Windows own 'NetBIOS' rather than TCPIP.

Only when Netscape came along was it necessary for Microsoft to install a TCPIP stack and acknowledge the presence of the Internet. Before then you had to put your own stack together for talking to unix machines, paying handsomely for the privilege.

I hope this historical context goes some way to helping you understand why it is that MS-Windows is not really there yet when it comes to proper networking. To take a car analogy it is a bit like asking why motorbikes don't have four wheels. (Yes, that is a very poor analogy...)

Before it became important to get online there were many LAN protocols - DECnet, Token Ring, Novell stuff and Microsoft's effort that came with Windows 3.11 - only true experts could get these different boxes to talk together and networking was a truly dark art.

4

Ten years later I stumbled upon this problem as well. To share it with the community here is what I've researched so far.

The first hint I have found at the comment from user314104 to the question. You will see the Software Loopback Interface 1 for example from my MS Windows 10 with:

PS C:\Users\ingo\devel> route print
===========================================================================
Interface List
 10...52 54 00 ab b0 be ......Realtek RTL8139C+ Fast Ethernet NIC
 15...52 54 00 68 79 e4 ......Realtek RTL8139C+ Fast Ethernet NIC #2
  1...........................Software Loopback Interface 1
===========================================================================
--- snip ---

You can also use:

 PS C:\Users\ingo\devel> netsh interface ipv6 show address

Interface 1: Loopback Pseudo-Interface 1

Addr Type DAD State Valid Life Pref. Life Address


Other Preferred infinite infinite ::1

Interface 16: Ethernet 3

Addr Type DAD State Valid Life Pref. Life Address


Temporary Preferred 1h59m15s 29m14s 2003:d5:271e:5e00:d40a:76a1:d317:1765 Public Preferred 1h59m15s 29m14s 2003:d5:271e:5e00:d60a:bb7a:f796:590e Other Preferred infinite infinite fe80::eaf7:6c1f:1223:97bb%16

or:

PS C:\Users\ingo\devel> netsh interface ipv4 show address

Configuration for interface "Ethernet 2" DHCP enabled: Yes IP Address: 192.168.24.122 Subnet Prefix: 192.168.24.0/24 (mask 255.255.255.0) Default Gateway: 192.168.24.2 Gateway Metric: 0 InterfaceMetric: 25

Configuration for interface "Loopback Pseudo-Interface 1" DHCP enabled: No IP Address: 127.0.0.1 Subnet Prefix: 127.0.0.0/8 (mask 255.0.0.0) InterfaceMetric: 75

I also find it if I query it with the GetAdaptersAddresses function. I don't know why Microsoft is hiding it when showing interfaces with ipconfig.

As mentioned at How do I change the IP address of loopback in Windows 10? you can just ping the loopback:

PS C:\Users\ingo\devel> ping -4 loopback

Pinging win10-devel.hoeft-online.de [127.0.0.1] with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms

PS C:\Users\ingo\devel> ping -6 loopback

Pinging win10-devel.hoeft-online.de [::1] with 32 bytes of data: Reply from ::1: time<1ms Reply from ::1: time<1ms Reply from ::1: time<1ms Reply from ::1: time<1ms

Ping statistics for ::1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms

To answer your question: Microsoft has implemented a loopback interface in Windows but hidding it for some reason. You should be able to use it for testing as usual.

Ingo
  • 293
  • 2
  • 9
4

Windows does have a loopback interface; you'll see it if you run route print from the command line.

The real question seems to be why it's not possible to sniff loopback traffic on Windows, and the answer is that it is, just not with WinPcap. Npcap can capture loopback traffic. The Wireshark wiki now recommends it over WinPcap, partly for that reason and partly because WinPcap hasn't been maintained in years. (In 2011 when this question was written, WinPcap was maintained and Npcap didn't exist yet.)

I don't know why Microsoft implemented loopback in a way that happened to bypass WinPcap's capture method, but I'd guess it was for performance reasons. It certainly isn't because early Windows versions had no TCP/IP stack, as the top-voted rantswer claims. That doesn't even make any sense.

benrg
  • 866