%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#E67E22', 'secondaryColor': '#16A085', 'tertiaryColor': '#E8F6F3', 'clusterBkg': '#E8F6F3', 'clusterBorder': '#16A085', 'fontSize': '13px'}}}%%
graph TB
App["Application Layer<br/><small>Your IoT app decides WHAT to send</small><br/>(e.g., 'Temperature: 23.5C')"]
Trans["Transport Layer<br/><small>HOW to deliver reliably?</small><br/>(TCP: confirm delivery, UDP: just send)"]
Net["Network Layer<br/><small>WHERE to send it?</small><br/>(IP address: 192.168.1.100)"]
Link["Data Link Layer<br/><small>WHO on local network?</small><br/>(MAC address: AA:BB:CC:DD:EE:FF)"]
Phys["Physical Layer<br/><small>Physical transmission medium</small><br/>(Wi-Fi radio, Ethernet cable, LoRa)"]
App -->|Passes data| Trans
Trans -->|Adds port numbers| Net
Net -->|Adds IP addresses| Link
Link -->|Adds MAC addresses| Phys
Phys -->|Transmits bits| Link
style App fill:#2C3E50,stroke:#16A085,color:#fff
style Trans fill:#16A085,stroke:#2C3E50,color:#fff
style Net fill:#E67E22,stroke:#2C3E50,color:#fff
style Link fill:#2C3E50,stroke:#16A085,color:#fff
style Phys fill:#16A085,stroke:#2C3E50,color:#fff
621 Networking Basics: Introduction and Core Concepts
621.1 Learning Objectives
By the end of this chapter, you will be able to:
- Understand Network Fundamentals: Explain core networking concepts for IoT
- Master the OSI Model: Describe the 7-layer model and its IoT applications
- Explain TCP/IP Stack: Understand protocols at each layer
- Understand Addressing: Work with IP addresses, MAC addresses, and ports
621.2 Prerequisites
Before diving into this chapter, you should be familiar with:
- Layered Network Models: Understanding the OSI and TCP/IP models provides the theoretical framework that organizes networking concepts into comprehensible layers, which is essential context for this practical introduction to networking
- Basic computer science concepts: Familiarity with binary numbers, data representation, and basic programming concepts will help you understand protocol operations and addressing schemes
- General IoT concepts: Basic understanding of what IoT devices are and how they communicate at a high level will help you appreciate why specific networking approaches are used
Meet the Sensor Squad!
Temperature Terry, Light Lucy, Motion Marley, Pressure Pete, and their best friend Signal Sam are a team of tiny sensors living in a smart house. But they have a problem - how do they send their important messages to the Big Computer in the cloud?
Simple Story:
One day, Temperature Terry measured that the kitchen was getting too hot! “I need to tell someone before the cookies burn!” Terry said. But Terry couldn’t just shout - computers don’t have ears! Instead, Terry wrote a tiny digital letter with his message: “Kitchen is 150 degrees - TOO HOT!”
But wait - how does the letter know where to go? That’s where addresses come in! Just like your house has a street address so the mail carrier knows where to deliver letters, every device has a special number called an IP address. Terry’s address might be “192.168.1.25” - kind of like “25 Sensor Street, Kitchen District!”
Signal Sam helped Terry send the letter through the house’s Wi-Fi network. The letter hopped from Terry to the Wi-Fi router (like a local post office), then zoomed through the internet (like a mail truck on the highway), until it reached the Big Computer in the cloud. The cloud sent back a message to the smart oven: “Turn off!” The cookies were saved!
Fun Facts:
- Every device in your house has its own special address number, just like houses on a street!
- A “router” is like a post office that knows where to send all the letters
- Messages can take different paths to get where they’re going - just like you can walk to school different ways
- The internet has so many devices that we’re running out of old addresses (IPv4) and need longer new ones (IPv6)!
Try This at Home:
Ask a grown-up to help you find your home Wi-Fi router. Count how many devices are connected to it - your tablet, phones, smart TV, maybe even a smart speaker! Each one has its own special address. You can see them by looking at the “connected devices” list in the router’s app. That’s your very own home network!
The Communication Networks part of the book is organised to move from general networking ideas to technology families and then to IoT-specific protocols:
- Start here with Networking Basics for IoT for core concepts (addresses, ports, routing, topologies).
- Continue to Layered Models Fundamentals and Networking Fundamentals for a deeper look at the OSI/TCP-IP stacks.
- Then explore the main wireless families:
- Mobile Wireless Technologies Basics
- Wi-Fi Fundamentals and Standards and Bluetooth Fundamentals and Architecture
- LPWAN Fundamentals, LoRaWAN Overview, and cellular IoT chapters
- RFID Fundamentals and Standards and NFC Fundamentals for short-range identification
- Finally, tie everything together with the protocol-stack view in IoT Protocols: Fundamentals and IoT Application Protocols Overview.
If you ever feel lost in a later networking chapter, you can return to this page to refresh the big picture before diving back into the details.
Foundation Topics:
- Networking Fundamentals - Core concepts deep dive
- Layered Network Models - OSI and TCP/IP models
- IoT Protocols Overview - Protocol landscape
Protocol Deep Dives:
- MQTT Fundamentals - Lightweight messaging
- CoAP Fundamentals - Constrained application protocol
- LoRaWAN Overview - Long-range wireless
Learning Hubs:
- Quiz Navigator - Test your networking knowledge
- Simulation Playground - MQTT, Wi-Fi, and protocol tools
- Knowledge Gaps Tracker - Identify weak areas
621.3 Getting Started (For Beginners)
Analogy: Networking is like a postal system for digital messages. Just like mail needs an address, a route, and a delivery method, digital data needs IP addresses, routing, and protocols to get from your sensor to the cloud.
In everyday terms:
- IP Address = Your house address (where to deliver data)
- Router = Post office (decides which way to send your data)
- Protocol = The rules for how to package and send your letter
- Port = Like an apartment number (which app gets the data)
621.3.1 The “Layers” Concept (Why It Matters)
Think of sending a package - Each layer has ONE job and doesn’t worry about others:
This variant shows the same protocol layers but visualizes what happens to your data as it travels down and up the stack. Each layer wraps (encapsulates) data with its own header.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#E67E22', 'secondaryColor': '#16A085', 'tertiaryColor': '#E8F6F3', 'fontSize': '12px'}}}%%
sequenceDiagram
participant App as Application<br/>(Your Data)
participant Trans as Transport<br/>(Segment)
participant Net as Network<br/>(Packet)
participant Link as Data Link<br/>(Frame)
participant Phys as Physical<br/>(Bits)
Note over App: Original Data:<br/>"Temperature: 23.5C"
App->>Trans: Data
Note over Trans: Add TCP/UDP Header<br/>[Port 1883][Seq#][Checksum] + Data
Trans->>Net: Segment
Note over Net: Add IP Header<br/>[Src IP][Dst IP][TTL] + Segment
Net->>Link: Packet
Note over Link: Add MAC Header + Trailer<br/>[Src MAC][Dst MAC] + Packet + [FCS]
Link->>Phys: Frame
Note over Phys: Convert to electrical/radio signals<br/>01101001 01101111 01110100...
Note over Phys,App: On receiving device:<br/>Each layer REMOVES its header<br/>and passes data UP the stack
Key Insight: Your 16-byte temperature reading becomes a ~100+ byte transmission after all headers are added. This overhead is why IoT protocols like CoAP minimize header sizes!
621.3.2 IP Addresses: Your Device’s Home Address
IPv4 vs IPv6 Addressing:
| Aspect | IPv4 | IPv6 |
|---|---|---|
| Example | 192.168.1.100 | 2001:0db8:85a3::8a2e:0370:7334 |
| Structure | Network.Subnet.Subnet.Device | Much longer address space |
| Parts | 4 octets (32 bits) | 8 groups of 4 hex digits (128 bits) |
| Address Space | 4.3 billion addresses | 340 undecillion addresses |
| Analogy | Country.City.Street.House | Planet.Country.City.Street.Apt.Room |
| IoT Suitability | Running out (needs NAT) | Enough for every IoT device! |
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#E67E22', 'secondaryColor': '#16A085', 'tertiaryColor': '#E8F6F3', 'clusterBkg': '#E8F6F3', 'clusterBorder': '#16A085', 'fontSize': '14px'}}}%%
graph LR
subgraph IPv4["IPv4 Address: 192.168.1.100"]
O1["192"]
O2["168"]
O3["1"]
O4["100"]
end
subgraph IPv6["IPv6 Address: 2001:0db8:85a3::8a2e:0370:7334"]
H1["2001"]
H2["0db8"]
H3["85a3"]
H4["::<br/>(zeros)"]
H5["8a2e"]
H6["0370"]
H7["7334"]
end
O1 -.->|Network| O2
O2 -.->|Subnet| O3
O3 -.->|Host| O4
H1 -.->|Global| H2
H2 -.->|Subnet| H3
H3 -.->|Compressed| H4
H4 -.->|Interface ID| H5
H5 -.-> H6
H6 -.-> H7
style O1 fill:#2C3E50,stroke:#16A085,color:#fff
style O2 fill:#16A085,stroke:#2C3E50,color:#fff
style O3 fill:#E67E22,stroke:#2C3E50,color:#fff
style O4 fill:#2C3E50,stroke:#16A085,color:#fff
style H1 fill:#2C3E50,stroke:#16A085,color:#fff
style H2 fill:#16A085,stroke:#2C3E50,color:#fff
style H3 fill:#E67E22,stroke:#2C3E50,color:#fff
style H4 fill:#7F8C8D,stroke:#2C3E50,color:#fff
style H5 fill:#2C3E50,stroke:#16A085,color:#fff
style H6 fill:#16A085,stroke:#2C3E50,color:#fff
style H7 fill:#E67E22,stroke:#2C3E50,color:#fff
621.3.3 Common IoT Network Types
| Network Type | Range | Speed | Power | Example Use |
|---|---|---|---|---|
| Wi-Fi | ~50m | Fast (Mbps) | High | Smart TV, cameras |
| Bluetooth | ~10m | Medium | Low | Wearables, speakers |
| Zigbee | ~100m | Slow | Very Low | Smart lights, sensors |
| LoRaWAN | ~15km | Very Slow | Ultra Low | Agriculture, cities |
| Ethernet | ~100m | Very Fast | N/A (wired) | Industrial, servers |
621.3.4 Real-World Example: Smart Thermostat
Your Smart Thermostat Sending Data:
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#E67E22', 'secondaryColor': '#16A085', 'tertiaryColor': '#E8F6F3', 'clusterBkg': '#E8F6F3', 'clusterBorder': '#16A085', 'fontSize': '13px'}}}%%
sequenceDiagram
participant Thermo as Smart Thermostat<br/>192.168.1.50
participant Router as Wi-Fi Router<br/>192.168.1.1
participant ISP as ISP
participant Cloud as Cloud Server<br/>api.smartthermo.com
Note over Thermo: Temperature reads 23.5C
Thermo->>Thermo: App Layer: Create JSON<br/>{"temp": 23.5, "unit": "C"}
Thermo->>Thermo: Transport: Add TCP port 443
Thermo->>Thermo: Network: Add dest IP<br/>(DNS lookup for api.smartthermo.com)
Thermo->>Thermo: Data Link: Add Wi-Fi MAC addresses
Thermo->>Thermo: Physical: Encode to 2.4GHz radio
Thermo->>Router: Wi-Fi transmission (Layer 1-2)
Router->>Router: Read dest IP, consult routing table
Router->>ISP: Forward to ISP (Layer 3 routing)
ISP->>Cloud: Route through internet
Cloud-->>ISP: HTTP 200 OK response
ISP-->>Router: Route back to home network
Router-->>Thermo: Wi-Fi delivery to thermostat
Note over Thermo: Data delivered!<br/>Thermostat updated in app
621.3.5 Quick Self-Check
Before continuing, make sure you understand:
- What is an IP address? - A unique identifier for a device on a network
- Why do we use layers? - Each layer handles one job, making systems modular
- Wi-Fi vs LoRaWAN? - Wi-Fi is fast/short range; LoRaWAN is slow/long range
- What does a router do? - Forwards data between networks based on IP addresses
Enhance your learning with resources across the book’s learning hubs:
Knowledge Map: Explore networking concepts visualization to see how addressing, protocols, and topologies interconnect
Quizzes: Test your understanding with Networking Fundamentals Quiz Bank covering OSI layers, IP addressing, and protocol selection
Simulations: Try hands-on tools in the Simulation Hub:
- Network Topology Visualizer - Compare star, mesh, tree topologies interactively
- Protocol Comparison Tool - Evaluate MQTT vs CoAP vs HTTP overhead
- Power Budget Calculator - Estimate battery life for different protocols
- Wireless Range Estimator - Model LoRaWAN and Wi-Fi coverage
Video Learning: Watch IoT Networking video series for visual explanations of packet routing, NAT, and gateway operations
Knowledge Gaps: Identify common misconceptions in Networking Troubleshooting - discover why “more bandwidth always means better performance” is false for IoT
These integrated resources provide multiple learning pathways - visual, hands-on, and self-assessment - to reinforce the networking fundamentals covered in this chapter.
The Myth: Many beginners assume Wi-Fi is the best choice for all IoT devices because it’s fast, widely available, and familiar from smartphones and laptops.
The Reality: Wi-Fi is often the worst choice for battery-powered IoT sensors due to power consumption.
Quantified Impact:
- Wi-Fi power consumption: 240-360 mA active transmit, 50-100 mA idle (always listening)
- Bluetooth LE: 15-20 mA active, 0.4-3 mA sleep mode
- LoRaWAN: 40-120 mA transmit (brief bursts), <1 uA deep sleep
Real-World Example: A temperature sensor sending readings every 5 minutes:
- With Wi-Fi (constant connection): 2000 mAh battery lasts ~20 days (idle power dominates)
- With Bluetooth LE (sleep between readings): Same battery lasts ~8 months (95% time in sleep)
- With LoRaWAN (deep sleep between transmits): Same battery lasts ~3-5 years (99.9% time asleep)
Why This Matters: Wi-Fi’s “always listening” architecture drains batteries fast. For 10,000 agricultural sensors across 100 acres, choosing Wi-Fi over LoRaWAN means replacing batteries 15x more often - costing $150,000/year extra in maintenance.
When Wi-Fi Makes Sense: Mains-powered devices (cameras, smart speakers), high-bandwidth needs (video), existing Wi-Fi infrastructure, low-latency requirements (<50ms).
The Right Approach: Match protocol to power budget, not familiarity. Battery-powered = Bluetooth LE, Zigbee, or LoRaWAN. Mains-powered = Wi-Fi or Ethernet.
621.4 Why Networking Matters for IoT
621.4.1 Further Reading
For detailed protocol specifications:
- BLE: See Bluetooth Low Energy chapter
- LoRa/LoRaWAN: See LPWAN Technologies chapter
- MQTT, CoAP, HTTP: See Application Protocols chapter
- Cellular IoT: See NB-IoT and LTE-M chapter
- Wi-Fi: See IEEE 802.11 standards documentation
621.5 Videos
621.6 What’s Next
Now that you understand the core networking concepts, continue to learn about:
- Networking Basics: Protocols and MAC - Common IoT protocols by layer and Medium Access Control classification
- Networking Basics: Hands-On Configuration - Network configuration, troubleshooting, and security
- Networking Basics: Labs and Practice - Interactive labs, Python implementations, and knowledge checks
These topics will build on the foundational understanding you’ve gained here about addressing, layers, and network types.