%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%
graph LR
subgraph QUESTION["What does each layer answer?"]
Q1["WHAT to send?"]
Q2["HOW reliably?"]
Q3["WHERE to send?"]
Q4["HOW to transmit?"]
end
subgraph LAYER["Layer"]
L1["Application"]
L2["Transport"]
L3["Network"]
L4["Link + Physical"]
end
subgraph EXAMPLE["IoT Example"]
E1["Temperature = 23.5C<br/>MQTT topic: /sensors/temp"]
E2["TCP: Guarantee delivery<br/>UDP: Best effort (faster)"]
E3["IPv6: 2001:db8::1<br/>Route via gateway"]
E4["Wi-Fi frame<br/>2.4 GHz radio signal"]
end
Q1 --> L1 --> E1
Q2 --> L2 --> E2
Q3 --> L3 --> E3
Q4 --> L4 --> E4
style Q1 fill:#E67E22,stroke:#2C3E50,color:#fff
style Q2 fill:#16A085,stroke:#2C3E50,color:#fff
style Q3 fill:#16A085,stroke:#2C3E50,color:#fff
style Q4 fill:#2C3E50,stroke:#16A085,color:#fff
style L1 fill:#E67E22,stroke:#2C3E50,color:#fff
style L2 fill:#16A085,stroke:#2C3E50,color:#fff
style L3 fill:#16A085,stroke:#2C3E50,color:#fff
style L4 fill:#2C3E50,stroke:#16A085,color:#fff
654 Layered Models: OSI and TCP/IP Comparison
654.1 Learning Objectives
By the end of this chapter, you will be able to:
- Compare OSI and TCP/IP: Understand the relationship between theoretical and practical models
- Map layer functions: Explain what each layer answers (WHAT, HOW reliably, WHERE, HOW to transmit)
- Identify key concepts: Recognize encapsulation, addressing, and protocol stacking principles
- Apply IoT context: Connect traditional models to IoT-specific reference architectures
654.2 Prerequisites
Required Chapters:
- Layered Models Fundamentals - OSI and TCP/IP details
- Encapsulation and PDUs - Header addition/removal
- IoT Reference Models - IoT-specific frameworks
Estimated Time: 10 minutes
Why two models?
The OSI model (7 layers) was developed as a theoretical reference by ISO in the 1980s. The TCP/IP model (4 layers) evolved from actual internet implementation. Both describe the same networking concepts but at different abstraction levels.
Key insight: TCP/IP is what runs the internet; OSI is how we teach and troubleshoot networking concepts.
When to use each:
| Situation | Use |
|---|---|
| Learning networking | OSI (more detailed) |
| Troubleshooting | OSI (layer-by-layer isolation) |
| Protocol documentation | Often TCP/IP |
| IoT development | Both (understand mapping) |
654.3 Model Comparison
The relationship between OSI and TCP/IP models is fundamental to understanding modern networking.
OSI (7-layer) vs TCP/IP (4-layer) vs IoT protocol stack comparison.
654.3.1 Layer Mapping Table
| Layer | OSI | TCP/IP | IoT Protocols |
|---|---|---|---|
| 7 | Application | Application | MQTT, CoAP |
| 6 | Presentation | - | JSON, CBOR |
| 5 | Session | - | - |
| 4 | Transport | Transport | UDP, TCP |
| 3 | Network | Internet | IPv6, 6LoWPAN |
| 2 | Data Link | Link | 802.15.4, BLE |
| 1 | Physical | Link | Radio |
654.4 Key Concepts
Understanding these fundamental concepts is essential for mastering network architectures:
- Networking Standards: Agreed-upon protocols enabling interoperability between different manufacturers and systems globally
- OSI Model (7 layers): Theoretical framework (Physical, Data Link, Network, Transport, Session, Presentation, Application)
- TCP/IP Model (4 layers): Practical internet model (Link, Internet, Transport, Application); simplified and widely deployed
- Layering Principle: Dividing complex systems into functional layers enables modularity and independent development
- Encapsulation: Each layer adds its own header information to data from upper layers; essential for routing and switching
- Decapsulation: Removal of headers at each layer as data moves up the stack at destination
- MAC Addresses (Layer 2): 48-bit hardware identifiers (AA:BB:CC:DD:EE:FF) for local network delivery
- IP Addresses (Layer 3): 32-bit (IPv4) or 128-bit (IPv6) identifiers enabling logical routing across networks
- Subnet Masks: Determine network and host portions of IPv4 addresses; essential for routing decisions
- IPv6: 128-bit addressing (3.4x10^38 addresses) solving IPv4 exhaustion; critical for IoT’s billions of devices
- ARP (Address Resolution Protocol): Maps IP addresses to MAC addresses for local frame forwarding
- IoT Reference Models: Specialized frameworks addressing IoT challenges (edge processing, massive scale, resource constraints)
- Standards Organizations: IEEE, IETF, ISO, ITU, W3C set global protocols ensuring interoperability
- Protocol Stacking: Multiple protocols work together at different layers (e.g., HTTP over TCP over IP over Wi-Fi)
- Layer Abstraction: Each layer provides services to higher layers without revealing implementation details
654.5 Chapter Summary
Layered network models are the foundation that enables billions of diverse devices to communicate seamlessly. This section explores both theoretical and practical frameworks for understanding how modern networks operate.
654.5.1 Standards and Protocols
We started with networking standards and protocols, recognizing that the “miracle” of global connectivity depends on agreed-upon rules. Major standards organizations (IEEE, IETF, ISO, ITU, W3C) ensure interoperability, enabling competition and innovation while maintaining compatibility.
654.5.2 OSI Model
The OSI model provides a 7-layer theoretical framework developed by ISO in the 1980s to standardize network functions:
- Layer 1 (Physical): Electrical/optical/radio signals
- Layer 2 (Data Link): Hardware addressing (MAC), switching, frame delivery
- Layer 3 (Network): Logical addressing (IP), routing across networks
- Layer 4 (Transport): Reliability (TCP) or speed (UDP)
- Layer 5 (Session): Connection management
- Layer 6 (Presentation): Data formatting, encryption
- Layer 7 (Application): User-facing protocols (HTTP, MQTT, CoAP)
654.5.3 TCP/IP Model
The TCP/IP model provides a 4-layer practical framework that actually runs the internet:
- Link Layer: Combines OSI layers 1-2 (physical and data link)
- Internet Layer: IP routing (OSI layer 3)
- Transport Layer: TCP/UDP (OSI layer 4)
- Application Layer: HTTP, MQTT, CoAP (OSI layers 5-7)
654.5.4 Encapsulation
Encapsulation is central to layered models. As data moves down the stack, each layer adds its own header, creating a nested structure. Headers at Layer 4 (TCP header) contain transport-level information, Layer 3 (IP header) contains routing information, and Layer 2 (Ethernet header) contains hardware addressing. This elegant design enables each layer to function independently while supporting the full stack.
Data encapsulation and decapsulation process through network layers.
654.5.5 Addressing
MAC addressing at Layer 2 handles local network delivery. The 48-bit address (e.g., DC:A6:32:AB:CD:EF) consists of a 24-bit OUI (Organizationally Unique Identifier, identifying manufacturer) and 24-bit NIC (Network Interface Card specific). MAC addresses are only meaningful on the local network segment.
IP addressing at Layer 3 enables routing across networks. IPv4 uses 32-bit addresses (e.g., 192.168.1.100) but only provides 4.3 billion addresses - exhausted by 2011. IPv6 uses 128-bit addresses providing 340 undecillion addresses, essential for IoT’s billions of devices. Subnet masks partition IP addresses into network and host portions, determining routing decisions.
IPv6 advantages for IoT:
- Unlimited address space (no NAT needed)
- Built-in security (IPsec mandatory)
- Auto-configuration (SLAAC)
- Header compression with 6LoWPAN for constrained devices
ARP (Address Resolution Protocol) maps between IP and MAC addresses. When a host needs to send locally, it uses ARP to ask “who has IP 192.168.1.20?” and learns the corresponding MAC address. This enables Layer 2 switching based on Layer 3 routing decisions.
654.5.6 IoT Reference Models
IoT reference models address unique challenges:
- Cisco IoT 7-level model: Device, Gateway, Network, Management, Application, Business, Security
- ITU IoT model: Standardized architecture for IoT systems
- IEEE 2413: Standard architectural framework for IoT
These models recognize that IoT systems require edge processing, massive scale support, resource-constrained devices, and security from device to cloud.
IoT protocol stack mapping showing how common IoT protocols fit into OSI layers.
654.6 Summary
This chapter solidified understanding of layered network models and their practical application to IoT systems:
- OSI (7-layer) and TCP/IP (4-layer) models provide theoretical and practical frameworks for organizing network protocols, with TCP/IP combining OSI layers 5-7 into Application and layers 1-2 into Network Access
- Encapsulation proceeds top-down during transmission (Application to Transport to Network to Data Link to Physical) with each layer adding headers; decapsulation reverses this at the receiver
- MAC vs IP addressing: Layer 2 MAC addresses (48-bit hardware identifiers) enable local delivery, while Layer 3 IP addresses (32/128-bit logical) enable global routing across networks
- ARP resolves IP to MAC using broadcast requests (“who has IP?”) and unicast replies, caching mappings to minimize network overhead for local frame forwarding
- IPv6 addressing (128-bit) provides 340 undecillion addresses solving IPv4 exhaustion, with /64 standard for LANs and compression notation (::) reducing repetitive zeros
- IoT reference models extend traditional networking beyond OSI/TCP-IP with layers for edge computing, data accumulation, analytics, and business processes addressing IoT-specific needs
654.7 What’s Next
Continue to the knowledge check section to test your understanding with interactive questions covering layer mapping, addressing, and protocol troubleshooting:
- Layered Models: Knowledge Checks - Test your understanding with MCQs
Or explore related topics:
- Routing Fundamentals - How routers use Layer 3 information
- Transport Protocols - TCP vs UDP at Layer 4
- Application Protocols - MQTT, CoAP at Layer 7