Network Layer Models

Understand OSI and TCP/IP models and packet encapsulation

7
Application
6
Presentation
5
Session
4
Transport
3
Network
2
Data Link
1
Physical
Sender
Receiver

Interaction guide: Click on a layer to highlight it. Double-click or click the info button to show protocol and encapsulation details. Press "Start Animation" to visualize data traversing through the layers.

Network communication systems are organized in layers to manage complexity and ensure standardized communications. Each layer offers specific services to the layer above and utilizes services from the layer below.

Introduction to Layered Models

Two primary layered models dominate networking: the OSI (Open Systems Interconnection) model and the TCP/IP model. These models provide a framework for understanding how data moves through a network.

OSI Model

Developed by ISO in the late 1970s

7 distinct layers

More theoretical and comprehensive

TCP/IP Model

Developed for the ARPANET/Internet

4 condensed layers

More practical and widely implemented

The OSI Model: 7 Layers

The OSI model, developed by the International Organization for Standardization (ISO), divides network communication into seven distinct layers, each with specific responsibilities:

Physical Layer (Layer 1)

Transmits raw bit streams over physical medium

Functions:

Bit synchronization, bit rate control, physical topologies, transmission mode

Hardware:

Hubs, repeaters, cables, network adapters, modems

Example:

When you connect an Ethernet cable, you're operating at the Physical layer

Data Link Layer (Layer 2)

Provides node-to-node data transfer and error detection

Functions:

Framing, physical addressing (MAC), error detection and control, media access control

Hardware:

Switches, network interface cards, bridges

Example:

Ethernet protocol operates here, managing how data is formatted into frames

Network Layer (Layer 3)

Routes data packets between different networks

Functions:

Logical addressing (IP), routing, packet forwarding, fragmentation and reassembly

Hardware:

Routers, Layer 3 switches

Example:

IP addressing and routing occurs at this layer

Transport Layer (Layer 4)

Provides end-to-end communication and data flow control

Functions:

Segmentation, flow control, error correction, port addressing

Protocols:

TCP (connection-oriented) and UDP (connectionless)

Example:

TCP ensures all packets arrive in order with error recovery

Session Layer (Layer 5)

Establishes, maintains, and terminates connections

Functions:

Session establishment, maintenance, and termination, synchronization, dialog control

Example:

NetBIOS, RPC (Remote Procedure Call), SQL

Presentation Layer (Layer 6)

Translates data between application and network formats

Functions:

Data translation, encryption, compression, character encoding

Example:

JPEG, MPEG, SSL/TLS encryption, ASCII, EBCDIC

Application Layer (Layer 7)

Provides network services directly to end-users

Functions:

Network applications, file transfers, messaging, user interfaces

Example:

HTTP, SMTP, FTP, DNS, Telnet, SSH, SNMP

The TCP/IP Model: 4 Layers

The TCP/IP model is the networking model used in the current internet architecture and is simpler than OSI:

Network Access Layer

(or Link Layer): Combines OSI Physical and Data Link layers

Functions:

Physical addressing, media access, hardware addressing, physical topology

Examples:

Ethernet, Wi-Fi, PPP, ARP

Internet Layer

Corresponds to OSI Network Layer

Functions:

Logical addressing (IP), routing, packet handling

Protocols:

IP, ICMP, ARP, IGMP

Transport Layer

Similar to OSI Transport Layer

Functions:

End-to-end communication, reliability, flow control

Protocols:

TCP, UDP, SCTP

Application Layer

Combines OSI Session, Presentation, and Application layers

Functions:

User interfaces, data formatting, encryption, application services

Protocols:

HTTP, FTP, SMTP, DNS, Telnet, SSH, SNMP

Encapsulation and Decapsulation

Encapsulation is the process where each layer adds its own header information as data travels down the protocol stack.Decapsulation is the reverse process where each layer removes its respective header information before passing the data up.

Encapsulation Process:

  1. Application data is generated
  2. Transport layer adds TCP/UDP header (creates a segment/datagram)
  3. Internet layer adds IP header (creates a packet)
  4. Link layer adds frame header and trailer (creates a frame)
  5. Physical layer converts to bits for transmission

This layered approach allows each protocol to focus on its specific functions without concerning itself with the details of other layers, making network design and troubleshooting more manageable.