I'm on OS Sierra. This is (part of) what I get on ifconfig

...
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 98:01:a7:b4:91:63 
    inet6 fe80::4e:52ae:9fa8:2e6c%en0 prefixlen 64 secured scopeid 0x5 
    inet 192.168.1.33 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
...
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1400
    inet 10.161.136.55 --> 10.161.136.55 netmask 0xffffffff

If I try to ping 127.0.0.1 from en0 interface (command ping -S 192.168.1.33 127.0.0.1) it works fine, but if I try to ping it from utun1 (command ping -S 10.161.136.55 127.0.0.1) I get a timeout. Why is that?

Actually, I had a look at netstat and saw this:

Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
10.161.136.55      10.161.136.55      UHr            65      550   utun1
10.161.136.55/32   link#14            UCS             0        0   utun1
192.168.1.33/32    link#5             UCS             1        0     en0
192.168.1.33       98:1:a7:b4:91:63   UHLWI           0        9     lo0
...

Why do addresses 10.161.136.55 and 192.168.1.33 have such different configurations for the netif column? How do I change them? I'd like to change line 10.161.136.55 to use netif lo0

  • I wouldn't expect this to work. It doesn't make sense to ping 127.0.0.1 on some other interface than lo0 – Michael Hampton Nov 8 at 20:51
  • @MichaelHampton The behavior I would expect is that -S specify a source address, not an interface. And the interface is chosen based on routing table towards the destination, in this case 127.0.0.1. For that reason I would have expected identical behavior regardless of which local IP address is given to -S. The question is not whether it is supposed to work or not, but rather why giving another local IP address to -S changes the behavior. – kasperd Nov 8 at 21:14
  • @kasperd Well it doesn't make any sense that way either. – Michael Hampton Nov 8 at 21:18
  • 127.0.0.1 also known as localhost is only available on the host itself through the lo interface. you cant reach it through any other interface, a nice of peace of information about here – Zina Nov 8 at 21:25
  • 1
    I have tested it and can ping from my local interface, my en0 interface, my VirtualBox added interfaces, but NOT from a VPN interface. The reason would be that the tunnelled interface does go through the tunnel only, while all the "local" interfaces can reach 127.0.0.1 as they reside on the same host. – Zina Nov 9 at 19:02

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.