【My Study Note】Routing Tables
Routing Tables
The earliest routers were just regular computers of the era. They had two network interfaces, bridge to networks, and auto-routing table that was manually updated. In fact, all major operating systems today, still have a routing table that they consult before transmitting data.
You could still build your own router today, if you had a computer with two network interfaces and it manually updated routing table.
Routing tables can vary a ton depending on the make and class of the router, but they all share a few things in common. The most basic routing table will have four columns.
4 Columns
- Destination network
- Next Hop
- Total hops
- Interface
Destination network
This column would contain a row for each network that the router knows about, this is just the definition of the remote network.
A network ID (IP: 192.168.1.1) and the net mask (Subnet Mask: 255.255.255.0) could be stored in one column inside a notation (CIDR: 192.168.1.1/24), or the network ID and net mask might be in a separate column.
Either way, it’s the same concept, the router has a definition for a network and therefore knows what IP addresses might live on that network. When the router receives an incoming packet, it examines the destination IP address and determines which network it belongs to.
A routing table will generally have a catchall entry, that matches any IP address that it doesn’t have an explicit network listing for.
Next Hop
This is the IP address of the next router that should receive data intended for the destination networking question or this could just state the network is directly connected and that there aren’t any additional hops needed.
Total hops
This is the crucial part of understanding routing and how routing tables work, on any complex network like the Internet, there will be lots of different paths to get from point A to point B.
Routers try to pick the shortest possible path at all times to ensure timely delivery of data but the shortest possible path to a destination network is something that could change over time, sometimes rapidly, intermediary routers could go down, links could become disconnected, new routers could be introduced, traffic congestion could cause certain routes to become too slow to use.
For now, it’s just important to know that for each next hop and each destination network, the router will have to keep track of how far away that destination currently is. That way, when it receives updated information from neighboring routers, it will know if it currently knows about the best path or if a new better path is available.
Interface
Interface, the router also has to know which of its interfaces it should forward traffic matching the destination network out of.
In most cases, routing tables are pretty simple. The really impressive part is that, many core Internet routers have millions of rows in the routing tables. These must be consulted for every single packet that flows through a router on its way to its final destination.