MFormations
Modern Network Engineering

Chapitre 2

Chapter 02: Modèle OSI et TCP/IP

Chapter 02: Modèle OSI et TCP/IP

Chapter 02: Modèle OSI et TCP/IP

1. The OSI Model

1.1 Overview

The Open Systems Interconnection (OSI) model was developed by ISO in 1984 as a reference framework for network protocol design. It divides network communication into 7 distinct layers, each with specific responsibilities.

Diagramme en cours de génération...

1.2 Layer 7: Application Layer

Function: Provides network services to user applications. This is the layer users interact with directly.

Key protocols:

  • HTTP/HTTPS (web browsing)
  • FTP/SFTP (file transfer)
  • SMTP/POP3/IMAP (email)
  • DNS (domain name resolution)
  • DHCP (IP configuration)
  • SSH/Telnet (remote access)

PDU: Data (or "Message")

1.3 Layer 6: Presentation Layer

Function: Translates between application data formats and network formats. Handles:

  • Data encoding (ASCII, UTF-8, EBCDIC)
  • Encryption (SSL/TLS at this layer or below)
  • Compression
  • Serialization (JSON, XML, Protocol Buffers)

Key protocols/standards:

  • SSL/TLS (sometimes considered transport or presentation)
  • MIME (email attachments)
  • XDR (External Data Representation)

Note: In practice, this layer is often absorbed into the application layer or handled by libraries.

1.4 Layer 5: Session Layer

Function: Manages sessions (dialog) between applications:

  • Session establishment, maintenance, termination
  • Checkpointing and recovery
  • Duplex control (simplex, half, full)
  • Dialog separation

Key protocols:

  • NetBIOS
  • RPC (Remote Procedure Call)
  • PPTP (VPN)
  • SOCKS

Note: Like the presentation layer, session layer functions are often implemented within application protocols or the transport layer.

1.5 Layer 4: Transport Layer

Function: Provides end-to-end communication between hosts:

  • Segmentation and reassembly
  • Connection management (establishment, maintenance, termination)
  • Flow control
  • Error detection and recovery
  • Multiplexing (ports)

Key protocols:

  • TCP (reliable, connection-oriented)
  • UDP (unreliable, connectionless)
  • SCTP (stream control)
  • QUIC (HTTP/3 transport)

PDU: Segment (TCP) or Datagram (UDP)

Key concepts:

  • Port numbers (16-bit, 0-65535)
    • Well-known ports: 0-1023
    • Registered ports: 1024-49151
    • Dynamic/private ports: 49152-65535
ServicePortTransport
HTTP80TCP
HTTPS443TCP
DNS53TCP/UDP
DHCP67/68UDP
SSH22TCP
SMTP25TCP

1.6 Layer 3: Network Layer

Function: Routes packets across networks:

  • Logical addressing (IP addresses)
  • Routing (path selection)
  • Packet fragmentation and reassembly
  • Quality of Service (QoS)
  • TTL (Time to Live)

Key protocols:

  • IPv4, IPv6
  • ICMP (ping, traceroute)
  • ARP/NDP (address resolution)
  • OSPF, BGP (routing protocols)
  • IPsec (security)

PDU: Packet

Key concepts:

  • IP addressing (see Chapter 03)
  • Routing tables
  • Next-hop forwarding
  • MTU (Maximum Transmission Unit)

1.7 Layer 2: Data Link Layer

Function: Provides node-to-node data transfer:

  • Framing (synchronization)
  • Physical addressing (MAC addresses)
  • Error detection (CRC)
  • Flow control
  • Media access control (CSMA/CD, CSMA/CA)

Two sublayers (IEEE 802):

Diagramme en cours de génération...

Key protocols/technologies:

  • Ethernet (802.3)
  • WiFi (802.11)
  • PPP (Point-to-Point Protocol)
  • VLAN (802.1Q)
  • STP/RSTP/MSTP

PDU: Frame

MAC Address: 48-bit (6 bytes) unique identifier

  • First 24 bits: OUI (Organizationally Unique Identifier)
  • Last 24 bits: NIC-specific
  • Format: AA:BB:CC:DD:EE:FF

1.8 Layer 1: Physical Layer

Function: Transmits raw bits over the physical medium:

  • Signal encoding
  • Bit synchronization
  • Media characteristics
  • Connector specifications

Key standards:

  • 10BASE-T, 100BASE-TX, 1000BASE-T (electrical)
  • 10GBASE-SR, 10GBASE-LR (optical)
  • RS-232 (serial)
  • SFP, QSFP transceivers

PDU: Bits

2. The TCP/IP Model

2.1 Overview

The TCP/IP model (also called the Internet Protocol Suite) is the practical model used for the Internet. It has 4 layers (sometimes described as 5).

Diagramme en cours de génération...

2.2 Layer 4: Application Layer

Combines OSI layers 5-7 (Session, Presentation, Application).

Protocols:

  • HTTP, HTTPS, HTTP/2, HTTP/3
  • DNS
  • DHCP
  • FTP, SFTP, SCP
  • SMTP, IMAP, POP3
  • SSH, Telnet
  • TLS/SSL

2.3 Layer 3: Transport Layer

Same as OSI Layer 4.

Protocols: TCP, UDP, SCTP, QUIC

2.4 Layer 2: Internet Layer

Equivalent to OSI Layer 3 (Network).

Protocols: IP, ICMP, ARP, IPsec, routing protocols

2.5 Layer 1: Network Access / Link Layer

Combines OSI layers 1-2 (Physical and Data Link).

Protocols/technologies:

  • Ethernet (802.3)
  • WiFi (802.11)
  • PPP, PPTP
  • DSL, cable modem

3. Encapsulation and Decapsulation

3.1 The Encapsulation Process

When data travels from an application to the network, each layer adds its own header (and sometimes trailer).

Diagramme en cours de génération...

3.2 PDU and SDU

PDU (Protocol Data Unit): The data unit at a specific layer including the header. SDU (Service Data Unit): The data passed down from the upper layer.

LayerPDU NameSDU from Above
ApplicationDataUser data
TransportSegment (TCP) / Datagram (UDP)Application data
NetworkPacketSegment
Data LinkFramePacket
PhysicalBitsFrame

3.3 Detailed Encapsulation Example: HTTP Request

Diagramme en cours de génération...

3.4 Decapsulation (Receiving)

Diagramme en cours de génération...

4. OSI vs TCP/IP Comparison

AspectOSI ModelTCP/IP Model
Layers74
Developed byISO (International)IETF / ARPANET
Year19841970s-1980s
ApproachConceptual (reference)Practical (implementation)
Session/PresentationSeparate layersCombined in Application
Upper/Lower distinctionYes (Upper: 5-7, Lower: 1-4)No
Protocol adherenceStrict layer separationMore flexible
Industry adoptionTeaching/referenceActual implementation

Key Differences:

  1. Number of layers: OSI has 7, TCP/IP has 4
  2. Session/Presentation: OSI separates them; TCP/IP combines them
  3. Network/Internet: OSI calls it "Network"; TCP/IP calls it "Internet"
  4. Physical/Data Link: OSI separates them; TCP/IP combines them
  5. Development: OSI was designed "top-down"; TCP/IP evolved "bottom-up"
  6. Flexibility: TCP/IP is more pragmatic; OSI is more theoretical

Why Both Matter:

  • OSI: Used for teaching, troubleshooting (think about layer X), and conceptual understanding
  • TCP/IP: Used in the real world for protocol implementation

5. Complete Scenario: Ping

Step-by-step: ping 8.8.8.8

Diagramme en cours de génération...

Wireshark Output (simplified):

Frame 1: 74 bytes on wire (592 bits)
Ethernet II, Src: 00:1a:2b:3c:4d:5e, Dst: 00:5e:4d:3c:2b:1a
Internet Protocol Version 4, Src: 192.168.1.10, Dst: 8.8.8.8
    Version: 4
    Header Length: 20 bytes
    Total Length: 60
    TTL: 64
    Protocol: ICMP (1)
Internet Control Message Protocol
    Type: 8 (Echo (ping) request)
    Code: 0
    Checksum: 0x4a5c
    Identifier: 1
    Sequence: 1
    Data (32 bytes)

6. Complete Scenario: HTTP Request

Step-by-step: http://example.com

Diagramme en cours de génération...

7. Key Concepts

7.1 Multiplexing and Demultiplexing

Multiplexing (sending): Multiple applications can use the network simultaneously. The transport layer uses port numbers to distinguish between different application streams.

Demultiplexing (receiving): The transport layer examines the destination port number to deliver data to the correct application.

7.2 Peer-to-Peer Communication

Each layer communicates logically with its peer layer on the other device.

Diagramme en cours de génération...

8. Exercises

Exercise 1: Layer Identification

For each protocol, identify the OSI layer:

  1. HTTP
  2. TCP
  3. IP
  4. Ethernet
  5. OSPF
  6. TLS
  7. ARP
  8. UDP

Exercise 2: Encapsulation Diagram

Draw the encapsulation for a DNS query. Show headers at each layer.

Exercise 3: Frame Analysis

Given this packet capture hex, identify each layer's header:

0000: 00 1a 2b 3c 4d 5e 00 5e 4d 3c 2b 1a 08 00 45 00
0010: 00 3c 00 01 00 00 40 01 f9 8c c0 a8 01 0a 08 08
0020: 08 08 08 00 4a 5c 00 01 00 01 61 62 63 64 65 66

Exercise 4: OSI Layer Troubleshooting

For each network problem, identify which OSI layer is likely affected:

  1. "No network cable plugged in"
  2. "Can ping IP but not hostname"
  3. "Web page loads slowly"
  4. "Wrong default gateway"
  5. "Application crashes on connect"