10  Routing Fundamentals

In 60 Seconds

Routing is the process of forwarding data packets across networks by making hop-by-hop decisions using routing tables. Routers use connected, static, and dynamic routes along with TTL to prevent loops, and IoT networks require specialized protocols like RPL due to energy and memory constraints.

10.1 Learning Objectives

By the end of this routing fundamentals series, you will be able to:

  • Explain Routing: Describe how routing implements packet switching across networks
  • Analyze Router Function: Explain how routers make forwarding decisions using routing tables
  • Configure Routing Tables: Build routing table entries with destination, next hop, and metrics
  • Distinguish Route Types: Differentiate between connected, static, and dynamic routes
  • Apply TTL Concept: Calculate how Time-To-Live prevents routing loops in multi-hop networks
  • Design IoT Routing: Implement routing for constrained IoT networks using RPL

Think of routing like a GPS for data packets.

When you send a message from your IoT sensor to a cloud server, that message doesn’t magically appear at its destination. It travels through multiple networks, hopping from router to router, until it reaches the right place. Routing is the process of deciding which path each packet should take.

Real-World Analogy: Postal Delivery

Imagine sending a letter from London to Sydney: 1. Your local post office doesn’t deliver directly to Sydney 2. The letter goes to a regional hub → national hub → international hub → Australia → Sydney → final address 3. At each step, someone decides “where does this letter go next?”

Routers do exactly this for data packets:

  • Each router looks at the destination address
  • Checks its “routing table” (like a list of directions)
  • Forwards the packet to the next hop toward the destination

Key Concepts You’ll Learn:

Term What It Means 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”

Why Routing Matters for IoT:

  • Mesh networks: Your sensor might be 5 hops away from the gateway – each hop needs routing
  • Reliability: Good routing finds alternate paths when links fail
  • Efficiency: Smart routing saves battery on your constrained devices
  • Scalability: Proper routing lets you add thousands of sensors without manual configuration

IoT-Specific Routing Protocols:

Traditional routing protocols (like OSPF used in enterprise networks) are too “heavy” for IoT devices. That’s why we have specialized protocols: - RPL (Routing Protocol for Low-Power and Lossy Networks): Designed specifically for constrained IoT devices - Works with unreliable wireless links - Minimizes energy consumption - Optimizes for many-to-one traffic (sensors to gateway)

By the end of this chapter series, you’ll understand how packets find their way through complex IoT networks!

Consider a 5-hop IoT sensor network where each router takes 2 ms to make a forwarding decision:

\[\text{Total routing delay} = 5 \text{ hops} \times 2 \text{ ms/hop} = 10 \text{ ms}\]

Add transmission delays (100 bytes at 50 kbps per hop): \[\text{Transmission time per hop} = \frac{100 \text{ bytes} \times 8 \text{ bits/byte}}{50{,}000 \text{ bps}} = 16 \text{ ms}\] \[\text{Total end-to-end delay} = 5 \times (2 + 16) \text{ ms} = 90 \text{ ms}\]

For real-time IoT control (e.g., industrial automation requiring <100 ms response), you can afford at most 5-6 hops at 50 kbps. Beyond this, either reduce hops (add gateways), increase data rate, or use faster routing lookups (hardware-accelerated forwarding planes).

Routing is like passing notes in class, but way smarter!

10.1.1 The Sensor Squad Adventure: The Great Message Relay

The Sensor Squad lives in a big school building with lots of rooms, and they need to send important messages to Principal Cloud, whose office is on the other side of the building. But here’s the tricky part - the hallways are like a maze, and there are many different ways to get there!

Sammy the Temperature Sensor has urgent news: “The science lab is getting too hot! We need to tell Principal Cloud right away!” But Sammy can’t run all the way to the principal’s office - sensors have to stay where they are. So Sammy hands the message to Relay Rita the Router, who lives in the hallway.

“Don’t worry, Sammy!” says Rita. “I know exactly who to pass this message to.” Rita looks at her special notebook called a routing table. It says: “Messages for Principal Cloud - give to Rocky Router in the next hallway.” Rita doesn’t know the whole path to the principal’s office, but she knows the next step - that’s how routing works!

Rocky Router receives the message and checks HIS notebook. “Ah, for Principal Cloud, I send messages to Rachel Router near the gym.” Rocky passes it along. Then Rachel checks HER notebook and sees she can deliver directly to Principal Cloud’s office! The message hops from router to router - each one only needs to know the next step, not the whole journey.

Meanwhile, Lux the Light Sensor in the art room also needs to send a message. But oh no! The hallway Rocky Router uses is blocked by a spilled bucket of paint! Rocky’s routing table has a backup plan: “If main path blocked, use the library route instead.” The message takes a different path but still arrives safely.

Motio the Motion Detector asks, “What if a message gets stuck going in circles forever?” Great question! Every message carries a special countdown number called TTL (Time-To-Live). Each time a router passes the message along, it subtracts 1 from the countdown. If it reaches zero, the message stops - no more circles!

“That’s the magic of routing,” explains Rita. “We routers work as a team. None of us knows the entire school map, but together we can deliver any message anywhere, and even find new paths when hallways are blocked!”

10.1.2 Key Words for Kids

Word What It Means
Router A helper device that passes messages along to the next stop on the way to the destination - like students passing notes!
Routing Table A router’s special notebook that says “messages for THIS place go THAT direction” - like a cheat sheet for directions
Hop One step in the journey - when a message moves from one router to the next router
TTL (Time-To-Live) A countdown number on each message that prevents it from traveling forever in circles

10.1.3 Try This at Home!

Play the Message Relay Game!

  1. Get 4-6 family members or friends to stand in different rooms or corners
  2. Each person is a “router” - give each router a piece of paper with simple rules like:
    • “If message is for Kitchen, pass to the person in the hallway”
    • “If message is for Bedroom, pass to the person in the living room”
  3. Write a message addressed to someone not right next to you
  4. Pass the message following only the rules - no direct delivery allowed!
  5. Count how many “hops” it takes to arrive

Make it harder:

  • Block one path and see if the message can find another route
  • Add a “TTL=5” to your message - if it takes more than 5 hops, the message “expires”
  • Time how fast the message travels with different paths

What you’ll discover:

  • Messages don’t need to know the whole path - just the next step!
  • Having backup routes means messages still arrive even when paths are blocked
  • The more routers (friends) you have, the more paths are possible!

10.2 Routing Fundamentals Chapter Series

This comprehensive routing guide has been split into focused chapters for better learning. Each chapter builds on previous concepts while maintaining independence for reference.

10.2.1 Chapter Organization

Recommended Reading Order

Follow these chapters in sequence for the best learning experience, or jump to specific topics as needed.

10.2.2 1. Routing Basics

Core Concepts | ~15 min | Intermediate | 3,514 words

Learn what routing is, how routers work, and the fundamental decision-making process that enables packet forwarding across networks.

Topics covered:

  • What is routing and packet switching
  • Router architecture and components
  • Router operation at network layer
  • Router forwarding decision process
  • Routing vs forwarding distinction
  • 2 knowledge check quizzes
  • Diagrams: routing process, router components, operation flowchart

Start here if you’re new to routing concepts.


10.2.3 2. Time-To-Live (TTL)

Loop Prevention | ~10 min | Intermediate | 1,750 words

Understand how TTL prevents routing loops and ensures packets don’t circulate endlessly through networks.

Topics covered:

  • The routing loop problem
  • TTL field in IPv4/IPv6 headers
  • How TTL works hop-by-hop
  • TTL in diagnostic tools (traceroute, ping)
  • 1 knowledge check quiz
  • Worked example: diagnosing routing loop with TTL analysis
  • Diagrams: routing loop visualization, TTL countdown

Essential for understanding network reliability mechanisms.


10.2.4 3. Routing Tables

Path Storage and Lookup | ~15 min | Advanced | 2,603 words

Master routing table structure, longest prefix matching, and how routers make forwarding decisions using routing tables.

Topics covered:

  • Routing table entry structure (destination, next hop, interface)
  • Reading and interpreting routing tables
  • Longest prefix match algorithm with binary calculations
  • Three types of routes: connected, static, dynamic
  • Routing protocols overview (RIP, OSPF, BGP, RPL)
  • 2 knowledge check quizzes
  • Worked example: longest prefix match calculation for smart building
  • Diagrams: routing table structure, route types

Critical for network engineering and troubleshooting.


10.2.5 4. Packet Switching

Routing in Action | ~15 min | Intermediate | 2,296 words

See routing in action through real-world examples, common pitfalls, and failure scenarios.

Topics covered:

  • Packet switching process demonstration
  • Real-world example: LoRaWAN sensor data journey through 7 hops
  • Common misconception: “Shortest path is always best”
  • 7 common routing pitfalls to avoid
  • Router failure scenarios (What Would Happen If)
  • Visual reference gallery
  • Worked example: calculating optimal route in smart building network

Practical application of routing concepts to real IoT systems.


10.2.6 5. End-to-End Connectivity

Network Reachability | ~10 min | Intermediate | 1,569 words

Understand the requirements for end-to-end connectivity and how to troubleshoot routing issues.

Topics covered:

  • Layer 3 connectivity requirements
  • End-to-end reachability principles
  • Common routing configuration mistakes
  • Worked example: configuring static routes for IoT gateway
  • Troubleshooting routing problems methodically

Essential for network deployment and maintenance.


10.2.7 6. IoT Routing

Constrained Networks | ~15 min | Advanced | 2,089 words

Apply routing concepts to IoT-specific challenges: energy constraints, lossy wireless links, and multi-hop mesh networks.

Topics covered:

  • RPL (Routing Protocol for Low-Power and Lossy Networks)
  • Energy-efficient routing strategies
  • Lossy link handling with ETX metrics
  • Multi-hop mesh network routing patterns
  • Geographic and gradient-based routing algorithms
  • IoT routing challenges and solutions
  • 1 knowledge check quiz

Specialized content for IoT network designers.


10.3 Prerequisites

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

  • Networking Basics: Understanding fundamental networking concepts including IP addressing, packet switching, and the TCP/IP stack provides the foundation for routing concepts
  • Layered Network Models: Knowledge of the OSI and TCP/IP models helps you understand where routing operates (Network Layer) and how it relates to other protocol layers
  • **IPv6 Fundamentals{target=“_blank”}**: Familiarity with IP addressing and network prefixes is essential for understanding routing table entries and forwarding decisions

10.4 The Challenge: Finding Paths in Complex Networks

The Problem: Networks can have millions of possible paths:

  • Internet scale: Billions of devices, countless potential routes
  • Limited visibility: Each router only sees its immediate neighbors
  • No central authority: No single device knows the complete network topology
  • Constant change: Networks evolve continuously – links fail, devices join and leave

Why It’s Hard:

  • Memory constraints: Cannot store explicit routes to every possible destination
  • Bandwidth limits: Flooding every packet to find paths wastes precious bandwidth
  • Convergence speed: Must adapt quickly when topology changes (failures, additions)
  • Multi-objective routing: Different traffic types may need different optimal paths

What We Need:

  • Distributed decision-making: Routers must cooperate without central control
  • Scalable route storage: Address aggregation to compress routing tables
  • Fast convergence: Rapid adaptation when links fail or recover
  • Flexible metrics: Support for multiple criteria (hop count, latency, energy cost)

The Solution: Routing protocols that collaboratively build and maintain routing tables across the network. These protocols exchange information between neighbors, compute optimal paths, and adapt to changes – all without requiring global network knowledge at any single point.

In IoT networks, this challenge is amplified by resource constraints, lossy wireless links, and the need for energy-efficient operation.

10.5 Interactive: End-to-End Delay Calculator

Estimate end-to-end routing delay for a multi-hop IoT path:

10.7 Cross-Hub Connections

Simulations & Interactive Tools:

Knowledge Checks & Quizzes:

Video Resources:

Common Knowledge Gaps:

10.8 Quick Navigation

Start Here: Routing Basics - Begin with fundamental concepts

For IoT Focus: IoT Routing - Jump directly to IoT-specific content

Hands-On Practice: Routing Labs and Quiz - Test your knowledge with practical exercises

Advanced Concepts: RPL Fundamentals - Deep dive into IoT-specific routing protocols

10.9 Knowledge Check

Scenario: A warehouse temperature monitoring system has 20 sensors arranged in a 3-hop mesh network. Sensors report data every 30 seconds to a cloud dashboard. Recently, sensors deeper in the mesh (hops 2 and 3) show 40% packet loss, while 1-hop sensors work fine.

Network Details:

  • Mesh protocol: RPL over 6LoWPAN
  • Gateway: Border router at fd00::1
  • Problem sensors: fd00:2::10 (2 hops), fd00:3::15 (3 hops)
  • Working sensors: fd00:1::5 (1 hop)

Step 1: Check TTL Values

Use ping from gateway to each sensor tier:

# 1-hop sensor (working)
ping6 fd00:1::5 -c 10
# Result: 0% packet loss, TTL=63 in replies

# 2-hop sensor (problematic)
ping6 fd00:2::10 -c 10
# Result: 60% packet loss, TTL=62 when successful

# 3-hop sensor (problematic)
ping6 fd00:3::15 -c 10
# Result: 80% packet loss, TTL=61 when successful

Analysis: TTL values are correct (64 - hop_count = remaining TTL), but packet loss increases with hop depth. TTL is not the issue – link quality is.

Step 2: Check Routing Metrics (ETX)

Query RPL routing tables on intermediate routers:

Router at fd00:1::1 (tier 1):
  To fd00:2::10 -> Next hop fd00:1::8, ETX 4.5
  To fd00:3::15 -> Next hop fd00:1::8, ETX 8.2

Router at fd00:1::8 (intermediate):
  To fd00:2::10 -> Direct, ETX 4.2
  To fd00:3::15 -> Next hop fd00:2::10, ETX 7.8

Analysis: High ETX values (>4.0) indicate lossy wireless links. ETX of 4.5 means 4-5 transmission attempts needed per successful delivery. At 3 hops with ETX ~4, cumulative success rate = \((1/4)^3 \approx 1.6\%\) per packet – meaning roughly 98% of packets are lost at 3 hops.

Step 3: Root Cause

The warehouse has metal shelving creating RF shadows. Intermediate router fd00:1::8 has poor link quality to downstream sensors due to signal blockage.

Solution Options:

Option Implementation Expected Improvement Cost
Add relay node Place router at fd00:1::12 to bypass blocked path ETX 2.0 per hop, 87% delivery rate $150 hardware
Increase TX power Boost from 0 dBm to +8 dBm May improve ETX to 2.5, 64% delivery $0 (config change)
Add redundant paths Deploy 2nd gateway for mesh diversity Multiple parent options, self-healing $400 hardware

Implemented Solution: Added one relay node at fd00:1::12 positioned to avoid metal shelving.

Results After Fix:

  • 2-hop sensors: 98% delivery (ETX dropped from 4.5 to 1.8)
  • 3-hop sensors: 94% delivery (ETX dropped from 8.2 to 2.4)
  • No additional packet loss observed over 7-day monitoring period

Key Lessons:

  1. TTL alone doesn’t diagnose packet loss – it only detects routing loops
  2. ETX metric reveals link quality – values >3.0 indicate problematic wireless links
  3. Multi-hop reliability degrades exponentially\((1/\text{ETX})^{\text{hops}}\)
  4. Physical environment matters – metal objects and concrete walls block RF signals

Prerequisites:

  • Networking Basics → IP addressing, packet switching, network layers
  • Layered Network Models → OSI/TCP-IP layers, network layer operation

Builds Toward:

  • Transport Protocols → TCP/UDP depend on routing for packet delivery
  • RPL Protocol → IoT-specific routing implementation
  • Network Security → Route authentication, secure routing protocols

Relates To:

  • Network Topologies → Mesh, tree topologies determine routing complexity
  • WSN Architecture → Wireless sensor network routing challenges
  • 6LoWPAN → Routing in constrained IPv6 networks

Within This Module:

Related Modules:

External Resources:

  • RFC 791: Internet Protocol (IPv4)
  • RFC 2460: Internet Protocol Version 6 (IPv6)
  • RFC 6550: RPL Protocol for Low-Power Networks
Previous: Network Topologies Next: Routing Basics

10.10 What’s Next

If you want to… Read this
Begin with routing basic concepts Routing Basics
Learn packet switching fundamentals Packet Switching
Explore IoT-specific routing Routing for IoT
Deep dive into RPL for IoT mesh RPL Fundamentals

Begin your routing journey with Routing Basics to learn the fundamental concepts of how routers forward packets across networks.

After completing this series, explore: