3 ms·
The whole /8 is "on-net" for the loopback interface, but that doesn't mean it's usable to applications. On macOS, I can't ping or bind to 127.0.0.2, for exampl
by greyface- 2y ago
The whole /8 is "on-net" for the loopback interface, but that doesn't mean it's usable to applications. On macOS, I can't ping or bind to 127.0.0.2, for example. Linux's behavior of allowing the whole /8 to be used, even when only a single address is assigned, is a bit of an oddity here.
- akira2501 2y ago> I can't ping or bind to 127.0.0.2, for example. You can as soon as you define it as an alias. > Linux's behavior of allowing the whole /8 to be used, even when only a single address is assigned, is a bit of an oddity here. Per the RFC: "127.0.0.0/8 - This block is assigned for use as the Internet host loopback address. A datagram sent by a higher level protocol to an address anywhere within this block should loop back inside the host."
- greyface- 2y agoYes, exactly. If I connect a physical loopback adapter to a network interface, I can't just ping any on-net address and expect a response. I need to add it as an explicit interface address/alias first. Just because the packet loops back on the interface doesn't mean that it will then be treated as if it were addressed to the host. Linux special-cases 127/8 on the virtual loopback interface and will treat all looped-back packets as if they were addressed to the host, even when the destination isn't explicitly configured as an alias. This behavior is not required by the quote from RFC3330.
- RKearney 2y ago> On macOS, I can't ping or bind to 127.0.0.2 uname -a Darwin LT-JT6692XPXJ 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64 ~ ifconfig lo0 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201<PERFORMNUD,DAD> ~ ping -c 1 127.0.0.2 PING 127.0.0.2 (127.0.0.2): 56 data bytes --- 127.0.0.2 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss ~ 11s sudo ifconfig lo0 add 127.0.0.2 Password: ~ ping -c 1 127.0.0.2 PING 127.0.0.2 (127.0.0.2): 56 data bytes 64 bytes from 127.0.0.2: icmp_seq=0 ttl=64 time=0.824 ms --- 127.0.0.2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.824/0.824/0.824/nan ms ~ ifconfig lo0 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.2 netmask 0xff000000 nd6 options=201<PERFORMNUD,DAD> ~