Network Layers,
Functions & Protocols
The OSI & TCP/IP models, every layer’s job, key protocols, ports and devices — explained simply and built for quick revision.
Start HereThe Two Network Models
Data travels across a network through a stack of layers. Two models describe this: the 7-layer OSI model (theoretical reference) and the 4-layer TCP/IP model (used on the real Internet).
| Feature | OSI Model | TCP/IP Model |
|---|---|---|
| Number of layers | 7 | 4 (sometimes shown as 5) |
| Developed by | ISO (Intl. Org. for Standardization) | DARPA / US DoD |
| Nature | Theoretical / reference model | Practical model (runs the Internet) |
| Layers (top → down) | Application, Presentation, Session, Transport, Network, Data Link, Physical | Application, Transport, Internet, Network Access |
Bottom → top: “Please Do Not Throw Sausage Pizza Away.”
The Core TableOSI Layers — Function, Protocols & Devices
This single table answers the majority of OSI questions. Learn each layer’s one main job, its key protocols, and the device that works there.
| # | Layer | Main Job | Key Protocols | Devices |
|---|---|---|---|---|
| 7 | Application | User services — web, email, file transfer | HTTP/HTTPS, FTP, SMTP, DNS, SNMP, Telnet | Gateway, Proxy |
| 6 | Presentation | Translation, encryption, compression | SSL/TLS, JPEG, MPEG, ASCII | Software only |
| 5 | Session | Start, manage & end sessions; sync | NetBIOS, RPC, PPTP | Software only |
| 4 | Transport | End-to-end delivery, segmentation, flow control | TCP, UDP | Firewall, Load Balancer |
| 3 | Network | Logical (IP) addressing & routing | IP, ICMP, ARP, IGMP, OSPF | Router, Layer-3 Switch |
| 2 | Data Link | Physical (MAC) addressing, framing, error detection | Ethernet, PPP, HDLC, Frame Relay | Switch, Bridge, NIC, Wi-Fi AP |
| 1 | Physical | Raw bits, cables, electrical signals | Standards (RS-232, etc.) | Hub, Repeater, Cable, Modem |
Transport LayerTCP vs UDP
The Transport layer’s two protocols are a guaranteed exam question. TCP is reliable but slower; UDP is fast but offers no guarantee.
| Point | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connection-less |
| Reliability | Reliable (acknowledgements) | Unreliable (no ACK) |
| Speed | Slower | Faster |
| Handshake | 3-way (SYN, SYN-ACK, ACK) | None |
| Flow control | Yes (sliding window) | No |
| Used for | Web, email, file transfer | Video/voice streaming, DNS, online games |
Memorize ThisCommon Protocols & Port Numbers
Port numbers are frequently asked one-mark questions. A port number is 16 bits (range 0–65535).
| Protocol | Port | Use |
|---|---|---|
| FTP | 20, 21 | File transfer |
| SSH | 22 | Secure remote login |
| Telnet | 23 | Remote login (insecure) |
| SMTP | 25 | Sending email |
| DNS | 53 | Domain name → IP |
| DHCP | 67, 68 | Auto-assign IP address |
| HTTP | 80 | Web (insecure) |
| POP3 | 110 | Receiving email |
| IMAP | 143 | Receiving email (sync) |
| SNMP | 161 | Monitor network devices |
| HTTPS | 443 | Secure web (uses SSL/TLS) |
Layer 3IP Addressing & Key Protocols
The Network layer adds logical addresses (IP) and decides the route packets take across networks.
- IP Address: Logical address of a device. IPv4 = 32 bits (e.g., 192.168.1.1), IPv6 = 128 bits.
- MAC Address: Physical 48-bit address burned into the NIC (used for local delivery).
- ARP resolves IP → MAC · RARP resolves MAC → IP.
- DNS resolves a domain name → IP address.
- DHCP automatically assigns IP addresses to devices.
- ICMP reports errors & tests connectivity — used by the ping command.
- IP is connection-less and performs packet fragmentation.
- RIP & OSPF are routing protocols (RIP uses hop count; OSPF uses link state).
HardwareNetworking Devices by Layer
Knowing which device works at which layer is a repeated favourite. Remember: the higher the device works, the “smarter” it is.
| Device | Layer | What It Does |
|---|---|---|
| Hub | Layer 1 (Physical) | Broadcasts data to all ports (no intelligence). |
| Repeater | Layer 1 (Physical) | Regenerates/boosts a weak signal. |
| Switch | Layer 2 (Data Link) | Forwards frames using MAC addresses (intelligent). |
| Bridge / NIC | Layer 2 (Data Link) | Connects/segments networks; NIC gives a device its MAC. |
| Router | Layer 3 (Network) | Connects different networks; routes packets by IP. |
| Gateway | Layer 7 (Application) | Connects two different network architectures/protocols. |
Practice Bank30 MCQs with Explanations
Cover the answer and test yourself first. Questions follow recent exam trends.
- A. 5
- B. 6
- C. 7
- D. 8
- A. Transport
- B. Presentation
- C. Application
- D. Network
- A. 5
- B. 4
- C. 6
- D. 7
- A. Data Link
- B. Network
- C. Transport
- D. Session
- A. Internet
- B. Transport
- C. Application
- D. Network Access
- A. Network
- B. Transport
- C. Data Link
- D. Session
- A. Data Link
- B. Network
- C. Physical
- D. Transport
- A. Data Link
- B. Network
- C. Session
- D. Application
- A. Session
- B. Transport
- C. Presentation
- D. Application
- A. Presentation
- B. Session
- C. Data Link
- D. Transport
- A. Transport
- B. Presentation
- C. Network
- D. Physical
- A. Network
- B. Transport
- C. Data Link
- D. Physical
- A. UDP
- B. TCP
- C. IP
- D. ARP
- A. UDP
- B. TCP
- C. ICMP
- D. DHCP
- A. DNS
- B. DHCP
- C. ARP
- D. ICMP
- A. HTTP
- B. UDP
- C. ICMP
- D. RARP
- A. DNS
- B. DHCP
- C. FTP
- D. ICMP
- A. Receiving email
- B. Sending email
- C. File transfer
- D. Remote login
- A. FTP
- B. DNS
- C. DHCP
- D. SNMP
- A. HTTP
- B. FTP
- C. SMTP
- D. ARP
- A. RIP
- B. SMTP
- C. FTP
- D. DHCP
- A. 80
- B. 443
- C. 21
- D. 110
- A. 20
- B. 23
- C. 53
- D. 110
- A. 20 & 21
- B. 23
- C. 53
- D. 80
- A. 32 bits
- B. 64 bits
- C. 128 bits
- D. 256 bits
- A. 8 bits
- B. 16 bits
- C. 32 bits
- D. 64 bits
- A. Layer 1
- B. Layer 2
- C. Layer 3
- D. Layer 7
- A. Layer 2
- B. Layer 3
- C. Layer 4
- D. Layer 7
- A. Layer 1
- B. Layer 2
- C. Layer 3
- D. Layer 7
- A. Hub
- B. Switch
- C. Repeater
- D. Gateway
Print & MemorizeQuick Revision Sheet
Models
- OSI = 7 layers (ISO) · TCP/IP = 4 layers (DARPA).
- OSI order (top→down): Application, Presentation, Session, Transport, Network, Data Link, Physical.
- Mnemonic: “All People Seem To Need Data Processing.”
Layer → Function
- Encryption → L6 · Sessions → L5 · Segmentation/end-to-end → L4.
- Routing & IP addressing → L3 · MAC & framing → L2 · Raw bits → L1.
Protocols & Addressing
- TCP = reliable, 3-way handshake · UDP = fast, no guarantee.
- ARP: IP→MAC · DNS: name→IP · DHCP: auto-IP · ICMP: ping/errors.
- IPv4 = 32-bit · IPv6 = 128-bit · MAC = 48-bit · Port = 16-bit.
Ports
- FTP 20/21 · SSH 22 · Telnet 23 · SMTP 25 · DNS 53 · DHCP 67/68.
- HTTP 80 · POP3 110 · IMAP 143 · SNMP 161 · HTTPS 443.
Devices
- Hub → L1 · Switch → L2 · Router → L3 · Gateway → L7.
