15  Routing: Comprehensive Review

In 60 Seconds

Routing review covering longest prefix matching, protocol comparison (distance-vector vs link-state), route selection via administrative distance and metrics, and debugging routing loops and black holes in IoT networks.

This chapter is a capstone for the routing material. It assumes you are already comfortable with the basic ideas from:

  • Routing Fundamentals - what routers do, what routing tables look like.
  • Routing - detailed examples, IoT-specific protocols like RPL, and energy trade-offs.

Use this review to test and deepen that understanding through scenario-based questions covering longest-prefix matching, loop prevention, and protocol trade-offs.

“Time to put everything together,” said Max the Microcontroller. “This review covers the three pillars of routing: longest prefix matching for route selection, convergence for network recovery, and advanced configuration for production deployments.”

“Longest prefix matching is the most important algorithm in routing,” explained Sammy the Sensor. “When a router has multiple matching routes, it always picks the most specific one. A /24 route always beats a /8 route – specificity trumps everything!”

“Convergence time matters a lot for IoT,” added Lila the LED. “When a node fails in a mesh network, how long before traffic reroutes? Distance-vector protocols take minutes. Link-state protocols take seconds. RPL with Trickle timer reset can converge in under a second for local failures.”

“And advanced configuration is about making routing reliable in production,” said Bella the Battery. “Floating static routes provide automatic failover. Redundant paths prevent single points of failure. Default routes connect your IoT gateway to the internet. These are the skills that separate lab demos from real deployments!”

15.1 Learning Objectives

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

  • Apply Longest Prefix Matching: Determine next-hop routers using routing table lookups
  • Compare Routing Protocols: Evaluate distance-vector vs link-state for different networks
  • Analyze Route Selection: Evaluate administrative distance and metric calculations
  • Debug Routing Issues: Diagnose routing loops, black holes, and suboptimal paths
  • Design Routing Tables: Plan efficient routing structures for IoT network deployments
  • Configure Redundant Paths: Implement floating static routes for automatic failover

15.2 Review Chapter Series

This comprehensive routing review is organized into three focused chapters:

15.2.1 1. Longest Prefix Matching

Master the fundamental algorithm routers use to select routes:

  • Route specificity: Why /24 routes beat /8 routes regardless of metrics
  • Common misconception: Lower metrics don’t always win - prefix length is king
  • Route summarization: Combining subnets to reduce table size
  • Practical examples: Step-by-step routing table lookups

Estimated time: 30 minutes

15.2.2 2. Convergence and Loop Prevention

Understand how routing protocols stabilize and prevent infinite loops:

  • Distance vector convergence: Calculate propagation time for multi-hop networks
  • TTL behavior: How Time-To-Live prevents packets from looping forever
  • Protocol trade-offs: Convergence speed vs battery life in IoT networks
  • Loop calculations: Determine exactly how many cycles before packet drop

Estimated time: 35 minutes

15.2.3 3. Advanced Configuration

Apply routing concepts to production IoT deployments:

  • Floating static routes: Configure automatic failover with administrative distance priority
  • Router forwarding decisions: Trace step-by-step how routers select paths
  • Default routes: Essential for internet connectivity in IoT gateways
  • Cost analysis: Optimize backup path usage to minimize expenses

Estimated time: 35 minutes

15.3 Prerequisites

Required Chapters:

Routing Protocol Comparison:

Protocol Type Use Case IoT Relevance
RIP Distance Vector Small networks Legacy
OSPF Link-State Enterprise Edge routers
BGP Path Vector Internet Cloud connectivity
RPL Distance Vector IoT/WSN Primary IoT protocol

Total Estimated Time: 1.5 hours

Deep Dives:

Comparisons:

Protocols:

Learning Hubs:

  • Quizzes Hub - Test routing concepts covering longest prefix matching, TTL behavior, and protocol selection
  • Simulations Hub - Interactive routing simulators for convergence time and loop detection
  • Videos Hub - Demonstrations of routing table lookups, RPL DODAG formation, and failover
  • Knowledge Gaps Hub - Address misconceptions (e.g., “metrics always matter” vs “longest prefix wins first”)
  • Knowledge Map - See how routing connects to transport protocols, topologies, and mesh networks

15.4 Interactive Calculators

Try It: IoT Routing Energy Calculator

Adjust the parameters below to compare daily energy consumption between distance-vector (RPL) and link-state (OLSR) routing protocols on battery-powered IoT nodes.

Try It: Protocol Cost-Benefit Calculator

Compare the 5-year total cost of ownership between distance-vector and link-state routing for an IoT deployment. Adjust network size, hardware costs, and failure parameters.

15.4.1 Mid-Chapter Check

15.5 Key Concepts Overview

  • Longest Prefix Match: Routers select the most specific matching route (highest prefix length wins)
  • Convergence: Time for routing information to propagate through the network after changes
  • TTL (Time-To-Live): Safety mechanism preventing routing loops by limiting packet lifetime
  • Default Route: Catch-all route (0.0.0.0/0) for destinations without specific routes
  • Floating Static Routes: Backup routes with higher administrative distance that activate on primary failure
  • RPL Protocol: Distance-vector protocol optimized for low-power IoT mesh networks

Common Pitfalls

Knowing that Dijkstra finds the shortest path and that OSPF uses link-state is necessary but insufficient. Review must include understanding when to use each protocol and the operational cost of running it in constrained environments.

Network routing takes time to converge after topology changes. Applications that send data immediately after a topology event (node failure, rejoining) may encounter routing loops or black holes during the convergence window.

Administrative distance ranks routing protocol trustworthiness; route metric measures path cost within a protocol. Mixing these concepts leads to incorrect multi-protocol route selection analysis.

15.6 Summary

This routing review series provides comprehensive coverage of routing concepts essential for IoT network design:

  1. Longest Prefix Matching - Route selection algorithm fundamentals
  2. Convergence and Loop Prevention - Protocol behavior and TTL safety
  3. Advanced Configuration - Production deployment patterns

Complete all three chapters to master routing for IoT deployments.

15.7 Knowledge Check

When selecting a routing protocol for IoT mesh networks, engineers must balance convergence speed, resource consumption, and reliability. Use this framework to choose between distance-vector (e.g., RPL, AODV) and link-state (e.g., OLSR) protocols.

Decision Factor Distance-Vector (RPL, AODV) Link-State (OLSR, OSPF) Recommended For
Network Size Up to 200-500 nodes Up to 100-150 nodes Distance-vector for large IoT deployments
Memory Footprint Low (5-20 KB) High (50-200 KB) Distance-vector for constrained devices (MCUs with 32-256 KB RAM)
CPU Overhead Very Low (periodic updates) High (topology map computation) Distance-vector for battery-powered sensors
Convergence Time Slow (30-90 seconds) Fast (5-15 seconds) Link-state for real-time control systems
Routing Loop Risk Medium (count-to-infinity) Low (complete topology view) Link-state for critical infrastructure
Bandwidth Overhead Low (incremental updates) High (full topology flooding) Distance-vector for bandwidth-constrained networks (LoRaWAN, NB-IoT)
Battery Life Impact Minimal (sleep between updates) Significant (always-on processing) Distance-vector extends battery 3-5x
Network Churn Tolerance Good (handles frequent joins/leaves) Poor (every change triggers flood) Distance-vector for mobile/dynamic networks
Optimal Path Selection Good (based on metrics) Excellent (knows all paths) Link-state if path optimality critical

Numeric Comparison for 100-Node IoT Mesh:

15.7.1 Scenario: Smart Building with 100 Zigbee Sensors

Distance-Vector (RPL) Configuration:

Memory per node: 12 KB (routing table + neighbor cache)
CPU usage: 0.5% average (periodic DIO transmission)
Convergence after node failure: 45 seconds
Routing table updates: Every 60 seconds (Trickle timer)
Bandwidth overhead: 200 bytes/minute (compressed DIO messages)
Battery impact: Minimal (deep sleep between updates)
Expected battery life: 2-3 years (AA batteries)

Let’s calculate the battery impact difference numerically for a 100-node network:

RPL (Distance-Vector) daily energy per node:

  • Transmissions per day: 1 per minute \(\times\) 60 min/hr \(\times\) 24 hr = 1,440
  • Energy per transmission: 20 mA \(\times\) 0.1 sec = 2 mAs

\[\text{Routing energy} = 1{,}440 \times 2 \text{ mAs} = 2{,}880 \text{ mAs} = 0.8 \text{ mAh/day}\] \[\text{Sleep energy} = 24 \text{ hrs} \times 5 \;\mu\text{A} = 0.12 \text{ mAh/day}\] \[\text{Total daily} = 0.92 \text{ mAh/day} \Rightarrow 2{,}400 \text{ mAh battery lasts } 2{,}609 \text{ days} \approx 7.1 \text{ years}\]

OLSR (Link-State) daily energy per node:

  • HELLO transmissions per day: 1 per 5 sec \(\times\) 3,600 sec/hr \(\times\) 24 hr = 17,280
  • Energy per transmission: 20 mA \(\times\) 0.05 sec = 1 mAs

\[\text{Routing energy} = 17{,}280 \times 1 \text{ mAs} = 17{,}280 \text{ mAs} = 4.8 \text{ mAh/day}\] \[\text{Topology computation} = 24 \text{ hrs} \times 12\% \times 15 \text{ mA} = 43.2 \text{ mAh/day}\] \[\text{Total daily} = 48.0 \text{ mAh/day} \Rightarrow 2{,}400 \text{ mAh battery lasts } 50 \text{ days}\]

Link-state uses roughly 52\(\times\) more energy – the difference between years and weeks of battery life. This is why distance-vector dominates battery-powered IoT despite slower convergence.

Link-State (OLSR) Configuration:

Memory per node: 85 KB (full topology database for 100 nodes)
CPU usage: 12% average (Dijkstra computations on topology changes)
Convergence after node failure: 8 seconds
Topology database updates: Every 5 seconds (HELLO messages)
Bandwidth overhead: 3,200 bytes/minute (topology state exchange)
Battery impact: Significant (cannot deep sleep, must process updates)
Expected battery life: 2-4 months (AA batteries)

Decision Matrix for Common IoT Scenarios:

15.7.2 1. Smart Home (20-50 devices, battery-powered sensors)

  • Recommended: Distance-Vector (RPL/Zigbee AODV)
  • Reasoning: Memory-constrained devices ($5 sensors with 32 KB RAM), 2-year battery life requirement, convergence speed acceptable (30-60 sec)
  • Verdict: Link-state overkill for this scale

15.7.3 2. Industrial Factory Floor (100-200 sensors, real-time control)

  • Recommended: Link-State (OLSR) or Hybrid (RPL with fast Trickle)
  • Reasoning: Mains-powered sensors, critical 10-second control loops, cannot tolerate 45-second convergence
  • Trade-off: Accept higher resource usage for faster failover
  • Verdict: Link-state justified when fast convergence outweighs resource constraints

15.7.4 3. Smart Agriculture (500 sensors, battery-powered, 100-acre farm)

  • Recommended: Distance-Vector (RPL)
  • Reasoning: Large scale (link-state doesn’t scale past 150 nodes efficiently), battery constraints, sparse topology (not all nodes connected)
  • Verdict: Only choice at this scale with battery requirements

15.7.5 4. Smart City Streetlights (2,000 nodes, mains-powered, moderate latency)

  • Recommended: Distance-Vector (RPL) with modified Trickle
  • Reasoning: Scale prohibits link-state (topology map for 2,000 nodes = megabytes), mains power helps but bandwidth overhead of link-state too high
  • Optimization: Tune RPL Trickle timer to balance convergence (reduce from 60s to 20s) vs bandwidth
  • Verdict: Distance-vector only practical option at this scale

15.7.6 5. Emergency Response Mesh (30 nodes, mobile, mission-critical)

  • Recommended: Link-State (OLSR) with proactive mode
  • Reasoning: High mobility (topology changes every 30-60 seconds), critical communications, small scale allows link-state overhead, mains power available (vehicle-mounted radios)
  • Verdict: Link-state’s fast convergence (5-10 sec) critical for mobile scenarios

Key Decision Rules:

  1. If battery-powered OR > 150 nodes → Distance-Vector
    • Exception: Hybrid sensors (occasional mains charging) may use link-state
  2. If convergence requirement < 20 seconds → Link-State
    • Exception: Distance-vector with aggressive Trickle tuning can achieve 15-20 second convergence
  3. If memory < 64 KB per device → Distance-Vector
    • Link-state topology database doesn’t fit in constrained devices
  4. If network is highly dynamic (nodes join/leave frequently) → Distance-Vector
    • Link-state floods topology updates on every change (bandwidth killer)
  5. If optimal path selection matters more than convergence speed → Link-State
    • Distance-vector uses Bellman-Ford (local view), link-state uses Dijkstra (global view)

Real-World Hybrid Approach:

Many industrial IoT deployments use tiered routing: - Tier 1 (Sensor layer): Distance-vector RPL (100-500 battery sensors) - Tier 2 (Gateway layer): Link-state OSPF (10-20 mains-powered gateways)

This combines battery efficiency of distance-vector at scale with fast convergence of link-state at critical backbone.

Cost-Benefit Example:

100-node factory automation network comparing RPL vs OLSR over 5 years:

Metric RPL (Distance-Vector) OLSR (Link-State) Difference
Node hardware cost $50 (low-memory MCU) × 100 = $5,000 $120 (high-memory MCU) × 100 = $12,000 +$7,000 for link-state
Battery replacement $8/node × 100 × 1 replacement = $800 $8/node × 100 × 6 replacements = $4,800 +$4,000 for link-state
Network downtime 45 sec convergence × 20 failures/year × 5 years = 75 min 8 sec convergence × 20 failures/year × 5 years = 13 min 62 min saved with link-state
Downtime cost 75 min × $3,000/hour = $3,750 13 min × $3,000/hour = $650 $3,100 saved with link-state

Net Cost Difference: RPL saves $7,000 (hardware) + $4,000 (batteries) = $11,000 over 5 years, but incurs $3,100 more in downtime cost. Total advantage: $7,900 for RPL.

Verdict: For this scenario, distance-vector (RPL) wins on total cost despite slower convergence. Link-state is only justified when downtime cost exceeds roughly $11,000/hour (high-volume production lines where 62 extra minutes of downtime would cost more than $11,000).

Within This Module:

Related Modules:

External Resources:

  • RFC 6550: RPL Protocol Specification
  • RFC 6551: RPL Objective Functions
  • IETF ROLL Working Group: Routing Over Low-Power and Lossy Networks

15.8 What’s Next

If you want to… Read this
Practice routing concepts in hands-on labs Routing Labs and Quiz
Deep dive into RPL for IoT environments RPL Overview
Study advanced routing topics Routing Review: Advanced Topics
Explore 6LoWPAN and RPL integration 6LoWPAN Routing with RPL