network – macOS routing table. Default gateway rule not working

Spread the love


Advertisement

In macOS, I've got the following routing table for inet, as can be seen from netstat -nr

Advertisements

Internet:
Destination        Gateway            Flags           Netif Expire
default            10.195.71.1        UGScIg            en0       
10.195.71/22       link#14            UCS               en0      !
10.195.71.1/32     link#14            UCS               en0      !
10.195.71.1        b4:c:25:e4:0:1     UHLWIir           en0   1185
10.195.73.12/32    link#14            UCS               en0      !
10.195.73.88       ae:d0:b5:cb:4c:bb  UHLWI             en0      !
34.99.231.240      10.195.71.1        UGHS              en0       
127                127.0.0.1          UCS               lo0       
127.0.0.1          127.0.0.1          UH                lo0       
169.254            link#14            UCS               en0      !
192.2.1.3/32       10.196.72.1        UGSc              en0       
192.8.2.1/32       10.196.72.1        UGSc              en0       
224.0.0/4          link#14            UmCSI             en0      !
255.255.255.255/32 link#14            UCSI              en0      !

The last rule seems fine and I expect all the packets that didn't match any other rule to be sent throw interface en0, to the default gateway (10.195.71.1).

However, it looks like after I added and removed rules, the routing table list return to its original state (as seen above) but no packet were caught by the last rule. For example, when tried to ping 8.8.8.8 or using traceroute, so it didn't sent to the expected gateway and I got timeout.

restart the interfaces didn't help. Only after adding specific rule for 8.8.8.8, using the following command sudo route add 8.8.8.8 10.195.71.1 -ifp en0, the ping got response.

Perhaps anybody can think of a reason how can I check that my routing table output represent the real network state (I could use flush, but since adding specific rule resolved the problem, so I cannot think of a reason why the default gateway didn't catch all packets that didn't match previous rules)

Author: Subham

Leave a Reply

Your email address will not be published. Required fields are marked *