Routing tables
From wikinotes
routing tables are used whenever you try to communicate with a network.
they store a default route, and gateways to access known networks.
Basics
Generally store at least this info:
destination network: 192.168.1.0/24 # network you want to reach next hop: 10.0.0.0/24 # to reach dest network, communicate with this netwk total hops: # number of networks to communicate to reach network. # updated periodicaly to ensure we take quickest route interface: em0 # which network interface should be used for next hop?example FreeBSD routing table
netstat -r
Routing tables Internet: Destination Gateway Flags Netif Expire default unifi.localdomain UGS em0 10.0.0.0/24 link#5 U wg-salt 10.0.0.1 link#5 UHS wg-salt 10.0.0.8 link#5 UHS lo0 localhost link#3 UH lo0 192.168.1.0/24 link#1 U em0 192.168.1.201 link#1 UHS lo0 Internet6: Destination Gateway Flags Netif Expire ::/96 localhost UGRS lo0 localhost link#3 UHS lo0 ::ffff:0.0.0.0/96 localhost UGRS lo0 fe80::/10 localhost UGRS lo0 fe80::%lo0/64 link#3 U lo0 fe80::1%lo0 link#3 UHS lo0 ff02::/16 localhost UGRS lo0
example Linux routing table
netstat -r
iKernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default _gateway 0.0.0.0 UG 0 0 0 wlp3s0 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wg-salt 172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp3s0
Tools
FreeBSD route net-tools route