Skip to content

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

Lesson: OSI ModelSwitch
โ† Linux Foundations

Network operations

OSI Model

The seven layers of the OSI reference model and how they help you think about network problems.

The OSI model (Open Systems Interconnection) is a reference model published by ISO. It splits communication into seven layers. Each layer does one kind of job and relies on the layer below it. The internet does not follow it strictly, but people use its layer numbers every day.

The seven layers

From top to bottom:

| Layer | Name | Job | Examples | |---|---|---|---| | 7 | Application | services for programs | HTTP, DNS | | 6 | Presentation | data format, encoding | character sets | | 5 | Session | managing conversations | dialogue control | | 4 | Transport | end to end delivery between processes | TCP, UDP | | 3 | Network | addressing and routing between networks | IP | | 2 | Data link | delivery across one link | Ethernet frames | | 1 | Physical | bits as signals | cables, radio |

A common memory aid from layer 1 upward is "Please Do Not Throw Sausage Pizza Away".

Encapsulation

When you send data, it travels down the layers. Lower layers wrap what they receive in their own header. TCP data becomes a segment, which is placed in an IP packet, which is placed in a frame on the link. The receiver unwraps it going up. This wrapping is called encapsulation.

Using layers to troubleshoot

Layers give you an order for checking things. One common way is bottom up:

$ ip -br link                      # layers 1 and 2: is the interface up?
lo      UNKNOWN  00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
enp1s0  UP       52:54:00:12:34:56 <BROADCAST,MULTICAST,UP,LOWER_UP>

$ ip -br address                   # layer 3: is there an address?
$ ping -c 3 192.0.2.10             # layer 3: can I reach the host?
$ curl -I https://www.example.com  # layer 7: does the service answer?

Replace the example addresses with ones you want to test. A failed ping alone is not proof of a fault, because firewalls may block it.

If the link is down, there is no point debugging the web server yet.

Limits of the model

Real protocols do not always fit neatly. TLS, which secures HTTPS, is often placed around layers 5 to 6, and sources disagree. The TCP/IP model, with fewer layers, is closer to how the internet is built. Treat OSI as a shared vocabulary rather than a law.

Try it

Run ip -br link and ip -br address on your machine. For each line of output, say which layer it tells you about. Then read the networking basics guide to see the layers in context.

Check your understanding

OSI 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.