Computer Networks Complete Guide 2026 — OSI Model, TCP/IP, Protocols Explained
🌐 Computer Networks — Complete Guide

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.

📅 Updated June 2026 🎯 GATE 7–8 Marks ⏱ ~14 Min Read 📡 OSI + TCP/IP 🔒 Security Basics
7
OSI Layers
4
TCP/IP Layers
7–8
GATE Marks
65535
Max Port No.
IPv4
32-bit Address

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).

7
Application Layer
Closest to the end-user. Provides network services to applications.
Protocols: HTTP, HTTPS, FTP, SMTP, DNS, Telnet, SSH
6
Presentation Layer
Data translation, encryption, compression. Ensures data is readable.
Formats: JPEG, MP4, SSL/TLS encryption, ASCII, EBCDIC
5
Session Layer
Opens, manages, and closes sessions between applications.
Protocols: NetBIOS, RPC, NFS, PPTP
4
Transport Layer
End-to-end delivery, segmentation, flow control, error recovery.
Protocols: TCP (reliable), UDP (fast), Port numbers
3
Network Layer
Logical addressing, routing packets across different networks.
Protocols: IP (IPv4/IPv6), ICMP, OSPF, BGP, RIP
2
Data Link Layer
Frames, MAC addresses, error detection within a local network.
Protocols: Ethernet, Wi-Fi (802.11), ARP, PPP, HDLC
1
Physical Layer
Raw bit transmission over physical medium (cables, wireless).
Hardware: Hubs, cables, fiber optics, radio waves, NIC
📌 Data Units per Layer (PDU — Protocol Data Unit) Layer 7–5: Data → Layer 4: Segment (TCP) / Datagram (UDP) → Layer 3: Packet → Layer 2: Frame → Layer 1: Bits. These names appear in GATE questions — know them cold.

🎯 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).

Classic GATE PatternWhich layer is responsible for end-to-end delivery and port addressing?
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 LayerEquivalent OSI LayersKey Protocols
ApplicationLayers 5 + 6 + 7HTTP, HTTPS, FTP, SMTP, DNS, SSH, Telnet
TransportLayer 4TCP, UDP
InternetLayer 3IP (IPv4/IPv6), ICMP, ARP, OSPF, BGP
Network Access (Link)Layers 1 + 2Ethernet, Wi-Fi, PPP, MAC addressing

4. OSI vs TCP/IP — Side-by-Side Comparison

🔷 OSI Model

Layers7
OriginISO, 1984
PurposeTheoretical reference
ReliabilityDefined at Layer 4
UsageTeaching, troubleshooting
Session layerSeparate (Layer 5)

🌐 TCP/IP Model

Layers4
OriginDARPA, 1970s
PurposePractical internet standard
ReliabilityDefined at Transport
UsageActual internet
Session layerMerged into Application

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.

FeatureTCPUDP
ConnectionConnection-oriented (3-way handshake)Connectionless — no setup
ReliabilityGuaranteed delivery + orderingNo guarantee — fire and forget
SpeedSlower — acknowledgements + retransmissionFaster — no overhead
Error checkingYes — checksum + ACK + retransmitChecksum only — no retransmission
Header size20 bytes8 bytes (much smaller)
Use casesWeb (HTTP), Email, File transfer (FTP), SSHVideo streaming, DNS, VoIP, Gaming, DHCP
GATE keyword“Reliable, ordered, connection-oriented”“Unreliable, connectionless, fast”
💡 TCP 3-Way Handshake — SYN, SYN-ACK, ACK TCP establishes connection via: (1) Client sends SYN, (2) Server responds SYN-ACK, (3) Client sends ACK. Connection is now established. This is the foundation of every HTTPS connection you make. GATE often asks the number of messages in a handshake — always 3.
  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
    
// TCP handshake — 3 messages to open, 4 to close

6. Key Application Layer Protocols

ProtocolPortLayerUse / DescriptionTransport
HTTP80ApplicationWeb pages — HyperText Transfer ProtocolTCP
HTTPS443ApplicationSecure HTTP — encrypted with TLS/SSLTCP
FTP20, 21ApplicationFile Transfer Protocol — upload/download filesTCP
SMTP25ApplicationSimple Mail Transfer Protocol — sending emailTCP
DNS53ApplicationDomain Name System — URL to IP address translationUDP (primarily)
DHCP67, 68ApplicationDynamic Host Config — auto-assigns IP addressesUDP
SSH22ApplicationSecure Shell — encrypted remote loginTCP
Telnet23ApplicationRemote login — unencrypted (old, insecure)TCP
ICMPNetworkInternet Control Message Protocol — ping, tracerouteNeither (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.

Frequent GATE Pattern“Which protocol uses UDP on port 53 and TCP on port 53?”
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)

AlgorithmDijkstra’s shortest path
KnowledgeComplete network topology
ProtocolOSPF, IS-IS
ConvergenceFast
ComplexityO(V² ) or O(E log V)

Distance Vector (Bellman-Ford)

AlgorithmBellman-Ford
KnowledgeNeighbor info only
ProtocolRIP
ConvergenceSlow (count to infinity)
ComplexityO(VE)

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.

ClassRangeDefault MaskCIDRHosts per Network
Class A1.0.0.0 – 126.255.255.255255.0.0.0/816,777,214
Class B128.0.0.0 – 191.255.255.255255.255.0.0/1665,534
Class C192.0.0.0 – 223.255.255.255255.255.255.0/24254
Class D224.0.0.0 – 239.255.255.255MulticastMulticast groups
📐 Subnetting Formula For a /n subnet mask: Number of hosts = 2^(32-n) − 2 (subtract 2 for network address and broadcast address). Example: /24 = 2^8 − 2 = 254 usable hosts. /28 = 2^4 − 2 = 14 usable hosts.
Computer NetworksOSI ModelTCP/IP TCP vs UDPHTTP HTTPSDNS Routing AlgorithmsSubnettingGATE CSE 2026

9. Frequently Asked Questions

Bottom to top: (1) Physical — raw bits; (2) Data Link — MAC, frames; (3) Network — IP, routing; (4) Transport — TCP/UDP, ports; (5) Session — session management; (6) Presentation — encryption, formatting; (7) Application — HTTP, DNS, FTP. Mnemonic: “Please Do Not Throw Sausage Pizza Away.”
TCP is connection-oriented, reliable, and guarantees delivery and ordering via acknowledgements and retransmission. UDP is connectionless, faster, but unreliable — no guarantee of delivery or order. TCP: web browsing, email, FTP, SSH. UDP: video streaming, DNS queries, online gaming, VoIP.
Computer Networks typically carries 7–8 marks in GATE CSE out of 100. Focus on: OSI vs TCP/IP model layers, TCP vs UDP, IP addressing and subnetting, routing algorithms (Dijkstra, Bellman-Ford), congestion control mechanisms, and application protocols (HTTP, DNS, FTP, SMTP) with their port numbers.
OSI has 7 layers (theoretical, published 1984 by ISO). TCP/IP has 4 layers (practical internet standard from 1970s). TCP/IP merges OSI’s layers 5+6+7 into one Application layer, and layers 1+2 into a Network Access layer. OSI is used for teaching; TCP/IP is what the actual internet runs on.
EP
EnggPrep.in Team

All our GATE and placement guides are designed for Indian CSE students — topic-level depth with exam-focused formatting.

🎓 More GATE CSE Resources

Check our complete GATE CSE preparation guide, subject-wise notes, and free engineering calculators.

GATE CSE Full Guide →

Leave a Comment