Career upgrade: Learn practical AI skills for better jobs and higher pay.
Level up

5.4 Computer Networks

Key Takeaways

  • The OSI model has 7 layers; the TCP/IP model collapses them into 4 (Link, Internet, Transport, Application).
  • TCP is connection-oriented and reliable with acknowledgments; UDP is connectionless, faster, and offers no delivery guarantee.
  • An IPv4 address is 32 bits; a /24 prefix leaves 8 host bits, giving 256 addresses and 254 usable hosts per subnet.
  • Encapsulation wraps each layer's data in the header of the layer below: segment, then packet, then frame.
  • Routers operate at the network (IP) layer, while switches operate at the data-link (MAC) layer.
Last updated: May 2026

Layered network models

Networks are designed in layers so each layer handles one concern and talks only to the layers directly above and below it. The FE references both the seven-layer OSI (Open Systems Interconnection) model and the practical four-layer TCP/IP model.

The value of layering is modularity: you can swap Wi-Fi for Ethernet at the link layer without touching the application, because each layer exposes a fixed interface. Know which layer a protocol or device lives at, since that is the most common network question on the exam.

OSI layers and their TCP/IP mapping

OSI Layer#FunctionTCP/IP Layer
Application7User services (HTTP, DNS)Application
Presentation6Encryption, formattingApplication
Session5Dialog controlApplication
Transport4End-to-end (TCP, UDP)Transport
Network3Routing, IP addressingInternet
Data Link2MAC framing, switchesLink
Physical1Bits on the mediumLink

A useful mnemonic for layers 1 to 7 is 'Please Do Not Throw Sausage Pizza Away.'

TCP versus UDP

Both TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) ride on top of IP at the transport layer, but they make opposite trade-offs.

  • TCP is connection-oriented: it sets up a session with a three-way handshake (SYN, SYN-ACK, ACK), numbers bytes, acknowledges receipt, retransmits losses, and controls congestion. It is reliable but adds overhead. Used by HTTP, HTTPS, email, and file transfer.
  • UDP is connectionless: it fires datagrams with no handshake, no acknowledgment, and no retransmission. It is lightweight and low-latency but unreliable. Used by DNS lookups, streaming, voice, and gaming where speed beats guaranteed delivery.

The exam loves the framing 'reliable vs fast'; choose TCP for reliability, UDP for low overhead.

IPv4 addressing and subnetting basics

An IPv4 address is 32 bits, written as four dotted decimal octets such as 192.168.1.10. A subnet mask or CIDR prefix splits the address into a network portion and a host portion. A prefix like /24 means the first 24 bits identify the network, leaving 8 host bits.

The number of addresses in a subnet is 2^(host bits). Two addresses are reserved: the all-zeros host is the network address and the all-ones host is the broadcast address. So usable hosts = 2^(host bits) - 2.

  • /24 -> 8 host bits -> 256 total -> 254 usable
  • /26 -> 6 host bits -> 64 total -> 62 usable
  • /30 -> 2 host bits -> 4 total -> 2 usable (common for point-to-point links)
Test Your Knowledge

How many usable host addresses are available in a subnet with a /27 prefix?

A
B
C
D

Encapsulation and devices

As data moves down the sending stack, each layer adds its own header in a process called encapsulation, and the receiver strips them in reverse (decapsulation). The unit of data changes name at each layer, called the protocol data unit (PDU):

  • Transport layer: segment (TCP) or datagram (UDP)
  • Network layer: packet (gets the IP header with source/destination addresses)
  • Data link layer: frame (gets the MAC header and trailer)
  • Physical layer: bits on the wire

Devices map to layers too: a hub repeats bits (layer 1), a switch forwards frames using MAC addresses (layer 2), and a router forwards packets between networks using IP addresses (layer 3).

Test Your Knowledge

Which protocol and transport choice is most appropriate for a real-time voice-over-IP application that tolerates occasional lost packets but cannot tolerate delay?

A
B
C
D