network – macOS routing table. Default gateway rule not working
In macOS, I’ve got the following routing table for inet, as can be seen from netstat -nr
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 ! 220.127.116.11 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 ! 18.104.22.168/32 10.196.72.1 UGSc en0 22.214.171.124/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 126.96.36.199 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 188.8.131.52, using the following command sudo route add 184.108.40.206 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)