Unit 1: Basics of Networking
1. Fundamental Principles of Data Communications in IoT
At the core of the Internet of Things (IoT) lies the necessity for physical sensors, actuators, edge compute nodes, and cloud backends to exchange information reliably, efficiently, and securely over heterogeneous communication channels. Data communication is the exchange of data between two nodes via some form of transmission medium.
1.1 Core Components of a Data Communication System
Every telecommunication system decomposes into five architectural entities:
- Message: The information or payload to be transmitted (sensor telemetry, command packets, control signals, audio/video streams).
- Sender (Transmitter): The device that originates and encodes the message (e.g., an ESP32 microcontroller with temperature sensor).
- Receiver: The device that accepts and decodes the message (e.g., an MQTT broker, cloud server, or actuator).
- Transmission Medium: The physical path over which the electrical, optical, or electromagnetic signal travels.
- Protocol: A formal set of governing rules, formats, and semantic conventions that define how data is represented, synchronized, and error-checked.
CODE+-----------+ Encoded Signal +-----------+ | Sender | ===========================> | Receiver | +-----------+ Transmission Medium +-----------+ ^ ^ |=========== Protocols & Standards ========|
1.2 Data Transmission Modes
Data transmission across physical links follows three directional paradigms:
CODESimplex: [Sender] ------------------------> [Receiver] (Unidirectional only) Half-Duplex: [Node A] <-----------------------> [Node B] (Both directions, but ONE at a time) Full-Duplex: [Node A] <=======================> [Node B] (Simultaneous bidirectional transmission)
- Simplex Mode: Unidirectional communication. Only one device transmits, and the other can only receive (e.g., passive RFID tags emitting their serial number to an RFID reader; GPS satellites broadcasting orbital almanac data).
- Half-Duplex Mode: Bidirectional communication, but nodes cannot transmit simultaneously. When one device transmits, the other must listen (e.g., traditional walkie-talkies, RS-485 bus systems in industrial SCADA networks).
- Full-Duplex Mode: Simultaneous bidirectional communication. Both endpoints can transmit and receive data concurrently through separate frequency bands (Frequency Division Duplexing - FDD) or micro-timesliced channels (e.g., full-duplex Ethernet, cellular 4G/5G, point-to-point serial SPI buses).
2. Transmission Media: Guided vs. Unguided
Physical layer signals traverse either bounded physical conductors (guided) or wireless electromagnetic radiation through free space (unguided).
| Media Category | Type | Physical Mechanism | Bandwidth / Range | Typical IoT Deployment |
|---|---|---|---|---|
| Guided | Unshielded Twisted Pair (UTP) | Copper wire pairs twisted together to cancel electromagnetic interference (EMI) | Up to , limit | Wired smart building automation (Ethernet Cat5e/Cat6) |
| Guided | Coaxial Cable | Central copper core, insulating dielectric, metallic shield, outer jacket | Moderate bandwidth, high noise immunity | CCTV security feeds, broadband cable modems |
| Guided | Optical Fiber | Total Internal Reflection of light pulses through silica glass or plastic core | , tens of kilometers | Smart city metropolitan backhauls, data center interconnects |
| Unguided | Radio Frequency (RF) | Omnidirectional electromagnetic waves () | Variable, penetrates walls | Sub-GHz LoRaWAN, Zigbee (868/915 MHz), Sigfox |
| Unguided | Microwaves | Line-of-sight directional electromagnetic radiation () | High data rates, atmospheric attenuation | Wi-Fi (), Bluetooth LE, 5G mmWave |
| Unguided | Infrared (IR) | Line-of-sight optical radiation (); cannot penetrate walls | High security, short range () | Consumer electronics remotes, short-range indoor telemetry |
2.1 Physics of Guided Twisted-Pair Cancellation
In twisted pair cabling, twisting the two wires carrying differential signals balances capacitive and inductive coupling with external noise sources:
Because noise couples equally into both adjacent twists, common-mode noise rejection at the receiver cancels out the interference:
3. Network Topologies and Their IoT Implications
Topology defines the geometric and logical arrangement of nodes and interconnecting links in a communication network.
CODE[Star] [Mesh] [Bus] (H) (A)---(B) ---[A]---[B]---[C]--- / | \ / \ / \ (Terminator) (A) (B) (C) (C)-(D)-(E)
3.1 Star Topology
- Structure: All peripheral client nodes connect directly to a single central hub, switch, or access point.
- Advantages: Simple installation, easy fault isolation; failure of one peripheral cable node does not affect others.
- Disadvantages: Central hub represents a Single Point of Failure (SPOF); cabling scale-out overhead.
- IoT Application: LoRaWAN (star-of-stars topology connecting thousands of end-devices directly to gateway base stations) and Wi-Fi smart home devices connecting to an access point.
3.2 Mesh Topology (Full vs. Partial Mesh)
- Structure:
- Full Mesh: Every node has a direct, dedicated physical point-to-point link to every other node. For nodes, total physical links required:
- Partial Mesh: Nodes are interconnected redundantly; most nodes connect to multiple neighbors, with data routed multi-hop.
- Full Mesh: Every node has a direct, dedicated physical point-to-point link to every other node. For nodes, total physical links required:
- Advantages: Extreme fault tolerance and self-healing; if a link or node drops, packets are dynamically rerouted.
- Disadvantages: High routing protocol overhead and complex firmware state management.
- IoT Application: Zigbee PRO and Thread networks in commercial smart lighting and building climate automation.
3.3 Bus Topology
- Structure: All nodes share a common linear central backbone transmission cable terminated at both ends with impedance-matching resistors.
- Advantages: Low cabling cost, simple deployment for linear architectures.
- Disadvantages: Cable break disables entire bus; collisions occur under heavy traffic (CSMA/CD required).
- IoT Application: Controller Area Network (CAN bus) in automotive IoT; Modbus RTU (over RS-485) in industrial telemetry.
3.4 Ring & Tree Topologies
- Ring Topology: Nodes are connected in a closed physical loop; tokens pass unidirectionally. If a single link breaks, the ring fails unless dual counter-rotating rings (e.g., FDDI) are used.
- Tree (Hierarchical) Topology: A central root node branches out into secondary child nodes. Widely used in IP subnets and industrial hierarchical control networks (Purdue Enterprise Reference Architecture).
4. Network Geographies: From WPAN to WAN
CODE[ BAN / Body Area ] --> Range: < 1 meter (Wearables, Medical telemetry) v [ WPAN / Personal ] --> Range: 1 - 10 meters (Bluetooth, Zigbee, NFC) v [ LAN / Local Area] --> Range: 10 - 100 meters (Wi-Fi, Ethernet) v [ MAN / Metro Area] --> Range: 1 - 50 km (Smart Grid WiMAX, City-wide fiber) v [ WAN / Wide Area ] --> Range: Global (Cellular NB-IoT, Satellite, Internet)
- Wireless Personal Area Networks (WPAN - IEEE 802.15): Optimized for ultra-low power, constrained microcontrollers, operating over ranges from to meters. Standardized under IEEE 802.15.4 (basis for 6LoWPAN, Thread, Zigbee) and IEEE 802.15.1 (Bluetooth LE).
- Local Area Networks (LAN): Confined to a single room, building, or campus. Operates at gigabit data rates using IEEE 802.3 (Ethernet) and IEEE 802.11 (Wi-Fi).
- Wide Area Networks (WAN / LPWAN): Spans cities, nations, and continents. In IoT, Low-Power Wide-Area Networks (LPWAN) like LoRaWAN, Sigfox, and 3GPP Cellular NB-IoT / LTE-M enable battery-operated sensors to transmit small packets across distances with year battery lifetimes.
5. Architectural Reference Models: OSI 7-Layer vs. TCP/IP Stack
To enable interoperability between equipment from competing vendors, network protocols are organized into layered abstraction stacks.
CODE+-------------------------------------------------------------------+ | OSI 7-Layer Reference Model | TCP/IP Protocol Suite | +-------------------------------------+-----------------------------+ | 7. Application (HTTP, CoAP, MQTT) | | | 6. Presentation (TLS, ASN.1, JSON) | Application Layer | | 5. Session (RPC, Sockets) | | +-------------------------------------+-----------------------------+ | 4. Transport (TCP, UDP) | Transport Layer | +-------------------------------------+-----------------------------+ | 3. Network (IPv4, IPv6, 6LoWPAN)| Internet (Network) Layer| +-------------------------------------+-----------------------------+ | 2. Data Link (802.3 MAC, 802.15.4)| Network Interface Layer | | 1. Physical (PHY, Modulation) | (Link / Physical) | +-------------------------------------------------------------------+
5.1 The OSI 7-Layer Model: Functions & PDUs
At each layer, data is encapsulated into a Protocol Data Unit (PDU):
- Layer 1: Physical Layer (PDU: Bit)
- Responsible for transmitting raw unstructured bit streams over physical media.
- Defines mechanical pinouts, electrical signal voltages, bit timings, optical wavelengths, and wireless carrier modulation (FSK, QPSK, DSSS).
- Layer 2: Data Link Layer (PDU: Frame)
- Provides node-to-node data transfer across a shared local link.
- Divided by IEEE into:
- Logical Link Control (LLC): Flow control, multiplexing upper-layer protocols.
- Media Access Control (MAC): Physical device addressing (48-bit MAC) and media contention resolution (CSMA/CD, CSMA/CA, TDMA).
- Error detection via Cyclic Redundancy Checks (CRC-32).
- Layer 3: Network Layer (PDU: Packet)
- Responsible for end-to-end packet delivery, logical addressing (IP addresses), and routing across heterogeneous intermediate networks.
- Protocols: IPv4, IPv6, ICMP, 6LoWPAN, RPL (Routing Protocol for Low-Power and Lossy Networks).
- Layer 4: Transport Layer (PDU: Segment for TCP / Datagram for UDP)
- Provides host-to-host process-level communication, multiplexing multiple client applications via Port Numbers.
- Handles segmentation, reassembly, connection establishment, reliability, flow control, and congestion mitigation.
- Layer 5: Session Layer
- Establishes, manages, and terminates conversational sessions between distributed application processes (e.g., checkpoints, session resumption).
- Layer 6: Presentation Layer
- Translates, formats, encrypts, and compresses application syntax into network-standard wire formats (e.g., JSON, Protocol Buffers, CBOR, TLS encryption).
- Layer 7: Application Layer (PDU: Message)
- The user interface and software interaction layer providing high-level networking services (MQTT, CoAP, HTTP, AMQP, DNS).
5.2 Encapsulation and De-encapsulation
When an IoT sensor transmits data, information moves downward through the stack:
- Application Data Add TCP/UDP header Segment
- Add IP header (Source & Destination IPs) Packet
- Add MAC header & Frame Check Sequence trailer Frame
- Convert to bits Transmit physical waveform across copper, fiber, or air.
At the receiver, the reverse de-encapsulation process strips headers layer by layer until raw application data reaches the destination process.
6. Addressing & Identification in Networks
To deliver data packets without ambiguity, modern networks enforce three distinct tiers of addressing:
CODE[ Application Process ] ---> Port Address (16-bit: e.g., Port 1883 for MQTT) | [ Logical Host Node ] ---> Logical IP Address (32-bit IPv4 / 128-bit IPv6) | [ Physical Interface ] ---> Physical MAC Address (48-bit EUI-48 / 64-bit EUI-64)
6.1 Physical (MAC) Addressing
- A hardware-burned Media Access Control identifier assigned to Network Interface Cards (NICs).
- EUI-48 Format: 48 bits (6 bytes), displayed as six hexadecimal pairs separated by colons or hyphens:
B8:27:EB:4A:12:34- First 24 bits: Organizationally Unique Identifier (OUI) assigned by IEEE to the manufacturer (e.g., Raspberry Pi Foundation).
- Last 24 bits: Unique Network Interface Serial Number assigned by the vendor.
- EUI-64 in IoT: IEEE 802.15.4 wireless radios use 64-bit extended unique identifiers to address trillions of constrained sensor motes without collision.
6.2 Logical (IP) Addressing: IPv4 vs. IPv6
Logical IP addresses identify host interfaces at the network layer and enable global routing across autonomous systems.
| Attribute | IPv4 | IPv6 |
|---|---|---|
| Address Length | () | () |
| Address Space | addresses | addresses |
| Notation | Dotted decimal: 192.168.1.1 | Hexadecimal groups: 2001:0db8:85a3::8a2e:0370:7334 |
| Header Size | (variable with options) | (fixed base header) |
| Configuration | Manual static assignment or DHCP | DHCPv6 or Stateless Address Autoconfiguration (SLAAC) |
| Packet Fragmentation | Done by routers and sending hosts | Performed only by the sending host (PMTU Discovery) |
| Security | IPsec is optional | IPsec support is architecturally mandatory |
| IoT Suitability | Severe address exhaustion requires NAT | Every sensor on earth can have a globally unique public IP |
IPv4 Subnetting & CIDR
An IPv4 address consists of a Network ID and a Host ID determined by a Subnet Mask:
- In Classless Inter-Domain Routing (CIDR), written as
/prefix: e.g.,192.168.1.0/24. - Netmask:
255.255.255.0( ones, zeros). - Available host addresses: (subtracting network address
192.168.1.0and broadcast address192.168.1.255).
6.3 Port Addressing
Transport layer ports are 16-bit unsigned integers ():
- Well-Known Ports (): Reserved for system and core services:
- Port 80: HTTP
- Port 443: HTTPS
- Port 53: DNS
- Port 123: NTP (Network Time Protocol)
- Registered Ports (): Designated for specialized applications:
- Port 1883: MQTT (Unencrypted)
- Port 8883: MQTT over TLS (Secure)
- Port 5683: CoAP (Constrained Application Protocol)
- Port 5684: CoAP over DTLS
- Dynamic / Ephemeral Ports (): Temporarily allocated by the operating system for client-side outgoing connections.
7. Transport Layer Dynamics in IoT Context: TCP vs. UDP
The transport layer dictates the delivery guarantees, latency characteristics, and transmission overhead of IoT telemetry.
CODETCP Segment Header (20 Bytes minimum) 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port | Destination Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Acknowledgment Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Offset| Res |U|A|P|R|S|F| Window Size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | Urgent Pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ UDP Datagram Header (8 Bytes fixed) 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port | Destination Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
7.1 Transmission Control Protocol (TCP)
TCP provides a connection-oriented, reliable, ordered, byte-stream delivery service:
- Three-Way Handshake Connection Establishment:
- Client Server:
SYN(Sequence number ) - Server Client:
SYN-ACK(Sequence number , Acknowledgment ) - Client Server:
ACK(Acknowledgment )
- Client Server:
- Reliability Mechanisms:
- Sequence Numbers track every byte transmitted.
- Acknowledgments (ACKs) confirm reception. Missing ACKs trigger Automatic Repeat reQuest (ARQ) retransmissions after a calculated Retransmission Timeout (RTO).
- Flow & Congestion Control:
- Flow Control: Receiver advertises a Receive Window () to prevent sender buffer overrun.
- Congestion Control: Sender maintains a Congestion Window (), adapting transmission rates via Slow Start, Congestion Avoidance, Fast Retransmit, and Fast Recovery.
- Drawbacks in Constrained IoT:
- High connection setup latency ( round trips before first data byte).
- header overhead per packet.
- Head-of-Line (HoL) Blocking: If packet drops over a lossy wireless link, all subsequent packets () must wait in the buffer until is retransmitted, introducing severe latency spikes for time-critical sensor alarms.
7.2 User Datagram Protocol (UDP)
UDP provides an unreliable, connectionless, lightweight datagram service:
- Zero Connection Setup: Transmits immediately without handshakes.
- Minimal Header: Only fixed header overhead ( smaller than TCP).
- No Retransmissions or State Tracking: Packets may arrive out of order, duplicated, or dropped.
- IoT Application: Perfect for constrained microcontrollers emitting periodic telemetry (where losing 1 temperature reading is acceptable), DNS queries, voice/video streaming, and lightweight protocols like CoAP (Constrained Application Protocol), which implements custom, optional reliability at the application layer.
8. Switching & Routing Fundamentals
How data moves across intermediate nodes between source and destination depends on switching mechanisms and routing algorithms.
8.1 Circuit Switching vs. Packet Switching
- Circuit Switching: A dedicated physical communications path is reserved across intermediate switches for the entire duration of the connection (e.g., traditional PSTN landline telephony).
- Advantage: Guaranteed bandwidth, zero jitter, constant latency.
- Disadvantage: Highly inefficient resource utilization; reserved bandwidth remains idle during conversational pauses.
- Packet Switching: Messages are broken into independent chunks called packets. Packets traverse the network dynamically sharing transmission lines on demand via Statistical Time Division Multiplexing.
- Datagram Approach (Connectionless): Every packet contains full source and destination IP headers and may take different routes across the internet, arriving out of order (standard IP routing).
- Virtual Circuit Approach (Connection-Oriented): A pre-planned logical path is established prior to data transfer; packets follow identical paths and arrive in order (e.g., MPLS, ATM).
8.2 Routing Protocols
Routers maintain Routing Tables to determine the optimal next-hop interface for an incoming IP packet based on its destination IP:
- Distance-Vector Routing (e.g., RIP - Routing Information Protocol):
- Based on the Bellman-Ford Algorithm.
- Routers periodically share their entire routing table with immediate direct neighbors.
- Metric: Hop count (maximum hops in RIP).
- Drawback: Slow convergence, susceptible to the Count-to-Infinity problem (mitigated via Split Horizon and Poison Reverse).
- Link-State Routing (e.g., OSPF - Open Shortest Path First):
- Based on Dijkstra's Shortest Path First (SPF) Algorithm.
- Routers flood Link State Advertisements (LSAs) containing the status and cost of their local links to all routers in the area.
- Every router constructs an identical global topological map of the network and computes optimal shortest paths independently.
- Metric: Cost based on link bandwidth.
- Advantage: Extremely fast convergence, loop-free, scales to enterprise backbones.
8.3 ARP and ICMP
- ARP (Address Resolution Protocol - RFC 826):
Resolves an unknown Layer 2 physical MAC address corresponding to a known Layer 3 logical IP address on the local network segment.- Sender broadcasts an ARP Request: "Who has IP 192.168.1.50? Tell MAC B8:27:EB:11:22:33".
- Target host unicasts an ARP Reply: "192.168.1.50 is at 00:1A:2B:3C:4D:5E".
- Sender caches the mapping in an internal ARP table.
- ICMP (Internet Control Message Protocol - RFC 792):
Provides network layer error reporting and diagnostic operational information (e.g.,pinguses ICMP Echo Request/Reply;tracerouteleverages ICMP Time Exceeded messages when TTL hits zero).
9. Network Hardware Devices in IoT Architectures
Interconnecting constrained sensor nodes with enterprise IP networks requires specialized hardware devices operating across different layers:
CODE[ IoT Sensor Mote ] (Zigbee / BLE / LoRa) | [ Edge IoT Gateway ] (Protocol Translation: BLE/Zigbee -> IP / TLS) | [ Switch ] (Layer 2: Forwards frames via MAC address table) | [ Router ] (Layer 3: Routes packets via IP routing table, NAT) | [ Cloud / Data Center ]
9.1 Layer 1 Devices (Physical)
- Repeater: Amplifies and regenerates attenuated electrical or optical signals over long cable runs to extend physical distance. Does not filter or inspect traffic.
- Passive Hub: Multiport repeater that broadcasts every incoming bit on one port out to all other connected ports, creating a single shared collision domain and security vulnerabilities. (Largely obsolete).
9.2 Layer 2 Devices (Data Link)
- Bridge: Connects two separate physical network segments, inspecting MAC addresses to filter or forward frames, breaking up collision domains.
- Switch: Multiport bridge that maintains an internal CAM (Content Addressable Memory) MAC Address Table:
- Dynamically learns which device MAC address is connected to each physical port by inspecting the Source MAC address of incoming frames.
- Forwards frames strictly to the designated destination port via hardware ASICs, establishing independent collision domains for every port.
- Supports Virtual LANs (VLANs - IEEE 802.1Q) to logically isolate IoT sensor traffic from enterprise office workstations.
9.3 Layer 3 Devices (Network)
- Router: Connects different logical IP subnets and autonomous systems. Inspects Destination IP addresses to route packets across wide-area networks, managing NAT (Network Address Translation), DHCP, and firewall filtering rules.
9.4 IoT Edge Gateways
The linchpin of modern IoT networks. Constrained sensor motes often speak non-IP protocols (BLE, Zigbee, Modbus RTU, CAN, LoRa).
An IoT Edge Gateway operates across Layers 1 through 7:
- Hardware Transceivers: Houses multiple radios (e.g. 802.15.4, Sub-GHz LoRa, Wi-Fi, Ethernet).
- Protocol Translation: Ingests local sensor frames, parses Modbus registers or Zigbee clusters, and translates them into IP-based application protocols (e.g., formatting raw payload into JSON and publishing over MQTT/TLS).
- Edge Processing & Filtering: Filters noise, aggregates telemetry, and enforces local automation routines even if cloud WAN connectivity drops.
10. Summary: The Networking Foundation for IoT Protocols
Understanding transmission modes, physical media characteristics, network topologies, the OSI and TCP/IP reference stacks, and addressing schemas is essential before studying IoT-specific protocols.
In the subsequent units, we will build directly upon this foundation:
- Unit 2 explores IoT architectural standards, edge computing, and device constraints.
- Unit 3 investigates hardware design requirements, battery budgets, and sleep modes.
- Unit 4 & 5 detail how lightweight application protocols (MQTT, CoAP) solve the TCP/UDP and network constraints discussed in this unit.