Skip to content

Linux Foundations / Follow traffic and find the fault ยท Step 3 of 46

Lesson: TCP/IP ModelSwitch
โ† Linux Foundations

Network operations

TCP/IP Model

The layered model behind the internet and how it compares with OSI.

The TCP/IP model describes how the internet's protocols fit together. It is named after two of its most important protocols.

The layers

RFC 1122 describes four layers:

| Layer | Job | Examples | |---|---|---| | Application | what programs say to each other | HTTP, SSH, DNS | | Transport | delivery between processes on hosts | TCP, UDP | | Internet | addressing and routing across networks | IPv4, IPv6, ICMP | | Link | delivery on the local network | Ethernet, Wi-Fi |

Some books split the bottom into separate Link and Physical layers and teach five. Names such as "Network Access" also appear. The ideas are the same.

Compared with OSI

The TCP/IP application layer covers roughly OSI layers 5, 6 and 7. The internet layer matches OSI layer 3. The link layer covers about OSI layers 1 and 2. The match is approximate, not exact.

Following a request

Say you open a web page over plain HTTP:

  1. The browser writes an HTTP request (application).
  2. TCP puts it in a segment with source and destination ports (transport).
  3. IP adds source and destination IP addresses (internet).
  4. Ethernet or Wi-Fi puts it in a frame with MAC addresses (link).

Each router on the way removes the frame, reads the IP header, chooses the next hop and builds a new frame. The IP addresses normally stay the same end to end, except where address translation (NAT) changes them. The MAC addresses change on every link.

HTTPS adds TLS encryption between HTTP and TCP. HTTP/3 uses QUIC over UDP.

Seeing the layers

$ curl -v http://example.com/
*   Trying 93.184.215.14:80...
* Connected to example.com (93.184.215.14) port 80
> GET / HTTP/1.1
> Host: example.com
< HTTP/1.1 200 OK

The output is shortened, and the address you see will differ. The first two lines show the IP address and TCP port. The lines starting with > and < are the application protocol, sent and received.

Try it

Run the curl -v command above and label each line by layer. Notice that curl does not show MAC addresses: the operating system handles the link layer for you. You can look at local neighbours with ip neigh. The networking and SSH lab gives you a shell to experiment in.

Check your understanding

TCP/IP Model

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.