At the foundation of TCP/IP networking is the routing table, a data construct on each host on a TCP/IP network. Routing tables serve the following three purposes:
- They are used to store the information about other subnets on the network and how you can reach hosts on these networks.
- They are used to determine which host (called the next-hop IP address) each packet should be forwarded to in order to reach the host this packet is ultimately destined for.
- They are used to determine which network interface (called the next-hop interface) should be used to forward this packet so it gets to its ultimate destination.
Understanding routing tables is therefore essential if you want to be able to effectively troubleshoot routing issues on a TCP/IP network.
Let's look at how routing tables work, what they look like in different scenarios.
To display this routing table, you open a command prompt window and type route print at the command line. Let's take the table above apart so we can understand how it works. Each routing entry (or route) in the routing table is composed of five fields:
- Network destination: An IP address or subnet representing a possible target destination to which IP packets may be forwarded.
- Netmask: A bitmask used for matching the destination field in a packet's IP address to one of the possible network destinations above.
- Gateway: The next-hop IP address to which the packet must be forwarded to reach the particular destination network.
- Interface: The next-hop interface which must be used to forward the packet to reach the particular destination network.
- Metric: The cost of the route.