Computer Networks 2026 —
OSI Model, TCP/IP & Protocols Explained
Every layer of the OSI model, TCP vs UDP, DNS, HTTP, routing protocols, and subnetting — explained clearly with diagrams, code, and GATE exam tips.
Computer Networks is one of the most important and highest-scoring subjects for GATE CSE — typically worth 7–8 marks. It is also the foundation for cloud computing, cybersecurity, web development, and every networked system you will ever build. This guide takes you through the complete GATE syllabus — from the OSI model all the way to routing algorithms and subnetting.
Whether you are preparing for GATE, TCS/Infosys interviews, or just want to understand how the internet actually works, this is your one-stop reference.
1. What is Computer Networking?
A Computer Network is a collection of interconnected devices (computers, phones, servers, routers) that can exchange data. Networks range from a two-device Bluetooth connection to the entire global internet. To make communication between different devices and vendors possible, networking follows standardized models and protocols.
Two models define how networking works: the OSI (Open Systems Interconnection) model — a 7-layer theoretical framework for teaching and troubleshooting — and the TCP/IP model — a 4-layer practical model that the actual internet runs on. Both are essential for GATE CSE.
2. OSI Model — All 7 Layers Explained
The OSI model was published by the ISO in 1984. It divides network communication into 7 distinct layers, each responsible for a specific function. Data travels down the layers at the sender and up the layers at the receiver.
Remember all 7 layers with this mnemonic: “Please Do Not Throw Sausage Pizza Away” (Physical, Data Link, Network, Transport, Session, Presentation, Application — bottom to top).
🎯 GATE Exam Tip — OSI Layer
GATE tests which device operates at which layer: Hub → Layer 1. Switch → Layer 2. Router → Layer 3. Gateway → Layer 4–7. Also tested: which protocol belongs to which layer — DNS (L7), IP (L3), TCP (L4), Ethernet (L2).
Answer: Transport Layer (Layer 4) — TCP/UDP operate here with port numbers.
3. TCP/IP Model — The Internet’s Real Model
The TCP/IP model, developed by DARPA in the 1970s, predates OSI and is what the actual internet uses. It has 4 layers, collapsing OSI’s 7 into a simpler structure. OSI was designed as a teaching tool; TCP/IP was built to work.
| TCP/IP Layer | Equivalent OSI Layers | Key Protocols |
|---|---|---|
| Application | Layers 5 + 6 + 7 | HTTP, HTTPS, FTP, SMTP, DNS, SSH, Telnet |
| Transport | Layer 4 | TCP, UDP |
| Internet | Layer 3 | IP (IPv4/IPv6), ICMP, ARP, OSPF, BGP |
| Network Access (Link) | Layers 1 + 2 | Ethernet, Wi-Fi, PPP, MAC addressing |
4. OSI vs TCP/IP — Side-by-Side Comparison
🔷 OSI Model
🌐 TCP/IP Model
5. TCP vs UDP — The Most Important Comparison
TCP and UDP are the two Transport Layer protocols. Understanding when to use each is critical for GATE, interviews, and real-world development.
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented (3-way handshake) | Connectionless — no setup |
| Reliability | Guaranteed delivery + ordering | No guarantee — fire and forget |
| Speed | Slower — acknowledgements + retransmission | Faster — no overhead |
| Error checking | Yes — checksum + ACK + retransmit | Checksum only — no retransmission |
| Header size | 20 bytes | 8 bytes (much smaller) |
| Use cases | Web (HTTP), Email, File transfer (FTP), SSH | Video streaming, DNS, VoIP, Gaming, DHCP |
| GATE keyword | “Reliable, ordered, connection-oriented” | “Unreliable, connectionless, fast” |
TCP 3-Way Handshake:
CLIENT SERVER
| |
|------- SYN (seq=x) ------->| Step 1: Client initiates
| |
|<-- SYN-ACK (seq=y, ack=x+1)| Step 2: Server acknowledges
| |
|------- ACK (ack=y+1) ----->| Step 3: Client confirms
| |
| ===== Connection Open =====|
TCP 4-Way Termination: FIN → ACK → FIN → ACK
6. Key Application Layer Protocols
| Protocol | Port | Layer | Use / Description | Transport |
|---|---|---|---|---|
| HTTP | 80 | Application | Web pages — HyperText Transfer Protocol | TCP |
| HTTPS | 443 | Application | Secure HTTP — encrypted with TLS/SSL | TCP |
| FTP | 20, 21 | Application | File Transfer Protocol — upload/download files | TCP |
| SMTP | 25 | Application | Simple Mail Transfer Protocol — sending email | TCP |
| DNS | 53 | Application | Domain Name System — URL to IP address translation | UDP (primarily) |
| DHCP | 67, 68 | Application | Dynamic Host Config — auto-assigns IP addresses | UDP |
| SSH | 22 | Application | Secure Shell — encrypted remote login | TCP |
| Telnet | 23 | Application | Remote login — unencrypted (old, insecure) | TCP |
| ICMP | — | Network | Internet Control Message Protocol — ping, traceroute | Neither (IP-based) |
🎯 GATE Exam Tip — Protocol Port Numbers
Port numbers appear in GATE every year. Memorize: HTTP=80, HTTPS=443, FTP=21, SSH=22, Telnet=23, SMTP=25, DNS=53, DHCP=67/68. DNS uses UDP for queries (fast) but TCP for zone transfers (large data). This detail is a common GATE trap.
Answer: DNS — UDP for regular queries, TCP for zone transfers (responses >512 bytes).
7. Routing Algorithms
Routing is how packets find their path from source to destination across a network. Two major routing algorithm categories are tested in GATE:
Link State (Dijkstra)
Distance Vector (Bellman-Ford)
8. IP Addressing & Subnetting
IPv4 uses a 32-bit address, written as 4 octets (e.g. 192.168.1.1). The address is split into a Network part and a Host part by the subnet mask. CIDR notation (/24, /16, /8) tells you how many bits are the network part.
| Class | Range | Default Mask | CIDR | Hosts per Network |
|---|---|---|---|---|
| Class A | 1.0.0.0 – 126.255.255.255 | 255.0.0.0 | /8 | 16,777,214 |
| Class B | 128.0.0.0 – 191.255.255.255 | 255.255.0.0 | /16 | 65,534 |
| Class C | 192.0.0.0 – 223.255.255.255 | 255.255.255.0 | /24 | 254 |
| Class D | 224.0.0.0 – 239.255.255.255 | Multicast | — | Multicast groups |
9. Frequently Asked Questions
🎓 More GATE CSE Resources
Check our complete GATE CSE preparation guide, subject-wise notes, and free engineering calculators.
GATE CSE Full Guide →