A Routing Table Is A Set Of Rules Often Prepared In The Form Of A Table And Used To Determine Where Data Packets are Transmitted Over An Internet Protocol (IP)-Based Network Should Be Sent.
Usually, this table is stored in the Random Access Memory of equipment such as routers and network switches.
In computer networks, each routing table is unique and acts as an address map for the networks. Routing tables store the source and destination IP addresses of routing devices, default gateway addresses, and related routing information.
Routing tables are typically dynamically updated through network routing protocols, but network administrators may sometimes add static entries manually.
How does the routing table work?
The primary purpose of the routing table is to help routers make effective routing decisions. Whenever a packet is sent through a router to a host on another network, the router consults the routing table to find the destination device’s IP address and the best route to reach the destination. Then, depending on the neighbor router or next hop listed in the table, it routes until it reaches its final destination.
To manage network traffic, a router uses its routing tables millions of times per second.
Routing table entries
Each routing table may contain different entries and information, such as IPv4 or IPv6 address classes, but the primary fields of all routing tables are fixed. Among the main entrances of the routing table, the following should be noted:
- Destination: The IP address of the final destination of the packet.
- Subnet mask: Also known as netmask, it is a 32-bit network address that identifies whether a host belongs to the local or remote network. To increase routing efficiency and reduce the size of the broadcast domain, administrators can apply a custom subnet mask through the subnetting process, which can divide a network into two or smaller connected networks.
- Gateway The next hop is the IP address of the neighboring device to which the packet is sent.
- Interface: Routers usually use Ethernet interfaces to connect to other devices on the same network, such as eth0 or eth1, and serial interfaces to connect to wide area networks (WAN). The routing table lists the input network interface, also known as the output interface that a device should use when forwarding a packet to the next hop.
- Metric: This entry assigns a value to each available route to a specific network. This value ensures that the router can choose the most efficient way. Sometimes, the metric is the number of routers a data packet must pass through before reaching its destination address. The method with the lowest metric is considered the priority if multiple routes to a destination network exist.
- Routes: includes directly connected subnets and indirect subnets that are not connected to the device but can be accessed through one or more hops and are default routes for directing specific traffic.
How does network routing work?
A network packet must go through different paths to reach its destination. To understand the relationship between routing and routing table, we need to examine the steps passed during data packets’ transmission. These steps are as follows:
- A sending device, such as a computer, binds IP addresses to data packets and provides them to the router. The computer sends a packet to the router with the same address as a postal packet. This technique helps the router determine the best routes to take packages to their destination. A computer is usually connected to a local area network (LAN) to forward packets, while a router can forward packets between different LANs and WANs.
- The goal of a router is to forward the packet to the nearest router near the final destination. The router receives the packet. When the router receives the box, it analyzes it with its internal routing tables to determine the most efficient route to forward the packet.
- A router routes packets. Usually, it is unlikely that the primary router will deliver the package directly to the destination. Therefore, it looks at the routing table to route the box to the next hop. The routing table keeps the number of balls as low as possible by providing the most efficient route to the router. The number of final balls refers to the number of times a packet goes from one router to another to reach its destination.
- The above process is repeated. At the next hop, another router takes control of the flow and repeats the method of determining where to send the packet by looking at its internal routing tables. This process is repeated several times before the package reaches its destination. The routing process may seem long, but process is fast due to advanced routing protocols.
- The package arrives at the destination. When a packet reaches the last router on the same network as the destination IP address, it is routed directly to the device or server it was intended for.
Types of routing, static routing versus dynamic routing
Routing is choosing the ideal path for a network, and routers use the information entered in the routing table to determine the best way. There are two methods for building and maintaining the routing table: static and dynamic.
Advantages and disadvantages of static routing
- A network administrator can manually create, manage, and update static routing table entries.
- Entries for static network devices do not change unless the administrator manually changes them.
- Static routes provide an acceptable level of control over routing, as each course is manually configured for full connectivity.
- Adding a manual entry for each route is practically impossible for large networks.
- Static routing saves bandwidth and overhead because routers do not share static routes.
- Static routing is not fault tolerant. Any changes to the network infrastructure, such as adding a new network or breaking a link, are not automatically updated and require manual editing. As a result, clients will not be able to send and receive packets during this time.
- In a static environment, routers do not have the option to automatically switch to a better route if a link is unavailable.
- Static routes always have an AD management distance of 1, which is preferred over dynamic routes unless the AD is changed. One thing to note in this section is that if an AD is modified, it is known as a floating static route.
Advantages and disadvantages of dynamic routing
- In dynamic routing, devices automatically update their routing tables using routing protocols to exchange information about the network topology around them. Examples of routing protocols include Routing Information Protocol, Enhanced Interior Gateway Routing Protocol, and Open Shortest Path First.
- Dynamic routing tables allow devices to listen for network activity and respond to events such as device failures and congestion.
- Dynamic routing consumes more bandwidth and overhead because routers share active routes.
- If there is a change in the routing infrastructure, the router can dynamically choose a better route.
- Dynamic routing is easier and simpler to configure in more extensive networks.
- Dynamic routing allows routers to balance multiple links.
- Routing protocols — not network administrators — choose the best routes to reach destinations.