Labs ICT
⭐ Pro Login

Routing

How routers decide the best path for your data.

Finding the Best Path

Routing is the process of selecting the best path for data to travel from its source to its destination across multiple networks. Routers are the devices that perform routing β€” they look at the destination IP address of each packet and decide where to send it next.

Think of routing like a GPS for data packets. The GPS doesn't drive the car β€” it just tells you which turns to make. Similarly, routers don't create the data β€” they just direct it toward its destination.

Static Routing

With static routing, the network administrator manually configures routes in the router's routing table. The router follows these fixed paths.


  Router A Routing Table (Static):
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Destination        β”‚ Next Hop    β”‚ Interfaceβ”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚ 192.168.1.0/24     β”‚ Direct      β”‚ eth0     β”‚
  β”‚ 192.168.2.0/24     β”‚ 10.0.0.2    β”‚ eth1     β”‚
  β”‚ 10.0.0.0/8         β”‚ 10.0.0.3    β”‚ eth1     β”‚
  β”‚ 0.0.0.0/0          β”‚ 10.0.0.1    β”‚ eth1     β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Advantage: Predictable β€” the administrator has full control over traffic paths.
  • Disadvantage: Doesn't adapt to changes. If a link fails, the router doesn't automatically find an alternate path. Requires manual maintenance.

Static routing works for small, simple networks. For larger networks, dynamic routing is essential.

Dynamic Routing

With dynamic routing, routers use routing protocols to automatically discover routes, share information with other routers, and adapt to network changes.

When a link goes down, dynamic routing protocols automatically recalculate paths and reroute traffic. This self-healing capability is what makes the internet resilient.

Routing Protocols

  • RIP (Routing Information Protocol) β€” A simple protocol that uses hop count as its metric (maximum 15 hops). Sends its entire routing table to neighbors every 30 seconds. Simple but slow to converge.
  • OSPF (Open Shortest Path First) β€” Uses a link-state algorithm. Each router knows the entire network topology and calculates the shortest path using Dijkstra's algorithm. Fast convergence, scalable, industry standard for large networks.
  • BGP (Border Gateway Protocol) β€” The protocol that runs the internet. Connects autonomous systems (like ISPs to each other). Uses path vectors and complex policies to determine the best route between networks.

How Routing Works in Practice


  Packet from PC (192.168.1.5) to Server (172.217.14.99)

  Hop 1: Home Router
    Receives packet, looks up destination in routing table
    Forwards to ISP gateway (default route)

  Hop 2: ISP Router
    Looks up destination, finds it's in a different network
    Forwards toward Google's network

  Hop 3: Google's Router
    Receives packet, delivers to the server

  Each hop: MAC address changes, IP address stays the same

Default Route

The default route (0.0.0.0/0) is the "last resort" route. When a router doesn't have a specific route for a destination, it uses the default route. Your home router's default route points to your ISP β€” any traffic not destined for your local network goes to the ISP.

πŸ§ͺ Quick Quiz

What does a router use to make forwarding decisions?