What Is a Routing Table and How Does It Work?

Written by Coursera Staff • Updated on

Routing tables are an essential component of computer networks that network devices like routers and switches use. Discover how routing tables work by transmitting packets through a series of protocols.

[Featured Image] A computer science learner works on their laptop while studying routing tables and their role in computer networking.

Routing tables are an essential part of network devices, such as routers and switches. Updated through manual manipulation by a network administrator or through network routing protocols, a routing table tells the packet (information sent between computers) which physical interfaces to use while traveling from one device to another. If the data packet is meant for an external network or different subnet, then the routing table sends it to the gateway.

Explore how a routing table works, dynamic and static routing protocols, what makes up a routing table, and the types of routing protocols that determine the routing table. 

What is a routing table?

The routing table is a set of rules that directs where to send data packets over an IP network. Stored within the random access memory (RAM) of storage devices like network switches and routers, routing tables are individually unique, and each works as network address maps, storing source and destination IP addresses, routing information, and the addresses for default gateways. Ultimately, this helps computers communicate with other devices on different networks, expanding the distance of how networks can interact with each other. 

How does a routing table work?

The goal of a routing table is to help routers determine the most effective routes for data packets. When sending data packets to host devices or other networks, routers consult routing tables to attain the IP addresses and best paths. Routing tables direct the packets to the appropriate neighboring router or next hop, eventually getting the packet to its intended destination. The entire process can happen incredibly fast, with a router consulting its routing table over a million times per second. 

Network routing protocols help to keep routing tables updated and determine where data packets go. Two types of routing protocols exist to maintain the routing tables:

  • Static routing protocols: Static routing protocols use routes that network administrators manually input, giving routers information on how to reach different network IDs within the more extensive network. This protocol works best with preconfigured routes on the same subnet but falters when communication expands beyond the subnet. Since routers do not share static routes, static routing can conserve overhead and bandwidth. Static routing protocols are typically best used in smaller networks, as every entry requires manual entry and updates to function.  

  • Dynamic routing protocols: Dynamic routing protocols, such as routing information protocol (RIP) and open shortest path first (OSPF), automatically create and maintain the routing table. They work automatically to communicate using routing protocols instead of a network administrator. It allows dynamic routing protocols to automatically change routes when better routes are available. This makes dynamic routing a better fit for larger organizations since automatic routing eliminates manual human interaction.   

However, another protocol combines dynamic and static protocols since they connect interior autonomous systems to external networks. 

Automatic routing

Automatic routing occurs when small networks contain one router. This low-level routing mechanism is helpful because it limits routing packets’ cycles and storage requirements. Automatic network routing involves fast packet switching, no-session awareness, and source routing through end nodes.

In automatic routing, the router handles all routing protocols without manually managing or maintaining the routing table. Automatic routing often works with networks that have a single router since they cannot add additional routing information that is not already available on the router.

Route determination

The routing table is important because it determines the network route data packets follow. Before route determination occurs, the packet is sent to the router and receives an IP address to help dictate the best route. The router receives this data packet and references it against the routing table, using the table to send the packet closer to its destination. Each router tries to get the package to the next hop, consulting the routing table of every router and trying to use the fewest hops. The packet reaches its destination when the destination IP address matches the network that receives it.

What comprises a routing table?

Data tables require specific information to send packets where they need to go. Let’s examine some of the information that comprises a routing table. 

  • Network ID: A network ID contains the host ID and information on the route to the destination.

  • Destination address: A destination address is the final IP address for the device's network that requested the packet. 

  • Subnet mask: A subnet mask is a 32-bit netmask that matches the destination address to the IP address, indicating whether or not the destination address is in the network. Subnetting can divide networks into smaller, more connected networks.

  • Metric: The metric gives each route a value that determines some routes' preference level or priority over others. It does this by measuring how many hops each route contains to reach the intended destination, indicating the minimal number and most efficient route.

  • Gateway: The gateway is the next hop available, revealing the routing information for the closest neighboring router to which the data packet forwards. 

Types of routing protocols

Each routing protocol has a different way of selecting the best path to send data packets. Below is a list of popular routing protocols:

  • Routing information protocol (RIP)

  • Open shortest path first (OSPF)

  • Enhanced interior gateway routing protocol (EIGRP)

  • Border gateway protocol (BGP)

Let’s look deeper at some standard routing protocols and how they differ.

Routing information protocol (RIP)

RIP is one the oldest and most widely used routing protocols, and you can use it with local area networks (LAN) and wide area networks (WAN). RIP evaluates networks by sharing their IP address and communicating with them. However, the biggest con of RIP is that it is only useful for small networks since it has a maximum hop count of 15 and uses hop count as its only metric for deciding the best path.

Open shortest path first (OSPF)

OSPF is a widely used interior gateway routing protocol in LAN networks. Routing information through an algorithm called Dijkstra, the OSPF protocol uses link state and the shortest path forward (SPF) algorithm to determine the shortest path of the data packet. Routers share link state information to calculate distances. Unlike RIP, OSPF sends information faster and has no hop count limit, making it more scalable. 

Enhanced interior gateway routing protocol (EIGRP)

EIGRP is a routing protocol developed by Cisco that allows for 255 hops and uses autonomous systems. EIGRP has a shorter administrative distance than RIP and OSPF, making it a fast and efficient routing protocol. Using a dependable transport protocol, EIGRP diffuses the update algorithm to create a quicker convergence process.  EIGRP stores all routes, not just the best routes, making transfers quick, even if the best route fails. EIGRP is a protocol only Cisco routers use, so all routers on an EIGRP network must be Cisco. 

Border gateway protocol (BGP)

Unlike the previous three routing protocols, BGP is an exterior gateway protocol, which are all interior gateway protocols. BGP can communicate with routers outside of a LAN, making it the protocol used for the internet. BGP chooses the best path forward using path length, origin type, router identification, and neighbor IP addresses to determine routes. Authorizing advanced security, BGP only allows authorized users to alter transfer routes and exchange data, making it a more secure protocol. 

How to get started in routing tables and protocols

Understanding protocols and how to use them is vital for network engineers, network architects, and traffic routing engineers. Network architects typically have a bachelor’s degree in computer science, engineering, or a similar field, while many employers prefer network architects to have a master’s degree. Many network engineers and architects start as network administrators to gain entry-level experience in the field. 

Getting started with Coursera

Routing protocols like RIP, OSPF, BGP, and EIGRP are essential to understanding how to work with the routing table and configure efficient networks. Continue learning about routing tables and networking or building your skills on Coursera. For example, you might consider the Google IT Support Professional Certificate to gain the skills for an entry-level career in networking. Alternatively, you can build foundational knowledge and skills to explore the field with a beginner-friendly course like The Bits and Bytes of Computer Networking from Google. 

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.