Sub topic 2
From the Link Layer to Applications
Assume you know what clients, servers, IP addresses, and terminals are. This chapter follows one message through the TCP/IP stack. Each layer adds information needed by the layer below it.
The link layer: Ethernet frames and MAC addresses
The link layer moves data across one local network, such as an Ethernet LAN. An Ethernet frame contains a source and destination MAC address. A MAC address identifies a network interface on that local link.
A switch reads destination MAC addresses and forwards frames within the LAN. MAC addresses are not used for routing across the internet. The Address Resolution Protocol (ARP) finds the MAC address associated with a local IPv4 address.
The internet layer: IP addresses, routing, and ICMP
The internet layer moves packets between networks. Internet Protocol (IP) provides source and destination IP addresses. Routers examine the destination IP address and choose the next network hop.
Internet Control Message Protocol (ICMP) carries control and error messages. The ping command commonly uses ICMP echo messages, but ICMP is not limited to testing connectivity.
The transport layer: TCP, UDP, and ports
The transport layer delivers data to the correct application process. A port is a number that identifies a service on a host.
TCP provides a reliable, ordered byte stream. It establishes a connection, retransmits lost data, and controls its sending rate. UDP sends independent datagrams with less overhead. UDP does not provide delivery or ordering by itself.
| Layer | Common protocols | Data unit |
|---|---|---|
| Link | Ethernet, ARP | Frame |
| Internet | IPv4, IPv6, ICMP | Packet |
| Transport | TCP, UDP | Segment or datagram |
| Application | HTTP, DNS, TLS | Message or data |
The application layer: HTTP, DNS, TLS, and friends
The application layer contains protocols used directly by software. HTTP transfers web requests and responses. DNS translates names such as example.com into IP addresses. TLS encrypts and authenticates many application protocols, including HTTPS.
sudo tcpdump -nn -e -v -c 5 'tcp port 443'This capture can show the Ethernet header, IP header, and TCP header. Encrypted HTTPS application data remains unreadable without the required keys.
Exercise
Which layer should you inspect first when a host has no local network connection?
Show answer
Inspect the link layer, including the interface, Ethernet connection, and local MAC communication.