Skip to content
BoKSA

Computer Networks

Computer Networks

Introduction

Connected embedded devices — gateways, IP cameras, robot controllers — rely on computer networks to reach cloud services, peers, and operators. The OSI model structures protocols in layers; Ethernet and Wi-Fi dominate the link layer; TCP/IP carries most application traffic. VLANs segment traffic in industrial plants.

This article gives practical networking theory for firmware and embedded Linux developers.


OSI model (7 layers)

Layer Name Examples You encounter as
7 Application HTTP, MQTT, DNS Your API calls
6 Presentation TLS, JSON encoding mbedtls, certificates
5 Session Sockets (conceptual) connect() lifecycle
4 Transport TCP, UDP Port numbers, reliability
3 Network IP, ICMP 192.168.1.10, routing
2 Data link Ethernet, Wi-Fi MAC MAC address, VLAN tag
1 Physical Cables, radio RJ45, fiber, antenna

TCP/IP model collapses to 4 layers — equally valid mental model.

flowchart TB APP[Application - HTTP/MQTT] TRANS[Transport - TCP/UDP] NET[Network - IP] LINK[Link - Ethernet/Wi-Fi] PHY[Physical] APP --> TRANS --> NET --> LINK --> PHY

Encapsulation

Each layer wraps payload with a header (sometimes trailer):

1
[Ethernet hdr][IP hdr][TCP hdr][HTTP data][FCS]

Decapsulation at receiver peels layers upward. Wireshark is the best teacher — capture and expand each header on your laptop or Pi.


Ethernet (IEEE 802.3)

Field Size Role
Dest MAC 6 B Who receives
Src MAC 6 B Who sent
EtherType / VLAN 2–4 B Protocol ID or 802.1Q tag
Payload 46–1500 B Higher-layer PDU
FCS 4 B Frame check sequence

MAC address — 48-bit hardware ID (OUI + vendor). Switch forwards by MAC; router by IP.

VLAN (802.1Q)

Virtual LAN tags frames with VLAN ID — separate broadcast domains on one physical switch.

Benefit Example
Security Camera VLAN isolated from office
QoS Prioritize control traffic
Management Engineering laptops on maintenance VLAN

Embedded device may need VLAN-aware switch config if plant network requires tagged frames.


IP addressing

IPv4 — 32-bit address, dotted decimal (10.0.0.5).
Subnet mask — which bits are network vs host (255.255.255.0 = /24).
Gateway — router to other subnets.
DNS — name → address resolution.

IPv6 — 128-bit, growing on carrier and enterprise networks; know link-local fe80::.

DHCP — dynamic address assignment; static IP common for fixed industrial devices.


TCP vs UDP

TCP UDP
Connection Connection-oriented Connectionless
Reliability Retransmit, ordering Best effort
Overhead Higher Lower
Use HTTP, MQTT over TCP, SSH DNS, DHCP, video streaming, CoAP

Embedded MQTT: publish sensor data over TCP 1883/8883 (TLS). UDP for time-sensitive telemetry where loss acceptable.


Application protocols (embedded-relevant)

Protocol Purpose
HTTP/HTTPS REST APIs, OTA
MQTT Lightweight pub/sub for IoT
CoAP UDP REST for constrained devices
DNS Hostname resolution
NTP Time sync — critical for logs and TLS
SNMP Network management (gateways)

Wireless

Technology Notes
Wi-Fi (802.11) High bandwidth; power hungry; WPA2/WPA3 security
Bluetooth LE Short range, low power peripherals
LoRaWAN Long range, low rate, via gateway
Cellular (LTE/NB-IoT) Wide area, SIM/eSIM

Radio stacks run on network processor or dedicated chip — TCP/IP often terminates in Linux; MCU sends AT commands or uses coprocessor.


Security basics

  • TLS for anything over untrusted networks — validate server cert or pin public key.
  • No default passwords on device web UIs.
  • Firewall on embedded Linux — close unused ports.
  • OTA signed images — see Connectivity architecture.

Relevant topics


Starting points

  1. Capture ping and HTTP with Wireshark — identify Ethernet, IP, ICMP/TCP headers.
  2. Configure static IP on embedded Linux — verify gateway and DNS.
  3. Publish MQTT message from MCU or Pi — subscribe on laptop.
  4. Draw VLAN diagram for a factory cell with PLC, robot, and HMI.

Videos — other ways to learn

TCP/IP introduction

20059 NET1 - Introduction to TCP/IP Communication — how layers fit together before you debug a disconnected ESP32.

For application messaging on top of TCP/IP, continue with MQTT and IoT messaging.


Focus points

  • Layer confusion — "can't connect" may be L2 (ARP), L3 (route), or L7 (TLS cert).
  • MTU — fragmentation hurts low-power links; path MTU discovery or set MSS.
  • Blocking sockets on MCU — use non-blocking + select or async stack (lwIP).
  • Time sync — TLS fails with wrong RTC; use NTP or GNSS.

Key points

  • OSI layers organize protocols from physical medium to applications.
  • Ethernet + VLAN deliver frames on LAN; IP routes between networks.
  • TCP is reliable; UDP is lightweight — choose per use case.
  • Wireshark and addressing fundamentals are essential debug skills for connected embedded systems.