12.1.1Advanced Networks and SecurityCore

OSI Layers and Encapsulation

Follow one message down the sending stack and up the receiving stack. Explain the job at each layer and distinguish end-to-end information from a frame used on only one link.

35 min Video by Professor Messer Protocols, Routing and DNS
Understanding the OSI Model - CompTIA Network+ N10-009 - 1.1Curated by Kepler, not produced by us. Watch it before the notes below.
Open on YouTube

Before you start

  • Identify payload, header and trailer at the layer being counted.
  • Distinguish a next-hop link address from the final network-layer destination.

Watch, pause, try

Video by Professor Messer. This general Professor Messer explanation develops the seven OSI layers. Pearson also requires the distinct TCP/IP model, supported by the primary Internet architecture reading. Treat OSI as a reference model; distinguish application-protocol behaviour from everything visible in a user interface and network packets from their link frames.

Viewing focus: Identify the seven OSI layers and their roles

After watching, attempt these questions before opening the answers. You can also use the written lesson below.

After watching 1: A supplied model has 1,400 application bytes, 20 TCP-header bytes, 20 IP-header bytes and 18 combined link-header/trailer bytes. Calculate counted frame size and application-payload percentage, excluding every other overhead. Which assumption would be wrong if this number were called a universal Internet frame cost?

Show answer and reasoning

The counted total is 1,458 bytes. Application payload fraction is 1,400/1,458=700/729, about 96.02%. Real headers, options, segmentation and physical overhead depend on the protocol/version and counting boundary. This calculation uses the supplied model; it does not make every application message one frame or establish a universal fixed overhead.

After watching 2: In a simple two-link A→router→D path with Ethernet links and no NAT, explain why the next outgoing frame can have different source/destination MAC addresses while the intended IP destination remains D. Does that mean every bit of the IP packet must remain unchanged?

Show answer and reasoning

The first link frame delivers from A’s interface towards the router’s incoming interface; the next uses the outgoing router interface and suitable next-hop destination on its link. Network-layer routing still targets D in this stated no-NAT model. That does not imply every packet field is unchanged: forwarding can update fields such as an IPv4 TTL and its related header check. Keep the logical destination, packet processing and link wrapper distinct.

What you'll be able to do

  • Identify the seven OSI layers and their roles
  • Trace encapsulation and decapsulation
  • Calculate overhead under explicit header assumptions
1

Use the reference model to separate responsibilities

The OSI model describes seven layers, from application at the top to physical at the bottom. Application supports network application services; presentation concerns representations such as encoding; session concerns managing a dialogue; transport provides end-to-end transport services; network handles logical addressing/routing; data link handles communication over a link; and physical concerns transmitted signals.

It is a reference model, not a claim that every deployed protocol fits into one perfectly isolated box. Functions can be combined in actual software. For a diagram task, name the layer’s responsibility before assigning an example. An application-layer protocol is not the same thing as the entire user application, and reliable transport is a service choice rather than a property of every possible transport protocol.

Seven OSI layers are shown beside a simplified four-layer TCP/IP view. Upper functions are grouped in application, transport and internet have distinct roles, and link includes local physical delivery. The footer traces bytes, segment, packet and frame.
Scroll the diagram to see the full view.
Use these as reference-model groupings. A protocol implementation need not fit one isolated OSI box; distinguish an application protocol from every part of a visible program.
2

Wrap the data, then remove the wrappers

Encapsulation adds protocol information as data move down a sending stack. In a common Internet example, application bytes become a TCP segment, carried inside an IP packet, carried inside a link frame and represented as physical signals. Decapsulation at the receiver interprets/removes the appropriate information and passes the payload upwards. The wrapper belongs to the protocol operating at that stage.

An intermediate router processes the incoming link delivery and the IP routing information, then sends a new frame appropriate to the next link. The next-hop link addresses can differ from the previous link’s. Do not assume one Ethernet frame travels unchanged across the whole Internet. End-to-end addresses/ports also need qualification when mechanisms such as NAT are involved; state the simple model used in the trace.

3

Count only the supplied overhead

Assume 1000 application bytes, a 20-byte TCP header, 20-byte IP header, 14-byte link header and four-byte link trailer, with no other overhead. The model sends 1058 bytes at the counted link-frame level. Its application payload fraction is 1000/1058≈94.52%. Physical preambles, gaps, options and other protocols are deliberately outside this model.

This example separates payload size from transmitted size. Headers vary by protocol, options and version, so do not memorise the example’s sum as a universal overhead. Similarly, one application message can require several transport segments or share a stream with other messages. Label the unit being counted and the endpoints of the comparison before calculating efficiency or transmission time.

OSI layer, top→bottomPrincipal responsibility in this model
7 ApplicationNetwork application services
6 PresentationRepresentation/encoding-related functions
5 SessionDialogue/session coordination
4 TransportEnd-to-end transport service
3 NetworkLogical addressing and routing
2 Data linkFrames and delivery over a link
1 PhysicalSignals over the medium
Scroll horizontally to see the full code or table.
Learn responsibilities as well as the order; real protocol boundaries need a stated model.
4

Work through the problem

Attempt the task before opening its worked response. Record each change of state, explain the rule used, and check the result against the original requirements. Code examples labelled Python 3 use that language’s conventions; pseudocode states its own assumptions.

Example 1Calculate counted frame size and application fraction under the stated header model.
1Add 1000+20+20+14+4=1058 bytes.
2Divide application payload 1000 by counted total 1058.
3Multiply by 100 for a percentage.
Answer
1058 bytes, approximately 94.52% application payload.
Example 2Why is a router’s next outgoing frame not necessarily identical to the incoming frame?
1The router receives a frame valid for the incoming link.
2It selects an outgoing route using network-layer information.
3It constructs the link delivery for the next hop, with appropriate link addressing/framing.
Answer
Link encapsulation changes across hops; the original frame is not an end-to-end container.

Common mistakes to avoid

Memorising layer names without a service explanation.
Identify what information each stage adds or interprets.
Equating application-message boundaries with TCP-segment boundaries.
State whether the transport supplies a byte stream or message service.

Key takeaways

  • The seven-layer reference model separates responsibilities.
  • Encapsulation wraps payloads and decapsulation interprets them.
  • Overhead and hop behaviour require an explicit protocol model.

Explore further

Return to this tomorrow

Close the notes and answer from memory. Revisit any explanation you cannot yet reconstruct.

  • An Ethernet frame must remain unchanged across every Internet hop:
  • The overhead calculated here is:

Test yourself

Answer a few questions, then review anything you missed.

Next step

Keep practising

Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.

Browse practice topics

Related lessons

All 4 lessons