Computer Networks Lesson 1 of 6 ⏱️ 4 min read

Computer Networks Introduction: OSI & TCP/IP Models

How data travels across networks, the OSI and TCP/IP layer models, packets, encapsulation and the role of each layer.

Updated Oct 30, 2026

What is a computer network?

A computer network is a set of devices connected so they can exchange data. Your laptop on Wi-Fi, a data centre with thousands of servers and the internet itself — a network of networks — are all computer networks.

Every time a student opens a lesson on this site, dozens of protocols cooperate: Wi-Fi or Ethernet moves bits, IP routes packets across the world, TCP makes delivery reliable, TLS encrypts it, DNS found the server's address, and HTTP carries the page. Developers who understand these layers debug timeouts, slow APIs and "it works locally" problems far faster.

Types of networks

Type Scale Example
LAN (Local Area Network) A home, office or campus Devices on your Wi-Fi router
WAN (Wide Area Network) Cities and countries An ISP backbone, the internet
Data centre network Thousands of servers A cloud region
VPN A private network over the public internet Connecting to the office from home

Packets and protocols

Data isn't sent as one long stream across the internet. It's split into packets, each carrying addresses and control information, and routed independently. A protocol is an agreed set of rules for a conversation — message formats, ordering and error handling.

The OSI model (7 layers)

The OSI model is a conceptual model that splits networking into seven layers. Each layer serves the one above it.

# Layer Responsibility Examples Data unit
7 Application Network services for apps HTTP, DNS, SMTP, SSH Message
6 Presentation Encoding, encryption, compression TLS, JSON, UTF-8 Message
5 Session Managing sessions/dialogues Session setup, RPC Message
4 Transport End-to-end delivery between processes, ports TCP, UDP, QUIC Segment / datagram
3 Network Addressing and routing between networks IP, ICMP Packet
2 Data link Delivery on one local link, MAC addresses Ethernet, Wi-Fi Frame
1 Physical Bits over a medium Cables, radio, fibre Bits

A popular mnemonic from layer 1 up: "Please Do Not Throw Sausage Pizza Away."

The TCP/IP model (what the internet uses)

The internet is built on the simpler TCP/IP model, which merges some OSI layers:

TCP/IP layer Maps to OSI Protocols
Application 5, 6, 7 HTTP, DNS, TLS, SMTP
Transport 4 TCP, UDP
Internet 3 IPv4, IPv6, ICMP
Link 1, 2 Ethernet, Wi-Fi

In interviews, know both: OSI for vocabulary ("a layer 7 load balancer"), TCP/IP for how things really work.

Encapsulation

As data goes down the stack on the sender, each layer wraps it with its own header. On the receiver, each layer removes its header going up — this is encapsulation and decapsulation.

Plaintext
Application:                          [ HTTP request ]
Transport:                [TCP header][ HTTP request ]
Internet:       [IP header][TCP header][ HTTP request ]
Link:  [Eth hdr][IP header][TCP header][ HTTP request ][Eth trailer]

Routers along the path only look up to the IP header (layer 3); the TCP and HTTP data are untouched until the destination.

Addresses at each layer

Address Layer Identifies Example
MAC address Data link A network interface on the local link 3c:22:fb:12:9a:01
IP address Network A host across networks 203.0.113.10, 2001:db8::1
Port Transport A process/service on a host 443 (HTTPS), 5432 (PostgreSQL)
Domain name Application A human-friendly name, resolved by DNS noalabs.com

A connection is identified by the 5-tuple: protocol, source IP, source port, destination IP, destination port.

Network devices

Device Layer Job
Switch 2 Forwards frames within a LAN using MAC addresses
Router 3 Forwards packets between networks using IP addresses
Firewall 3–7 Allows or blocks traffic by rules
Load balancer 4 or 7 Distributes traffic across servers

Measuring networks

  • Bandwidth — how much data per second a link can carry (e.g. 100 Mbps).
  • Latency — how long one packet takes to arrive (e.g. 40 ms); RTT is the round-trip time.
  • Throughput — the data rate you actually achieve.
  • Packet loss and jitter (variation in latency) — critical for calls and games.

For APIs, latency usually matters more than bandwidth: a page that makes 20 sequential requests at 100 ms RTT spends 2 seconds just waiting.

Common mistakes

  • Treating OSI as how the internet literally works — it's a teaching model.
  • Confusing bandwidth with latency — a fat pipe can still be slow to respond.
  • Forgetting ports — "the server is up" doesn't mean the service is listening.

Key takeaways

  • Data travels as packets; protocols define the rules at each layer.
  • OSI has 7 layers; the internet uses the 4-layer TCP/IP model.
  • Each layer adds a header (encapsulation): MAC → IP → port → application.
  • Latency, not bandwidth, often dominates web performance.
Finished this lesson?
Tick it off to track your Computer Networks progress.
Next lesson