❑ Meaning of each field
❍ Destination : Destination of a packet
❍ Gateway : Packets are routed via this gateway address.
❍ Genmask : Netmask address to inform network bandwidth
❍ Flags
- U : Route is up.
- H : Target is a host.
- R : Reinstate route for dynamic routing.
- D : Dynamically installed by daemon or redirect.
- M : Modified from routing daemon or redirect.
- A : Installed by addconf.
- C : Cache entry.
- ! : Reject route.
❍ MSS : Maximum Segment Size. MTU size(byte).
❍ Window : TCP window size(byte).
❍ irtt : Initial Round Trip Time for TCP(1~12000 milliseconds).
❍ Metric : Distance to destination.
❍ Ref : Number of times the path was referenced(Linux kernel doesn't use this).
❍ Use : Number of times the path was used.
❍ Iface : Network interface used for routing.
❑ Command
❍ Check routing table
- route or route -n
- netstat -r or netstat -rn
❍ Add/Del static route temporarily
- $ route add default gw 192.168.0.1
- $ route add -net 192.168.5.0/24 dev eth0
- $ route del -net 192.168.5.0/24
❑ How it works
1. Performs an AND operation between the destination address of the packet and the Genmask value of the routing table policy.
2. Compare the result of the AND operation with the destination of the policy.
3. If the two values match, the packet is sent to the interface of Iface.
4. If the two values don't match, go back to step 1 with the next policy in the routing table.
* The last policy in the routing table is the default gateway policy.
0.0.0.0 is the destination address for default gateway route.
0.0.0.0 is the destination address for default gateway route.