brona / iproute2mac

CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux systems - ip command.
MIT License
898 stars 73 forks source link

cannot ping loopbacks other than 127.0.0.1 #40

Closed LYK-love closed 1 year ago

LYK-love commented 2 years ago

i execute the ip command and get the following output, note that 127.0.0.0/8 implies that all 127.* address is passed through loopback in route table

$ ip route
default via 172.31.0.1 dev en0
127.0.0.0/8 via 127.0.0.1 dev lo0
127.0.0.1/32 via 127.0.0.1 dev lo0
169.254.0.0/16 dev en0  scope link
172.31.0.0/17 dev en0  scope link
172.31.0.1/32 dev en0  scope link
172.31.115.202/32 dev en0  scope link
224.0.0.0/4 dev en0  scope link
255.255.255.255/32 dev en0  scope link

However, when i ping IP loopback other than 127.0.0.1, i got the following output:

PING 127.0.0.2 (127.0.0.2): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2

It seems the 127.0.0.2 is not an loopback address, however the 127.* block is allocated to loopback according to the route table, I cant understand why QaQ

jxcang commented 2 years ago

How about take a look at this? https://superuser.com/questions/458875/how-do-you-get-loopback-addresses-other-than-127-0-0-1-to-work-on-os-x I believe this is a Mac OS issue rather than an iproute2mac issue.

brona commented 1 year ago

Thanks @jxcang for the comment here, I agree this has nothing to do with iproute2mac and the routes, but the behavior depends on where and how is the OS binding on 127.0.0.0/8.