Routers: How the F*** Do They Work?

Ever wonder how that box sitting in the corner of your room with the blinky lights work… well here’s a quickie article

Sean Byrne
3 min readMar 16, 2023
Photo by Misha Feshchak on Unsplash

Intro

Routers are essential devices in computer networks that allow separate logical networks to communicate with each other. They operate at the Network Layer (Layer 3) and work with packets as the Protocol Data Unit (PDU). Routers are widely used in the internet to interconnect thousands of networks around the world. In this article, we will explore the workings of routers, with a particular focus on router interfaces and how they forward packets from one network to another.

Router Interfaces

Packet forwarding is the process of a router receiving a packet on one port and forwarding it out another port based on the packet’s destination network address and information in the routing table. To understand how routers use their interface to forward packets from one network to another, let’s examine the following steps:

Step One: A router receives a frame on an interface.

When a packet is received by a router, it first arrives in the form of a frame. The router checks the frame’s destination Media Access Control (MAC) address to determine if it matches the interface’s address.

Step Two: The router checks the frame’s destination MAC address.

If the destination MAC address matches the interface’s address, the router reads the frame. Otherwise, the frame is discarded.

Step Three: The frame header and trailer are stripped to create a packet.

If the frame is read, the router strips off the frame header and trailer to create the packet.

Step Four: The destination IP address is checked.

The router checks the destination IP address in the packet’s header.

Step Five: If the IP address’s network ID is different from the interface’s network ID, the packet should be routed.

If the network ID in the packet’s destination IP address is different from the network ID of the interface the packet was received on, the packet must be routed to another interface.

Step Six: The router consults the routing table.

The router consults its routing table to determine which of its interfaces the packet should be forwarded to.

Step Seven: The packet is encapsulated in a new frame header and trailer.

Once the router determines the interface the packet should be forwarded to, it encapsulates the packet in a new frame header and trailer.

Step Eight: The packet is forwarded to the destination computer or the next router in the path.

Finally, the router forwards the packet to either the destination computer or the next router in the path.

Conclusion

In conclusion, routers are crucial devices that operate at the Network Layer (Layer 3) and work with packets as the PDU. They connect separate logical networks to form an internetwork, allowing communication between different networks. Understanding how routers work and how they use their interfaces to forward packets is essential for network engineers and administrators. By following the steps outlined above, we can better comprehend the critical role routers play in modern computer networks.

--

--

Sean Byrne
Sean Byrne

No responses yet