I asked this on networkengineering.stackexchange.com and was flagged as offtoppic but was told to ask here...so here goes:
I am on a mac, when I run ip route show I get the following output:
ip route show
default via 192.168.178.1 dev en0 -- line 1
127.0.0.0/8 via 127.0.0.1 dev lo0 -- line 2
127.0.0.1/32 via 127.0.0.1 dev lo0 -- line 3
127.94.0.1/32 via 127.94.0.1 dev lo0 -- line 4
169.254.0.0/16 dev en0 scope link -- line 5
192.168.178.0/24 dev en0 scope link -- line 6
192.168.178.1/32 dev en0 scope link -- line 7
192.168.178.150/32 dev en0 scope link -- line 8
224.0.0.0/4 dev en0 scope link -- line 9
255.255.255.255/32 dev en0 scope link -- line 10
And I am trying to understand what it means. I have some ideas but I am not totally sure if I am right, so I will outline my interpretation of some of the confusing line and would appreciate folks who are more knowledgeable can confirm if I am right or wrong. And if wrong what is the right interpretation.
default via 192.168.178.1 dev en0 -- line 1
This means If I want to go to a destination IP address (say 216.58.214.4), there is no entry in my routing table for this, hence my device will send the packet via 192.168.178.1 (which is the IP address of my home modem) using the interface en0.
A part of the above I am not clear about is this. Does this mean that the destination address on the packet will now be changed from 216.58.214.4 to 192.168.178.1? Or how does the destination and source address be updated in this scenario where a packet meant for 216.58.214.4 is sent out via interface eno with the aim of sending it via 192.168.178.1
127.94.0.1/32 via 127.94.0.1 dev lo0 -- line 4
I understand this to mean that any packet destined to the IP address 127.94.0.1/32 will be sent out from the lo0 interface which is the loop back interface, via 127.94.0.1.
Now I am not sure why I have an entry in my routing table for 127.94.0.1. I googled that IP and it looks it is related to OpenVPN which I once installed but do not use (I use Tunnleblick instead). Also why 127.94.0.1? for line 1 I could understand that 192.168.178.1 is the IP address of my modem, but not sure where 127.94.0.1 is from
169.254.0.0/16 dev en0 scope link -- line 5
I understand this to mean that any packet with destination IP address within the range 169.254.0.0/16 would have to be sent out via interface en0.
This is the first line that include scope link what exactly does that mean?
If I guess that scope link means on the same subnet, then I can't reconcile that with the range 169.254.0.0/16 because as far as I can tell, my local subnet is 192.168.178.0/24. Also I googled the IP address 169.254.0.0 it has to do with DHCP. I am not sure how to make sense of that information.
192.168.178.150/32 dev en0 scope link -- line 8
The IP address of the mac I am using is 192.168.178.150 I am not sure why that is also in the route output.
255.255.255.255/32 dev en0 scope link -- line 10
I am not sure what to make of this. I understand that 255.255.255.255 is the broadcast address. I thought the broadcast address of my setup would be 192.168.178.255/32.
So why 255.255.255.255 instead of 192.168.178.255. Also I noticed that all entries with scope link does not have the via <ip.address> part. Question is, what exactly does the via <ip.address> portion mean in terms of routing.