Chapter 1

Layering and encapsulation

A layer offers a service to the layer above and uses the service below. Separate the logical peer protocol from the actual path followed by bytes. This distinction explains which addresses survive a router hop.

1.1 Services, interfaces and protocols

Past papers · CS 2014–2026 (23 papers): 2 questions, 2 marks

A service states what a layer provides; an interface states how the adjacent layer accesses it; a protocol specifies messages and rules between peer entities. Peers communicate logically. Actual data travels down the sender's stack, through the medium, and up the receiver's stack.

Function groupMain responsibilityTypical identifier or unit
ApplicationMeaning of requests and responsesNames, URLs; application messages
TransportCommunication between processes; TCP reliability and flow controlPort; TCP segment and byte stream
NetworkDelivery across networks and route selectionIP address; datagram
LinkDelivery on a link; medium sharing and error detectionMAC address on Ethernet; frame
PhysicalSignalling and bit synchronisationBits and signals

This functional table is sufficient for layering questions. Memorising the named seven-layer stack and detailed framing procedures is not covered in this handbook. A connection-oriented service has an establishment phase; this alone does not imply reserved bandwidth or error-free delivery. Reliability can be implemented at more than one layer, with different endpoints.

1.2 Headers and address scope

Past papers · CS 2014–2026 (23 papers): 2 questions, 3 marks

Encapsulation places a higher-layer data unit inside a lower-layer payload. At reception, the matching header selects the next protocol or process. Ethernet EtherType identifies its payload protocol; IPv4 Protocol identifies the protocol directly carried by IP; a TCP destination port identifies the receiving service.

For a remote destination, a sender uses the destination host's IP address and the next-hop router's MAC address. A router removes the incoming link encapsulation and creates outgoing link encapsulation. Ordinary IP forwarding preserves endpoint IP addresses, reduces TTL and updates the IP header checksum. NAT is an explicit exception to address preservation (Section 6.5).

A link-layer switch does not become the destination MAC address just because a frame passes through it. Link addresses from distant endpoint LANs are not carried in the Ethernet header on an intermediate router link. Headers below an encrypted payload remain visible unless those headers are separately protected.

Last-minute recall

  • A service is offered vertically; a protocol operates between peers.
  • Encapsulation adds overhead; decapsulation removes the corresponding overhead.
  • Ports identify processes; IP addresses identify network endpoints; MAC addresses serve the current link.
  • Remote IP destination does not mean remote MAC destination on the sender's LAN.
  • TCP reliability does not make IP itself reliable.
  • Routers change link headers and TTL; NAT can also change endpoint addresses.

Revise offline: the whole Computer Networks handbook as one PDF

47 pages · 2.1 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections