What is a router and how does it route traffic?
· Category: Networking
Short answer
A router is a Layer 3 device that forwards data packets between different networks based on IP addresses. It determines the best path for traffic using routing tables and protocols.
How it works
When a packet arrives, the router inspects the destination IP address. It consults its routing table, which contains entries for directly connected networks, static routes, and dynamically learned routes. The router selects the most specific match and forwards the packet out the appropriate interface.
Dynamic routing protocols like OSPF, EIGRP, and BGP allow routers to share information and adapt to topology changes automatically. Routers decrement the TTL field to prevent infinite loops.
Example
Your home router connects your local LAN to your ISP's network. When you access a website, it forwards your packets to the ISP's gateway, which then routes them across the internet through multiple autonomous systems.
Why it matters
Routers are the backbone of the internet. Without intelligent path selection, networks would be isolated islands. Understanding routing is essential for designing scalable, fault-tolerant networks.