Skip to main content
OSI and TCP/IP Reference Models
Lesson 1 of 11

OSI and TCP/IP Reference Models

Map the OSI 7-layer and TCP/IP 4-layer models, distinguish IPv4/IPv6 addressing, common ports, TCP versus UDP, topologies, and core network devices using practical CLI tools.

Beginner 20 min Networking
Authorised environments only — The techniques described here are used only in training labs and on systems you own or have written permission to test.

Learning objectives

  • Map the 7 layers of the OSI reference model to the 4 layers of the TCP/IP model
  • Distinguish IPv4 private and loopback CIDR ranges from 128-bit IPv6 addresses
  • Compare TCP and UDP transport behavior and identify common service ports and their security risks
  • Match network topologies and devices (hub, switch, router, firewall, IDS/IPS) to their operational layers

Recommended first: Welcome to CyberSamSU and the Security Mindset

#Why this matters

Every cyber attack and defense depends on moving data across networks. Whether you configure a firewall, inspect packets in Wireshark, or audit open ports on a server, the OSI and TCP/IP models provide a shared map for isolating faults and spotting risky protocols quickly.

#The OSI 7-layer and TCP/IP 4-layer models

The OSI model divides networking into 7 layers, while TCP/IP groups them into 4: Application (OSI layers 5, 6, and 7), Transport (Layer 4), Internet (Layer 3), and Network Interface (Layers 1 and 2).

  1. 7Application (TCP/IP: Application)HTTP, HTTPS, FTP, SMTP, DNS, SSH
  2. 6Presentation (TCP/IP: Application)TLS 1.3 encryption, encoding, compression
  3. 5Session (TCP/IP: Application)Session setup, checkpoints, RPC, SIP
  4. 4Transport (TCP/IP: Transport)TCP, UDP, ports (0-65535), segments
  5. 3Network (TCP/IP: Internet)IPv4, IPv6, ICMP, routers, packets
  6. 2Data Link (TCP/IP: Network Interface)Ethernet, Wi-Fi, MAC, switches, frames
  7. 1Physical (TCP/IP: Network Interface)Cables, fiber, radio waves, bits

Layer 1 transmits raw bits as signals; Layer 2 forwards LAN frames by MAC address (ARP bridges Layers 2 and 3 by mapping IPv4 to MAC); Layer 3 handles logical IP routing; and Layer 4 delivers segments to application ports.

#IP addressing: IPv4, CIDR ranges, and IPv6

IPv4 uses 32-bit addresses (4 octets of 8 bits, e.g. 192.0.2.10), providing ~4.3 billion addresses. Organizations use RFC 1918 private CIDR ranges (historically aligned with legacy Class A, B, and C private space) and 127.0.0.0/8 for local loopback:

Legacy class / role CIDR range Typical use
Class A private (RFC 1918) 10.0.0.0/8 Large organizational networks
Class B private (RFC 1918) 172.16.0.0/12 Medium organizational networks
Class C private (RFC 1918) 192.168.0.0/16 Small office and home LANs
Loopback 127.0.0.0/8 Localhost only (never leaves host)

IPv6 uses 128-bit addresses (8 groups of 16 bits, e.g. 2001:0db8:85a3::8a2e:0370:7334), offering ~340 undecillion addresses, simplified headers, autoconfiguration without DHCP, improved multicast, and IPsec support (optional per RFC 6434).

#Transport protocols and well-known ports

TCP creates a reliable, ordered connection via a three-way handshake and retransmits lost segments. UDP is connectionless and fast with no delivery guarantee, suiting DNS, VoIP, gaming, and streaming video.

TCP three-way handshakeTCP three-way handshakeClientServerSYNSYN-ACKACK
TCP vs UDP
TCP
  • Connection-oriented (3-way handshake)
  • Reliable, ordered, retransmits drops
  • HTTPS, SSH, SMTP, FTP
UDP
  • Connectionless datagrams
  • Low overhead, packets may drop
  • DNS, VoIP, DHCP, video
Port Protocol Transport Purpose Security risk
20, 21 FTP TCP File transfer Passwords in plaintext
22 SSH TCP Secure shell Encrypted
23 Telnet TCP Remote admin Unencrypted, risky
25 SMTP TCP Sending email Open relay, spam
53 DNS TCP/UDP Name resolution DNS spoofing
80 HTTP TCP Web traffic Unencrypted
443 HTTPS TCP Secure web TLS 1.3 encrypted
3389 RDP TCP Windows remote Brute-force target

Inspect interfaces, Layer 3 reachability, and DNS from a Linux terminal:

Basic network diagnostics in a lab
$ ip -br addr show
lo               UNKNOWN        127.0.0.1/8 ::1/128
eth0             UP             192.0.2.15/24
$ ping -c 2 192.0.2.1
64 bytes from 192.0.2.1: icmp_seq=1 ttl=64 time=0.42 ms
64 bytes from 192.0.2.1: icmp_seq=2 ttl=64 time=0.39 ms
$ dig +short example.test A
192.0.2.10

#Network topologies and core devices

  • Star: hosts connect to a central switch; easy fault isolation, but the switch is a single point of failure.
  • Bus: shared main cable (legacy Ethernet); cheap, but one break halts the network.
  • Ring: closed loop (Token Ring); avoids collisions, but one node failure can stop the ring.
  • Mesh: redundant links between nodes (Internet backbone); resilient but costly.
  • Tree and Hybrid: hierarchical or mixed designs used in modern enterprise networks.

Devices map cleanly to layers: an obsolete hub (Layer 1) repeats signals to all ports; a switch (Layer 2) forwards LAN frames by MAC address; a router (Layer 3) routes packets between LAN and WAN by IP address; a WAP provides Wi-Fi (IEEE 802.11); a firewall filters traffic by rules; and an IDS/IPS detects or blocks suspicious activity.

#Defending / Common mistakes

Disable plaintext Telnet (23) and FTP (20, 21) in favor of SSH (22) and SFTP/HTTPS (443). Keep RDP (3389) behind a VPN with MFA and firewall rules. Bind local test services to 127.0.0.1 (127.0.0.0/8) instead of 0.0.0.0.

Common mistakes: confusing Layer 2 switches with Layer 3 routers, relying on RFC 1918 private IPs without firewall rules, leaving Telnet or HTTP enabled internally, or ignoring UDP monitoring for DNS.

#Summary

  • OSI (7 layers) maps to TCP/IP (4 layers), where TCP/IP Application combines OSI layers 5, 6, and 7.
  • IPv4 (32-bit, including RFC 1918 private blocks and 127.0.0.0/8 loopback) is complemented by 128-bit IPv6.
  • TCP guarantees reliable ordered delivery; UDP prioritizes speed without acknowledgments.
  • Plaintext ports (FTP 20/21, Telnet 23, HTTP 80) and exposed RDP (3389) pose major risks.
  • Switches (L2), routers (L3), firewalls, and IDS/IPS secure modern star and hybrid networks.

Knowledge check

Sign in to take the test, complete lessons and save your progress. Log in

Practice: test your knowledge