The Seven OSI Layers and Their Order
Every GATE Computer Networks question that asks "at which layer does X happen?" is testing one thing โ your fluency with the OSI reference model. Once you can recite the seven layers in order, name the PDU (Protocol Data Unit) at each, and place a few canonical protocols correctly, you have unlocked perhaps the highest-yield static knowledge in the entire CN syllabus.
Definition: The OSI (Open Systems Interconnection) reference model is a seven-layer conceptual framework standardised by the ISO (International Organization for Standardization) in 1984 as ISO 7498. It describes how data should travel from a sending application across a network and back up to a receiving application, by dividing the work into seven independent, layered responsibilities.
Definition: A Protocol Data Unit (PDU) is the formatted unit of data exchanged between peer entities at the same layer. The PDU's name changes at every layer โ bit at the Physical layer, frame at the Data Link layer, packet at the Network layer, segment (or datagram) at the Transport layer, and simply "data" at the upper three layers.
The seven layers, from bottom to top
The OSI model is studied bottom-up because data flows up through the layers on receive, and the lower layers are concerned with raw physical movement of bits.
Physical (Layer 1) โ transmission of raw bits over a physical medium (copper, fibre, radio). Deals with voltages, frequencies, modulation, connector pin layout (RJ-45, RS-232), and data rate. Devices: hubs, repeaters, cables, NIC physical interface. PDU: Bit.
Data Link (Layer 2) โ node-to-node transfer of frames across a single physical link, with error detection (CRC), framing, MAC addressing and flow control. Sub-layers: LLC (Logical Link Control) and MAC (Media Access Control). Devices: switches, bridges, NICs. Protocols: Ethernet, PPP, HDLC, IEEE 802.11 MAC. PDU: Frame.
Network (Layer 3) โ end-to-end delivery of packets across multiple networks, routing, logical addressing (IP). Devices: routers, Layer-3 switches. Protocols: IP (IPv4, IPv6), ICMP, ARP (debated; ARP straddles L2-L3), routing protocols such as OSPF, BGP, RIP. PDU: Packet (or datagram in connectionless context).
Transport (Layer 4) โ end-to-end process-to-process delivery, segmentation and reassembly, connection control, reliability and flow control. Protocols: TCP (reliable, connection-oriented), UDP (best-effort, connectionless), SCTP. Port numbers belong here. PDU: Segment (TCP) / Datagram (UDP).
Session (Layer 5) โ establishment, management and termination of dialogues between applications; checkpointing and recovery for long transfers. Protocols: NetBIOS, RPC, PPTP control. PDU: Data.
Presentation (Layer 6) โ syntax translation: encoding/decoding (ASCII, Unicode), compression, encryption/decryption. Examples: TLS/SSL operations (often discussed at L6 in academic treatments), MIME, JPEG, MPEG. PDU: Data.
Application (Layer 7) โ the interface to end-user processes. Protocols: HTTP / HTTPS, FTP, SMTP, POP3, IMAP, DNS, DHCP, SNMP, Telnet, SSH. PDU: Data.
Mnemonics for the order
The two standard memory aids are:
Bottom-up (Physical โ Application): "Please Do Not Throw Sausage Pizza Away" โ P-D-N-T-S-P-A.
Top-down (Application โ Physical): "All People Seem To Need Data Processing" โ A-P-S-T-N-D-P.
Use whichever direction you find natural; both are universally recognised in CN textbooks.
Grouping: media vs host
A useful conceptual split:
- Layers 1โ3 are the "network / media" layers: hardware-oriented, concerned with moving bits and addressing devices.
- Layers 5โ7 are the "host / application" layers: software-oriented, concerned with the meaning and use of the data.
- Layer 4 (Transport) is the bridge between the two โ it hides network details from the application above and provides reliability above the unreliable network below.
The PDU sequence โ climb up the ladder
Why it matters: GATE has a recurring question pattern โ "What is the PDU at the Transport layer?" or "Which layer fragments and reassembles?" The PDU sequence, climbed bottom-up, is:
Bits โ Frames โ Packets โ Segments โ Data (Data / Data)
A common mnemonic is "Boys From Pakistan Send Data" or "Bits, Frames, Packets, Segments, Data" read aloud as a chant. The PDU name changes because each layer adds its own header (and sometimes trailer) to the PDU it receives from the layer above โ a process called encapsulation.
On encapsulation: the Application layer hands "data" down. The Transport layer prepends a TCP/UDP header โ segment. The Network layer prepends an IP header โ packet. The Data Link layer prepends a frame header and appends a trailer โ frame. The Physical layer transmits this as a sequence of bits. At the receiver, the reverse process โ decapsulation โ strips the headers in reverse order.
OSI vs TCP/IP โ context for GATE
The OSI model is a conceptual reference; the TCP/IP model is the protocol stack actually used on the Internet. TCP/IP has four (or five, depending on the textbook) layers: Network Access (often split into Physical + Data Link), Internet, Transport, Application. The five upper OSI layers (Session, Presentation, Application) are folded into TCP/IP's single Application layer.
GATE often asks: "Which of the following functions is performed by the Session layer of OSI?" โ the trick is that TCP/IP has no separate Session layer, but OSI does. Always check whether the question is asking about OSI specifically.
Worked example
Question: A user opens https://www.iitb.ac.in/ in a browser. At which OSI layer does the TLS handshake conceptually belong, and what is the PDU at the layer below the one that adds the IP header?
Solution:
Step 1: Identify TLS. TLS provides encryption and authentication; conceptually it sits at the Presentation layer (Layer 6) in OSI treatments, though in practice it runs between TCP and HTTP.
Step 2: Identify the layer that adds the IP header. That is the Network layer (Layer 3).
Step 3: The layer above Network is Transport (Layer 4). Its PDU is the segment (TCP) or datagram (UDP).
Conclusion: TLS belongs to Layer 6 (Presentation); the PDU at the layer above the one adding the IP header is a segment (or datagram).
Common misconception
Common misconception: "Routers operate at Layer 4 because they understand ports." False. Routers operate at Layer 3 (Network), making forwarding decisions on IP addresses. Devices that inspect port numbers (firewalls doing port-based filtering, NAT gateways doing PAT) operate at Layer 4 functionally, but classical routing is purely Layer 3.
Common misconception 2: "ARP is a Layer 3 protocol because it deals with IP." Wrong โ ARP resolves an IP address to a MAC address and operates between Layers 2 and 3. Most textbooks place it at Layer 2.5 or call it a Layer 2 protocol; GATE generally accepts "Layer 2" for ARP unless the option explicitly mentions Layer 2.5.
Common misconception 3: "HTTPS is its own layer." HTTPS is HTTP running over TLS. HTTP is Layer 7; TLS encryption is Layer 6 conceptually. They are not separate layers.
Real-world example
Real-world example: When a Bengaluru student opens NPTEL videos on a college Wi-Fi network, the request travels down through HTTP (L7), TLS encryption (L6), TCP segmentation (L4), IP routing (L3), Wi-Fi 802.11 framing (L2), and the radio signal itself (L1). At the NPTEL server, the same headers are stripped in reverse order until the application reads the original request. This invisible journey is what the OSI model formalises.
| Layer | Number | Name | PDU | Example protocols / devices |
|---|---|---|---|---|
| 7 | Application | Data | HTTP, FTP, DNS, SMTP, SSH | |
| 6 | Presentation | Data | TLS, MIME, JPEG, ASCII | |
| 5 | Session | Data | NetBIOS, RPC | |
| 4 | Transport | Segment / Datagram | TCP, UDP, SCTP | |
| 3 | Network | Packet | IP, ICMP, OSPF; Routers | |
| 2 | Data Link | Frame | Ethernet, PPP, 802.11; Switches, Bridges | |
| 1 | Physical | Bit | Cables, hubs, repeaters, NIC PHY |
- โ- OSI has seven layers, standardised by ISO in 1984 (ISO 7498).
- โ- Bottom-up mnemonic: "Please Do Not Throw Sausage Pizza Away."
- โ- Top-down mnemonic: "All People Seem To Need Data Processing."
- โ- Layers 1โ3 are media/hardware; layers 5โ7 are host/software; layer 4 bridges them.
- โ- PDU sequence (bottom-up): Bit โ Frame โ Packet โ Segment โ Data.
- โ- Encapsulation adds a header at each layer going down; decapsulation strips them going up.
- โ- TCP/IP collapses OSI's Session, Presentation and Application into one Application layer.
- โ- Routers: Layer 3; Switches: Layer 2; Hubs: Layer 1; Gateways: typically all seven layers.
OSI = "Please Do Not Throw Sausage Pizza Away" (bottom-up) for layer names.
PDU = "Boys From Pakistan Send Data" โ Bits, Frames, Packets, Segments, Data.
And remember: "4 is the bridge" โ Transport sits exactly in the middle, between media and host concerns.
- โ- Seven layers, each with a defined responsibility and a named PDU.
- โ- Memorise both the layer order and the PDU sequence; GATE tests both directly.
- โ- Place common protocols correctly: IP at L3, TCP/UDP at L4, HTTP/DNS at L7.
- โ- Distinguish OSI from TCP/IP; GATE questions specify which model they mean.
Layer Functions Cheat-Sheet
Every time you send a WhatsApp message, your phone quietly does seven jobs in a strict order, each handled by a different layer of the OSI model. Knowing which layer does what is one of the highest-yield ideas in GATE CSE โ it appears almost every year as a one-mark direct match or as an embedded fact inside a longer scenario question.
Definition: The OSI (Open Systems Interconnection) model is a seven-layer conceptual framework, defined by ISO, that splits the work of network communication into clean, independent stages so that hardware and software from different vendors can interoperate.
The seven layers, from bottom to top, are Physical, Data Link, Network, Transport, Session, Presentation and Application. Each layer talks only to the one directly above and below it on the same machine, and to its peer layer on the remote machine. This isolation is what makes the model so powerful: you can swap copper for fibre at layer 1 without touching your browser, or change from TCP to QUIC at layer 4 without rewriting your routing tables.
Physical Layer (Layer 1)
The physical layer is the world of voltages, light pulses, radio waves and connectors. It does not understand the meaning of bits โ it only transmits raw bits across a medium. Its responsibilities are bit transmission, encoding (Manchester, NRZ, etc.), signalling, bit rate, network topology (bus, star, ring, mesh) and the mechanical and electrical specifications of cables and pins (think RJ-45, CAT-6, RS-232).
Why it matters: every higher-layer feature ultimately rides on what the physical layer can sustain. If layer 1 gives you 100 Mbps with 1% bit error rate, no clever protocol above it can magically deliver gigabit reliability.
Data Link Layer (Layer 2)
The data link layer turns the raw bit stream into reliable frames between two directly connected nodes. Its job covers framing, MAC (physical) addressing, error detection using CRC, flow control, and medium access control.
It is internally split into two sublayers:
- LLC (Logical Link Control) โ handles flow and error control, multiplexes upper-layer protocols.
- MAC (Media Access Control) โ decides who gets to transmit on a shared medium (Ethernet's CSMA/CD, Wi-Fi's CSMA/CA).
Common exam keyword: CRC at the Data Link layer, not the network layer.
Network Layer (Layer 3)
The network layer is where end-to-end logical addressing (IP) lives. It is responsible for routing packets across multiple networks, path determination, fragmentation and reassembly when an MTU shrinks, and congestion control at the IP level. Protocols: IP, ICMP, ARP, RIP, OSPF, BGP.
Real-world example: when you open flipkart.com from a hostel Wi-Fi in Patna, a router in Mumbai decides the next hop towards Flipkart's data centre purely using layer-3 IP routing tables.
Transport Layer (Layer 4)
The transport layer provides end-to-end delivery between processes. It does segmentation of application data into segments, port addressing (so port 443 reaches HTTPS), and offers two flavours:
- TCP โ connection-oriented, reliable, in-order, with flow and error control.
- UDP โ connectionless, fast, no delivery guarantee.
Why it matters: students often confuse "host-to-host" (network layer) with "process-to-process" (transport layer). Layer 3 gets the packet to the right machine; layer 4 gets it to the right application on that machine.
Session Layer (Layer 5)
The session layer manages dialogs between two applications. Its functions are session establishment, maintenance and teardown, dialog control (who speaks when โ full duplex, half duplex), synchronization and checkpointing (so a large file transfer can resume from the last checkpoint after a crash).
Exam tip: any mention of synchronization points, checkpointing, or dialog control almost always points to layer 5.
Presentation Layer (Layer 6)
The presentation layer is the network's translator. It handles data translation between formats (ASCII to EBCDIC), encryption and decryption, compression, and syntax/semantics of the data exchanged. SSL/TLS encryption is often associated here in the OSI mapping (in TCP/IP it sits between transport and application).
Memory hook: if the question mentions encryption or compression without giving any other clue, default to Presentation.
Application Layer (Layer 7)
The topmost layer is the user interface to network services. Protocols include HTTP, HTTPS, FTP, SMTP, POP3, IMAP, DNS, Telnet, SSH, SNMP. It does not mean the end-user application (Chrome, Gmail) itself โ those are above the OSI stack. Layer 7 protocols are what those applications speak.
| Layer | Key Function | Address / Unit | Classic Keyword |
|---|---|---|---|
| 7 Application | User-facing protocols | Data | HTTP, DNS, FTP |
| 6 Presentation | Encryption, compression, translation | Data | TLS, JPEG, ASCII |
| 5 Session | Dialog, checkpointing | Data | Sync points |
| 4 Transport | End-to-end, ports | Segment | TCP/UDP, port |
| 3 Network | Logical addressing, routing | Packet | IP, router |
| 2 Data Link | Framing, MAC, CRC | Frame | MAC, switch |
| 1 Physical | Bit transmission | Bit | Voltage, cable |
Common misconception: "Routers work at layer 2." Wrong โ switches and bridges operate at layer 2, routers operate at layer 3. Hubs and repeaters are layer 1 devices.
Question: At which OSI layer is port addressing performed?
Solution:
Step 1: Port numbers (like 80, 443, 22) identify the destination process on a host.
Step 2: Process-to-process delivery is the defining responsibility of the transport layer.
Conclusion: Port addressing is a Transport layer function.
- โ- Routing and logical (IP) addressing are done at the Network layer.
- โ- Framing, MAC addressing and CRC error detection live at the Data Link layer.
- โ- Port addressing and end-to-end reliability sit at the Transport layer.
- โ- Encryption and compression are Presentation layer responsibilities.
- โ- Dialog control and checkpointing are Session layer features.
- โ- The Data Link layer is split into LLC and MAC sublayers.
- โ- Physical layer deals only with raw bits, never their meaning.
"All People Seem To Need Data Processing" โ top to bottom: Application, Presentation, Session, Transport, Network, Data Link, Physical.
Reverse it for bottom-to-top: "Please Do Not Throw Sausage Pizza Away."
- โ- Each OSI layer has one signature responsibility โ match the keyword in the question to that signature.
- โ- Network = IP/routing, Transport = ports/TCP-UDP, Data Link = frames/MAC/CRC.
- โ- Encryption/compression = Presentation, dialogs/checkpoints = Session.
- โ- Hubs (L1), switches (L2), routers (L3) โ never mix these up in exams.
Devices vs Layers Mapping
Knowing which device operates at which layer is a frequent GATE question. Hub and Repeater operate at the Physical layer (Layer 1) - they regenerate/broadcast signals with no intelligence. Bridge and Switch operate at the Data Link layer (Layer 2) - they use MAC addresses and maintain forwarding tables. Router operates at the Network layer (Layer 3) - uses IP addresses for routing between networks. Gateway typically operates up to the Application layer (Layer 7), translating between different protocol stacks. A Layer-3 switch combines switching with routing. Memory aid: Hub=1, Switch/Bridge=2, Router=3, Gateway=all-the-way-up.
OSI Reference Model Layers โ Flashcards
Cover the answer, recall, then check. 12 cards on the OSI reference model for GATE CSE.
Q1. Name the 7 OSI layers bottom-to-top and a mnemonic.
A1. Physical, Data Link, Network, Transport, Session, Presentation, Application. Mnemonic (bottom-up): "Please Do Not Throw Sausage Pizza Away."
Q2. What is the PDU (data unit) at the Data Link, Network and Transport layers?
A2. Data Link โ frame; Network โ packet/datagram; Transport โ segment (TCP) / datagram (UDP). Physical โ bits.
Q3. Which OSI layer is the first true end-to-end (process-to-process) layer?
A3. The Transport layer. Layers 1โ3 are node-to-node/hop-by-hop; Transport (4) gives end-to-end delivery between source and destination hosts.
Q4. Which layer performs routing and logical (IP) addressing?
A4. The Network layer (Layer 3): path determination, logical addressing, fragmentation and congestion control. Routers operate here.
Q5. Which layer does framing, physical (MAC) addressing and error detection via CRC?
A5. The Data Link layer (Layer 2). Its sublayers are LLC (upper) and MAC (lower). Switches/bridges operate here.
Q6. In OSI, which layer(s) add a trailer, not just a header?
A6. Only the Data Link layer adds a trailer (for CRC/error detection) in addition to a header. All other layers add only a header.
Q7. Which OSI layer handles encryption, compression and data-format translation?
A7. The Presentation layer (Layer 6) โ syntax/semantics translation, encryption/decryption, and compression.
Q8. What does the Session layer (Layer 5) do?
A8. Dialog control (half/full duplex), synchronization, and checkpointing/recovery of long transfers.
Q9. At which layer do repeaters and hubs operate, and why are they "dumb"?
A9. Physical layer (Layer 1). They only regenerate/broadcast bits โ no addressing or filtering, so they extend a single collision domain.
Q10. Match device โ OSI layer: hub, switch, router, gateway.
A10. Hub โ Physical (L1); Switch/Bridge โ Data Link (L2); Router โ Network (L3); Gateway โ up to Application (L7), translating between protocol stacks.
Q11. Which layer provides flow control and error control end-to-end vs hop-by-hop?
A11. Hop-by-hop flow/error control is done at Data Link (L2); end-to-end flow/error control is done at Transport (L4).
Q12. Which layers are called "host layers" vs "media/network-support layers"?
A12. Transport, Session, Presentation, Application (L4โL7) are host layers; Physical, Data Link, Network (L1โL3) are network-support/media layers.
OSI Reference Model Layers โ Worked Example
Worked Example
Problem: Identify the OSI layer responsible for each function, and state the protocol data unit (PDU) name at the relevant layers:
(a) routing packets between different networks, (b) MAC addressing and framing, (c) reliable end-to-end delivery and flow control, (d) data encryption and format translation.
Solution:
Match each function to its OSI layer by the layer's defined responsibility:
(a) Routing between networks (choosing a path using logical/IP addresses) โ Network layer (Layer 3). Its PDU is the packet.
(b) MAC addressing and framing (node-to-node delivery on the same link) โ Data Link layer (Layer 2). Its PDU is the frame.
(c) Reliable end-to-end delivery with flow and error control (e.g. TCP) โ Transport layer (Layer 4). Its PDU is the segment.
(d) Encryption and data-format/representation translation โ Presentation layer (Layer 6).
For completeness, the Physical layer (Layer 1) transmits raw bits.
Answer: (a) Network (L3, packet); (b) Data Link (L2, frame); (c) Transport (L4, segment); (d) Presentation (L6).
- โ- OSI has 7 layers: Physical, Data Link, Network, Transport, Session, Presentation, Application (bottom to top).
- โ- PDUs by layer: bits (L1), frames (L2), packets (L3), segments (L4) โ a common exam distinction.
- โ- Match by responsibility: L2 = local link/MAC, L3 = end-to-end routing, L4 = reliable process-to-process transport.