Learning Objectives
By the end of this topic you will be able to:
Explain the role of the Transport layer: TCP vs UDP, ports and sockets
Describe the Network layer: IP addressing and routing
Describe the Link (Data Link) layer: MAC addresses and framing
Explain how the layers interact when data is sent and received
Transport Layer
Transport Layer: TCP and UDP
TCP (Transmission Control Protocol)
Connection-oriented. Three-way handshake (SYN, SYN-ACK, ACK) establishes connection. Guarantees delivery, ordering, and error-checking via acknowledgements and retransmission. Used for: HTTP, email, file transfer — anything where data integrity matters.
UDP (User Datagram Protocol)
Connectionless. No handshake, no acknowledgements, no guaranteed ordering. Much lower overhead. Used for: video streaming, online gaming, DNS, VoIP — where speed matters more than guaranteed delivery.
Ports and Sockets: ports identify specific applications on a host (0–65535). A socket = IP address + port number. A TCP/UDP connection is identified by a socket pair: (source IP, source port, destination IP, destination port).
Network Layer
Network (Internet) Layer
IP (Internet Protocol): responsible for logical addressing and routing. Each packet carries source and destination IP addresses. Routers use these to forward packets hop-by-hop toward the destination.
IP is connectionless: each packet is routed independently. No pre-established path. Packets may arrive out of order — the Transport layer (TCP) handles reordering.
ICMP (Internet Control Message Protocol): used for network diagnostics. The ping command uses ICMP echo requests/replies to test reachability. traceroute uses ICMP TTL-exceeded messages to map the route.
The network layer adds an IP header: source IP, destination IP, TTL, protocol, and checksum. This header is read and updated by each router along the path.
Link Layer
Link (Data Link) Layer
MAC addresses: a 48-bit hardware address burned into each NIC (Network Interface Card), written as six pairs of hex digits (e.g. A1:B2:C3:D4:E5:F6). Used for local network delivery within the same subnet.
ARP (Address Resolution Protocol): maps IP addresses to MAC addresses on the local network. A device broadcasts "who has IP x.x.x.x?" and the owner replies with its MAC address. The result is cached in the ARP table.
Framing: the link layer wraps packets in frames with a MAC source, MAC destination, and a Frame Check Sequence (FCS) for error detection. Frames are only valid on the local link — the MAC addresses change at each router hop.
Common Mistakes
Don't Lose Marks
!
Saying the IP address changes as a packet crosses routers — the IP source and destination remain constant end-to-end. Only the MAC address changes at each router hop (the router strips the old frame and creates a new one with its own MAC as source).
!
Confusing UDP with unreliable in a bad way — UDP is perfectly appropriate when low latency matters more than perfect delivery (streaming, gaming, DNS). The question asks you to justify the choice: don't automatically say TCP is better — it depends on the application.
!
Saying TCP's three-way handshake is SYN, ACK, ACK — it is SYN, SYN-ACK, ACK. The second message is from the server and combines SYN (synchronise) and ACK (acknowledge the client's SYN). Get the exact sequence right.
1.3.5c Complete
Well done! ✓
Transport, Network and Link Layers in Depth
Return to lesson to continue