Routing Tables

A routing table essentially describes a chart for how its router (or network host) can reach an array of potential destinations in the most efficient manner, by making use of the least number of hops possible.

Routing tables can be used to direct traffic within a network, or across multiple networks. For the latter, routing tables can include both static and dynamic data. Static routes are simply hardcoded addresses, whereas dynamic routes are learned by a machine or router by means of some networking protocol (for example, DHCP).

We can view both Windows- and Linux-based machines' routing tables via the route command.

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.52.254  0.0.0.0         UG    100    0        0 eth0
192.168.52.0    0.0.0.0         255.255.255.0   U     100    0        0 eth0

The first line of output indicates that any traffic received by the machine that is not in the 192.168.52.0/24 range gets forwarded to the default gateway, 192.168.52.254. That gateway then takes care of forwarding the packets farther. Any traffic destined for 192.168.52.0/24 gets forwarded to 0.0.0.0, which means the traffic does not travel any farther.

0.0.0.0 is a special IP address that usually designates an unknown or unroutable destination. However, its use in routing tables indicates the default route that traffic should take unless specified by another entry in the table.


Relevant Note(s): Network Technologies