A routing table (also called routing information base ) provides information about the route on which a network-compatible device, e.g. B. a computer or a router, has to connect to other networks and their participants. A single entry in this table assigns an IP address range of a network destination information about which router (hop) and which interface (interface) the data is to be routed as a packet stream. Each entry also contains a metric value. This value can be used to choose the shortest route with the fewest redirects (hops).
The operating system of the network device creates a routing table when it is booted and then continuously adds to it during operation. This requires information about the networks that can be reached. Devices can learn network paths (routes) in 3 different ways and thus create entries in the routing table:
- Directly connected networks: The routes for connected networks are automatically included in the table as soon as an interface of the computer is configured with an IP address.
- Static routes: Static, i.e. fixed routes, are entered manually by an administrator. This can u. a. make sense for security reasons so that certain paths can no longer be manipulated in any other way. Such lists of static routes can only be managed easily if the number of entries is limited. Otherwise you quickly lose track of things and network errors or security gaps that are difficult to locate can creep in.
- Dynamic routes : The devices collect information about the network and its participants using appropriate routing protocols (e.g. BGP , OSPF , IGRP , EIGRP or RIP ). From this, suitable entries are automatically generated in the routing table. In the rarer case, such information is also transmitted to other end devices.
Structure of a routing table
Each entry in a routing table has at least the following information:
- Network address and subnet mask (or the prefix length = length of the connected bits of value 1 of the subnet mask)
- These two details determine the IP address prefix of a target network; that is, both together identify the target to which this table entry relates.
- Next hop, often also called gateway
- This is the next router address to which a packet must be sent. As a rule, this is the neighboring router at IP level to which the packet must be forwarded. For example, however, in the case of a BGP routing entry it can also be the address of the corresponding border router to the neighboring AS .
- Metric information is almost always added to every entry, which contains information about the weighting / preference for the use of this route information (e.g. with OSPF the metric is determined based on the smallest bandwidth on the way. With RIP, the metric corresponds to Value of the number of routers to the destination network etc.). The metric only plays a role if several routes that have been learned using the same routing protocol exist for the same target network. In this case, the best route is the one with the smallest metric value. If there are several routes with the same metric value, IP connections are usually distributed over the equivalent routes ("session-by-session load balancing")
The procedure is primarily based on a router to be considered, which is connected to (one or) several other networks via interfaces . The neighboring router can be reached at the gateway address of its network.
|Destination network address
|Subnet mask or netmask
(number of hops )
In this example, the destination network address is any IP address from the respective network. In the last entry the address "0.0.0.0" stands for the standard route to reach unknown networks. The standard route is often at the beginning or at the end of a routing table. The interfaces are sometimes abbreviated (e.g. "eth0" for LAN 1), because they are an integral part of the device.
Routing and Forwarding
With dynamic routing, a distinction can be made between routing and forwarding tables.
Typically, each routing protocol maintains its own routing table on the device. If different routing protocols run on a network node (e.g. BGP for interdomain routing and OSPF for intradomain routing), the router has several routing tables, which are usually structured differently (see in the example OSPF: sum of the link Costs vs. BGP: path vector, MED and various other complex attributes). These tables can even contain conflicting information; In other words, different routing protocols specify different paths to the same target network. Therefore every routing protocol is given a priority ( Cisco terminology: administrative distance ); in the event of contradictions, the route of the protocol with the highest priority (i.e. the lowest administrative distance) is used. The administrative distance is locally significant on the router, ie the administrative distance is not distributed to other routers via routing protocols etc.
Searching through several routing tables using the longest prefix match would be very computationally intensive. For reasons of efficiency, a single forwarding table (also Forwarding Information Base , FIB for short ) can therefore be created from many different routing entries or different routing tables , with which a hardware-related processing of packets to be forwarded is made possible. Although the hardware-related forwarding table is generated from the software-based routing table, both are often subsumed under the term routing table.
View the routing table
- With IOS-based Cisco routers, the routing table can be
show ip routelisted using the command .
- With Windows and Unix systems (including Linux ) the routing table can be
netstat -rdisplayed using the command .
- Under MacOS , the routing table
netstat -nris displayed with the command .
- With Windows this also works with the command
route -4 print.
- On Linux there is also iproute2 (
ip route) for this.
- With IOS-based Cisco routers, the routing table can be