2  Routing Fundamentals

In 60 Seconds

Routing determines how data packets travel from source to destination across interconnected networks by having each router independently choose the best next hop using routing tables. This chapter introduces routing fundamentals – from static and dynamic route types to IoT-specific protocols like RPL – providing the foundation for designing reliable sensor-to-cloud communication paths.

2.1 Learning Objectives

By completing this routing fundamentals series, you will be able to:

  • Explain routing and how it implements packet switching across interconnected networks
  • Analyze router forwarding decisions using routing tables, next hops, and metric comparisons
  • Differentiate route types distinguishing connected, static, and dynamic routes by their properties
  • Predict TTL behavior calculating how Time-To-Live prevents routing loops in multi-hop paths
  • Design IoT routing selecting appropriate protocols (RPL, static) for constrained network deployments
  • Evaluate routing protocol trade-offs comparing RIP, OSPF, BGP, and RPL for different network scales
Minimum Viable Understanding
  • Routing is the process of selecting paths for data packets to travel from source to destination across one or more networks. Routers examine destination addresses and consult routing tables to determine the best next hop for each packet.
  • Routing tables are the core data structure: each entry maps a destination network to a next-hop address, an outgoing interface, and a cost metric. Tables are built by static configuration or dynamic routing protocols (RIP, OSPF, BGP, RPL).
  • IoT routing introduces unique constraints: low-power devices, lossy wireless links, and mesh topologies require specialized protocols like RPL (IPv6 Routing Protocol for Low-Power and Lossy Networks) that optimize for energy, reliability, and constrained memory.

2.2 Introduction

Routing is fundamental to how data travels across networks, from IoT sensors through mesh networks to cloud servers. Every time a sensor reading leaves a device and arrives at a cloud dashboard, it has traversed a chain of routing decisions – each router along the path independently choosing the best next hop.

This chapter provides a comprehensive introduction to routing fundamentals and serves as the gateway to six focused sub-chapters that explore each topic in depth. Whether you are designing a smart home mesh network or architecting a large-scale industrial IoT deployment, understanding routing is essential.

High-level routing overview showing a sensor sending data through three routers to a cloud server, with each router consulting its routing table to determine the next hop
Figure 2.1: High-level routing overview showing a sensor sending data through three routers to a cloud server, each router consulting its routing table to determine the next hop

Sammy the Temperature Sensor needs to send an urgent reading to the cloud – the science lab is getting too hot! But the cloud is far, far away. Imagine Sammy is in one corner of a huge school building, and Principal Cloud’s office is on the opposite side.

Sammy can’t walk there – sensors stay in place! So Sammy hands the message to Lila the Light Sensor’s friend, Rita the Router, who is like a hallway monitor. Rita looks at her special notebook (her routing table) and says: “Messages going to Principal Cloud? I should pass them to Max in the next corridor!”

Max the Motion Sensor’s buddy Rocky Router gets the message and checks his notebook: “Principal Cloud? That goes through Bella’s hallway near the gym!” Bella the Buzzer watches as Rachel Router gets the message and delivers it directly to Principal Cloud’s office.

Here’s the cool part: None of the hallway monitors know the whole route. They only know the next step. That’s how routing works – each router just knows who to hand the message to next, like a relay race!

What if a hallway is blocked by a spilled bucket of paint? The monitors update their notebooks and find a different path. That’s why routing is so smart – it can work around problems!

Sammy says: “I don’t need to know how my message gets there. I just trust the routers to figure it out!”

Lila says: “It’s like when we play telephone – each person only talks to the next person in line!”

Max says: “And if someone is absent, we just skip to the next person. The message still gets through!”

Bella says: “The best part is the TTL countdown – it’s like a timer that makes sure the message doesn’t go in circles forever!”

Think of routing like a postal system for data packets.

When you mail a letter, you don’t plan the exact route it takes. You put an address on it and drop it in a mailbox. At each sorting office along the way, workers look at the address and decide where to send it next. Your letter may pass through several offices before reaching its destination.

Routing in computer networks works the same way:

  1. A data packet has a destination address (like an IP address)
  2. Each router it encounters looks at this address
  3. The router checks its routing table – a list that says “for destination X, send to next-hop Y”
  4. The packet moves one hop closer to its destination

Three things to remember:

  • Routers are the decision-makers at each junction
  • Routing tables are the maps routers use to make decisions
  • Routing protocols are the way routers share information to keep their maps up to date
Term What It Means Everyday Analogy
Router Device that forwards packets between networks Post office sorting center
Routing Table List of destinations and next hops Postal code directory
Next Hop The immediate next router to send to “Send to Manchester hub”
TTL (Time-To-Live) Limits how many hops a packet can make “Return to sender after 30 days”
Metric Cost associated with a route Distance or travel time to destination

You don’t need to understand all the math and algorithms yet. Start with the concept that routing is about making hop-by-hop forwarding decisions, and the rest will build naturally.

2.3 Prerequisites

Before diving into this series, you should be familiar with:

  • Networking Basics: Understanding fundamental networking concepts including IP addressing, packet switching, and the TCP/IP stack
  • Layered Network Models: Knowledge of the OSI and TCP/IP models helps you understand where routing operates (Network Layer)

Key Concepts

  • Routing Protocol: A set of rules and algorithms by which routers exchange information about network topology to build and maintain routing tables.
  • Interior Gateway Protocol (IGP): A routing protocol used within a single administrative domain (e.g., OSPF, RIP, RPL); contrast with exterior gateway protocols used between domains.
  • Convergence: The state when all routers in a network have consistent, accurate routing tables reflecting the current topology after a change.
  • Hop Count: The number of routers a packet traverses from source to destination; used as a simple routing metric in RIP and as one factor in RPL RANK.
  • Autonomous System (AS): A network under single administrative control; routing within an AS uses IGPs, while routing between ASes uses BGP.

2.4 Core Routing Concepts

Routing operates at the Network Layer (Layer 3) of the OSI model. Its purpose is to determine the best path for data packets to travel from source to destination across one or more interconnected networks. Understanding routing requires grasping several interrelated concepts.

2.4.1 Routing vs Forwarding

A common source of confusion is the distinction between routing and forwarding. Though closely related, they are fundamentally different operations:

  • Routing (Control Plane): The process of building and maintaining routing tables through protocol exchanges. This happens in the background and determines what paths exist.
  • Forwarding (Data Plane): The per-packet operation of looking up the destination in the routing table and sending the packet out the correct interface. This happens for every packet and must be fast.
Diagram showing the separation between control plane (routing protocols exchanging information to build routing tables) and data plane (forwarding engine using routing tables to move packets from input to output interfaces)
Figure 2.2: Control plane and data plane separation in routing

2.4.2 Routing Table Structure

Every router maintains a routing table – a data structure that maps destination networks to forwarding instructions. Each entry typically contains:

Field Description Example
Destination Target network or host address 192.168.1.0/24
Next Hop IP address of the next router 10.0.0.2
Interface Outgoing network interface eth0
Metric Cost or distance of the route 10
Source How the route was learned OSPF, Static, Connected

2.4.3 Types of Routes

Routes are learned through three primary mechanisms:

  1. Connected Routes: Automatically created for networks directly attached to the router’s interfaces. These are the most trusted routes.
  2. Static Routes: Manually configured by a network administrator. Useful for simple or predictable network topologies.
  3. Dynamic Routes: Learned through routing protocols (RIP, OSPF, BGP, RPL) that automatically discover and adapt to network changes.
Flowchart showing three types of routes -- connected routes from directly attached networks, static routes from administrator configuration, and dynamic routes from routing protocol exchanges -- all feeding into the routing table
Figure 2.3: Three types of routes feeding into the routing table

2.4.4 TTL and Loop Prevention

Time-To-Live (TTL) is a critical safety mechanism in IP networks. Each packet carries a TTL value (typically starting at 64 or 128) that is decremented by one at each router hop. When TTL reaches zero, the packet is discarded, preventing it from circulating indefinitely in case of a routing loop.

  • IPv4: Uses an 8-bit TTL field in the IP header
  • IPv6: Uses an 8-bit Hop Limit field (functionally identical)
  • Diagnostic use: The traceroute tool exploits TTL to map the path packets take through a network

2.4.5 Routing Protocols Overview

Different routing protocols serve different scales and purposes:

Hierarchical diagram of routing protocol families showing distance vector protocols (RIP, EIGRP), link-state protocols (OSPF, IS-IS), path vector protocols (BGP), and IoT-specific protocols (RPL), with their typical use cases noted
Figure 2.4: Hierarchical diagram of routing protocol families
Protocol Type Scale Key Feature IoT Suitability
RIP Distance Vector Small Simple, max 15 hops Poor – too much overhead
OSPF Link State Enterprise Fast convergence, areas Poor – requires too much memory
BGP Path Vector Internet Policy-based, AS paths Not applicable
RPL Distance Vector (DODAG) IoT Mesh Energy-aware, lossy link tolerant Designed for IoT

2.4.6 IoT Routing Challenges

IoT networks face routing challenges that traditional protocols were not designed to handle:

  • Battery-powered devices cannot afford the overhead of frequent routing updates
  • Lossy wireless links cause packet loss rates of 10–30%, far higher than wired networks
  • Constrained memory (often 10–256 KB RAM) limits routing table size
  • Dynamic topologies as nodes sleep, move, or fail require frequent reconvergence
  • Asymmetric links where signal strength differs in each direction complicate bidirectional communication

RPL addresses these challenges by building a Destination-Oriented Directed Acyclic Graph (DODAG) – a tree-like structure rooted at a border router, where traffic flows efficiently upward toward the internet or downward toward specific nodes.

How much energy does RPL’s ETX-aware parent selection save compared to naive hop-count routing? Consider a 50-node sensor network where 20% of links have poor quality (ETX > 3.0).

Hop-count routing (ignores link quality): - Chooses shortest path regardless of reliability - Poor 2-hop path selected over reliable 3-hop path - Average ETX per hop across poor links: 3.5 - Retransmissions waste energy: \(E_{\text{retry}} = 3.5 \times 50\text{ mW} \times 20\text{ ms} = 3.5\text{ mJ per packet}\)

ETX-aware routing (RPL with MRHOF): - RANK = parent_RANK + (ETX × 256) penalizes poor links - Routes around poor links by accepting one additional reliable hop - Energy per packet via reliable path: \(E_{\text{etx}} = 1.0 \times 50\text{ mW} \times 20\text{ ms} = 1.0\text{ mJ}\) - Saves: \(3.5 - 1.0 = 2.5\text{ mJ per packet}\)

Daily savings (100 packets/day/node): \(2.5\text{ mJ} \times 100 \times 50 = 12.5\text{ J/day}\) network-wide

Battery impact (CR2032 coin cell = 10.8 kJ): - Naive routing: \(\frac{10,800\text{ J}}{3.5\text{ mJ} \times 100 \times 365} \approx 8.5\text{ years}\) per node - ETX routing: \(\frac{10,800\text{ J}}{1.0\text{ mJ} \times 100 \times 365} \approx 29.6\text{ years}\) per node

In practice, with real-world duty cycles and radio overhead, typical CR2032-powered sensors achieve 2-5 years (naive) vs 5-10 years (ETX-aware). ETX routing roughly doubles to triples battery lifetime by avoiding costly retransmissions on lossy links.

2.5 Interactive: TTL Hop Counter

Use this tool to see how TTL decrements across a multi-hop path:

2.6 Quick Navigation

This comprehensive routing guide is organized into six focused chapters:

2.6.1 Core Concepts

  1. Routing Basics (~3,500 words)
    • What is routing and why it matters
    • How routers work as packet directors
    • Router forwarding decisions
    • Beginner-friendly explanations with analogies
  2. Time-To-Live (TTL) (~1,750 words)
    • Preventing routing loops with TTL
    • IPv4 vs IPv6 packet headers
    • Using traceroute to visualize paths
    • TTL implications for IoT networks
  3. Routing Tables (~2,600 words)
    • Routing table structure and entries
    • Three types of routes: connected, static, dynamic
    • Routing protocols (RIP, OSPF, BGP)
    • Longest prefix matching

2.6.2 Advanced Topics

  1. Packet Switching (~2,300 words)
    • Packet switching in action
    • Metric-based path selection
    • Real-world LoRaWAN sensor data journey
    • Calculating optimal routes
  2. IoT Routing (~2,100 words)
    • IoT-specific routing challenges
    • Failure scenarios and what-if analysis
    • Seven common routing mistakes
    • RPL for low-power networks
  3. End-to-End Connectivity (~1,600 words)
    • End-to-end connectivity requirements
    • Worked examples: static routes and loop diagnosis
    • Complete routing fundamentals summary
Learning path diagram showing six routing chapters in sequence from basics to end-to-end connectivity, with IoT routing highlighted as a key milestone
Figure 2.5: Learning path diagram showing six routing chapters in sequence
Recommended Learning Path

If you’re new to routing, begin with Routing Basics for a beginner-friendly introduction with real-world analogies.

If you’re already familiar with basic routing, jump to Routing Tables or IoT Routing for advanced topics.

Estimated total reading time: ~80 minutes (1 hour 20 minutes)


2.7 Worked Example: Designing Routing for a Smart Building IoT Network

Let us walk through a realistic scenario to see how routing concepts come together in practice.

Scenario: A smart building has three floors, each with environmental sensors (temperature, humidity, CO2) connected via a 6LoWPAN mesh network. Each floor has a local mesh router, and all floors connect to a central border router that bridges to the corporate LAN and then to a cloud analytics platform.

Network Layout:

Device IP Address Network Role
Floor 1 Sensors (x10) fd00:1::10 to fd00:1::19 6LoWPAN Mesh Source nodes
Floor 1 Mesh Router fd00:1::1 6LoWPAN Mesh Local aggregator
Floor 2 Mesh Router fd00:2::1 6LoWPAN Mesh Local aggregator
Floor 3 Mesh Router fd00:3::1 6LoWPAN Mesh Local aggregator
Border Router fd00::1 / 192.168.10.1 Mesh + LAN Protocol bridge
Corporate Router 192.168.10.254 LAN + WAN Internet gateway
Cloud Platform 203.0.113.100 Internet Destination

Step 1: Sensor to Floor Router (RPL Mesh)

A temperature sensor on Floor 1 (fd00:1::12) generates a reading of 23.7 degrees C. Its RPL-configured routing table has a default route via the Floor 1 Mesh Router (fd00:1::1). The sensor sets TTL to 64 and transmits.

Sensor fd00:1::12 -> Routing Table:
  Destination    Next Hop     Interface   Metric (ETX)
  default        fd00:1::1    wpan0       2.5

Step 2: Floor Router to Border Router

The Floor 1 Mesh Router receives the packet, decrements TTL to 63, and consults its routing table. For destinations outside the local mesh, packets go to the Border Router.

Floor 1 Router fd00:1::1 -> Routing Table:
  Destination    Next Hop     Interface   Metric (ETX)
  fd00:1::/64    --           wpan0       1.0  (connected)
  default        fd00::1      eth0        1.2

Step 3: Border Router Protocol Translation

The Border Router performs 6LoWPAN-to-IPv4 translation, encapsulates the payload, and forwards to the Corporate Router at 192.168.10.254. TTL is now 62.

Step 4: Corporate Router to Cloud

The Corporate Router has a default route pointing to its ISP gateway. The packet traverses several ISP routers (each decrementing TTL), following BGP-determined paths until it reaches the Cloud Platform at 203.0.113.100.

Step 5: Failure Recovery

Now suppose the Floor 1 Mesh Router fails. RPL detects the failure through missed DIO (DODAG Information Object) messages. Within seconds, the Floor 1 sensors discover an alternative path – some sensors can reach the Floor 2 Mesh Router through cross-floor wireless links. RPL automatically rebuilds the DODAG with new parent assignments.

Key Design Decisions:

Decision Choice Rationale
Routing Protocol RPL Designed for constrained 6LoWPAN devices
Metric ETX (Expected Transmission Count) Accounts for lossy wireless link quality
Default TTL 64 Sufficient for mesh depth of 10-15 hops
Backup Paths Cross-floor mesh links Provides redundancy if a floor router fails
Protocol Bridge Border Router with 6LoWPAN/IPv4 Connects constrained mesh to standard IP network

Lesson Learned: Using ETX as the routing metric (rather than hop count) means the network prefers reliable 3-hop paths over unreliable 2-hop paths, improving overall delivery rate from approximately 85% to 97% in this building.


2.8 Common Pitfalls

Common Pitfalls in Routing

Avoid these frequently encountered mistakes when working with routing:

  1. Confusing Routing with Forwarding: Routing is the process of building and maintaining routing tables (control plane). Forwarding is the act of moving a packet from an input interface to an output interface based on those tables (data plane). They are related but distinct operations.

  2. Assuming Global Knowledge: No single router knows the entire network topology. Each router makes decisions based on its local routing table. Designing systems that assume centralized path knowledge will fail in distributed networks.

  3. Ignoring TTL / Hop Limit: Forgetting to set appropriate TTL values leads to packets circulating endlessly in routing loops, consuming bandwidth and battery power on constrained IoT devices. Always verify TTL behavior during testing.

  4. Using Static Routes in Dynamic IoT Networks: Static routes are simple and predictable, but IoT mesh networks have nodes that frequently join, leave, or move. Using only static routes means the network cannot adapt to topology changes.

  5. Overlooking Asymmetric Paths: The path from A to B may differ from the path from B to A. This is common in IoT networks where link quality varies by direction. Always test bidirectional connectivity, not just one-way reachability.

  6. Treating All Links as Equal Cost: In IoT networks, link quality varies dramatically. A routing metric that only counts hop count may choose a 3-hop path with terrible links over a 4-hop path with excellent links. Use composite metrics (ETX, energy, latency) for IoT routing.

  7. Neglecting Convergence Time: After a topology change (link failure, new node), routing protocols need time to recalculate paths. During convergence, packets may be dropped or loop. Choose protocols with convergence times appropriate for your application – RPL converges in seconds for small meshes, while BGP may take minutes across the internet.


2.9 Knowledge Check

Test your understanding of routing fundamentals.


2.10 Summary

Routing is the backbone of all networked communication, determining how packets travel from source to destination across potentially complex, multi-hop networks. This chapter established the foundational concepts that the six sub-chapters explore in depth.

2.10.1 Key Takeaways

Concept Key Takeaway
Routing vs Forwarding Routing builds tables (control plane); forwarding uses them to move packets (data plane)
Routing Tables Map destination networks to next-hop addresses, interfaces, and cost metrics
Route Types Connected (auto-detected), Static (manually configured), Dynamic (protocol-learned)
TTL / Hop Limit Prevents infinite loops by limiting packet lifetime; decremented at each hop
Routing Protocols Enable routers to share information and compute paths collaboratively (RIP, OSPF, BGP, RPL)
IoT Constraints Low power, lossy links, limited memory, and dynamic topologies require specialized protocols like RPL
Composite Metrics IoT routing should use metrics beyond hop count (ETX, energy, latency) for reliable operation
Convergence After topology changes, routing protocols need time to recalculate; choose protocols with appropriate convergence times

2.10.2 Concepts to Carry Forward

  • Every router makes independent, local decisions – no single device knows the full path
  • Dynamic routing protocols are essential for IoT networks where topology changes frequently
  • RPL is the standard routing protocol for 6LoWPAN IoT mesh networks (RFC 6550)
  • ETX (Expected Transmission Count) is a superior metric to hop count for wireless mesh networks
  • The border router bridges constrained IoT networks to traditional IP infrastructure

2.10.3 Quick Reference: When to Use Each Protocol

Scenario Recommended Protocol Why
Small home IoT mesh (< 50 nodes) RPL Low overhead, energy efficient
Enterprise campus network OSPF Fast convergence, scalable with areas
Connecting ISP networks BGP Policy-based, handles internet scale
Simple point-to-point link Static routes No protocol overhead needed
Industrial IoT with real-time needs RPL with custom metrics Can optimize for latency and reliability

When designing IoT network routing, one critical early decision is whether to use manually-configured static routes or automated dynamic routing protocols. Use this framework to evaluate the trade-offs and select the approach that best fits your deployment.

Factor Static Routes Dynamic Protocols (OSPF/RPL)
Setup Complexity Low - configure each route manually High - protocol configuration + tuning
Operational Overhead High - manual updates when topology changes Low - automatic adaptation to changes
Scalability Poor - unmanageable beyond 20-30 routes Excellent - handles thousands of routes
Convergence Time N/A (manual reconfiguration) Fast (OSPF: seconds, RPL: 5-30s)
Bandwidth Overhead Zero - no protocol packets Moderate (OSPF LSAs, RPL DIOs/DAOs)
Memory Usage Minimal - only configured routes Higher - topology database (OSPF) or DODAG state (RPL)
CPU Usage Minimal - no protocol computation Moderate - Dijkstra (OSPF) or Bellman-Ford (RPL)
Failure Recovery Manual - admin must reconfigure Automatic - protocol detects and reroutes
Best For Small, stable networks; predictable traffic Large, dynamic networks; resilience critical

Decision Tree:

Question 1: Will your network topology change frequently?
+- YES -> Consider dynamic routing (automatic adaptation)
+- NO -> Static routes may suffice

Question 2: How many devices/subnets in your network?
+- < 10 devices -> Static routes acceptable
+- 10-50 devices -> Either approach works (depends on change frequency)
+- > 50 devices -> Dynamic routing strongly recommended

Question 3: Can devices tolerate manual failover (minutes to hours)?
+- YES (non-critical monitoring) -> Static routes OK
+- NO (real-time control, safety-critical) -> Dynamic routing required

Question 4: Are devices battery-powered with strict power budgets?
+- YES -> Static routes (zero protocol overhead) or RPL (energy-aware)
+- NO -> Any approach works

Question 5: Do you have networking expertise for protocol tuning?
+- YES -> Dynamic routing provides best long-term value
+- NO -> Static routes simpler for small deployments

Worked Examples:

Example 1: Home Automation (Static Routes)

  • Devices: 15 smart switches, thermostats, cameras
  • Topology: Star (all connect to single gateway)
  • Change frequency: Rare (new device added quarterly)
  • Power: Mains-powered
  • Decision: Static routes - simple, no protocol overhead, manual updates acceptable for infrequent changes

Configuration:

# Gateway routing table (static)
ip route add 192.168.1.0/24 dev eth0  # Smart switches
ip route add 192.168.2.0/24 dev eth1  # Thermostats
ip route add 0.0.0.0/0 via 192.168.0.1  # Internet

Example 2: Warehouse Logistics (RPL Dynamic Routing)

  • Devices: 200 mobile robots + 50 fixed sensors
  • Topology: Mesh (robots move, creating dynamic links)
  • Change frequency: Constant (robot positions change every 30 seconds)
  • Power: Battery-powered robots (8-hour shifts)
  • Decision: RPL with ETX metric - automatic route updates as robots move, energy-aware protocol designed for battery operation

Configuration:

// Contiki-NG RPL configuration
#define RPL_CONF_MOP RPL_MOP_STORING_NO_MULTICAST
#define RPL_CONF_OF RPL_OF_MRHOF  // Energy-aware objective function
#define RPL_MRHOF_CONF_MAX_LINK_METRIC 512

Example 3: Smart Building (Hybrid Approach)

  • Devices: 500 sensors (environmental, occupancy, energy)
  • Topology: Hierarchical (sensors -> floor routers -> building router -> cloud)
  • Change frequency: Moderate (sensor failures weekly)
  • Power: Mixed (wired floor routers, battery sensors)
  • Decision: Hybrid - RPL for sensor mesh on each floor, OSPF on wired backbone between floor routers, static default route to internet

Configuration:

# Floor router 1 (runs both RPL and OSPF)
# RPL on sensor-facing interface (wpan0)
# OSPF on backbone-facing interface (eth0)

# RPL handles sensors -> floor router
# OSPF handles floor router -> building router
# Static route handles building router -> internet

# Building router
router ospf 1
 network 10.0.0.0 0.0.255.255 area 0  # Floor routers

ip route 0.0.0.0 0.0.0.0 203.0.113.1  # Default to ISP

Hybrid Approach Benefits:

  • RPL for sensor mesh: Energy-efficient, handles frequent topology changes (sensor failures/additions)
  • OSPF for backbone: Fast convergence (sub-second), handles redundant paths between floors
  • Static default route: Zero overhead for internet-bound traffic

Key Decision Factors Summary:

Your Situation Recommended Approach Why
Small home network (< 20 devices) Static routes Simple, sufficient for star topology
Enterprise campus (100s of devices) OSPF on wired backbone Fast convergence, scalability
Battery-powered sensor mesh RPL with ETX metric Energy-aware, designed for constrained devices
Hybrid (wired backbone + wireless sensors) OSPF backbone + RPL mesh Best of both worlds
LoRaWAN star topology Static routes No mesh routing needed (LoRaWAN handles MAC layer)
Mobile robots / moving sensors Dynamic routing (RPL/AODV) Topology changes constantly

Common Mistake to Avoid: Don’t implement dynamic routing “just in case” for small static networks. The protocol overhead (bandwidth, CPU, memory) often exceeds the benefit. Start simple with static routes, migrate to dynamic routing when complexity justifies it (typically 50+ devices or frequent topology changes).

When a router receives an IP packet, it follows this systematic decision-making process:

Step 1: Destination Extraction

  • Extract destination IP address from packet header
  • Example: Packet arrives with destination 192.168.50.100

Step 2: Routing Table Lookup

  • Search routing table for matching routes
  • Multiple routes may match (e.g., 192.168.50.0/24, 192.168.0.0/16, 0.0.0.0/0)

Step 3: Longest Prefix Match

  • Select route with longest matching prefix (most specific)
  • /24 beats /16 beats /0 (default route)

Step 4: Metric Comparison (if needed)

  • If multiple routes have identical prefix length, compare metrics
  • Lower metric value = preferred route

Step 5: Forward Packet

  • Send packet out the selected interface to next-hop router
  • Decrement TTL by 1 before forwarding

Step 6: TTL Check

  • If TTL reaches 0, drop packet and send ICMP Time Exceeded
  • Prevents infinite routing loops

Step 7: Error Handling

  • If no route matches (no default route), drop packet
  • Send ICMP Destination Unreachable to source

This process happens for every packet, billions of times per second on internet core routers. Hardware-based forwarding engines optimize steps 1-5 to nanosecond speeds using Content Addressable Memory (CAM) and specialized ASICs.

Routing builds upon:

Routing connects to:

Routing enables:

  • Multi-hop sensor networks (WSN, mesh)
  • Internet-scale communication (BGP)
  • Load balancing and failover
  • Traffic engineering and optimization

Protocol Specifications:

Educational Resources:

Books & Courses:

  • Computer Networking: A Top-Down Approach by Kurose & Ross (Chapter 4)
  • TCP/IP Illustrated, Volume 1 by Stevens (Routing chapters)
  • Cisco CCNA Routing & Switching

IoT-Specific Resources:

2.11 What’s Next

Previous Up Next
Transport Fundamentals Routing & RPL Routing Basics

Begin your journey: Routing Fundamentals Overview

After completing the routing series, explore:

  • Network Topologies: Different network structures and routing implications
  • **IoT Routing Protocols{target=“_blank”}**: WSN and mesh routing in depth
  • Network Security: Securing routing protocols against attacks