Back to Study Material GATE Exam

Computer Networks

A computer network is a collection of interconnected computing devices that exchange data using shared protocols. Understanding networks requires grasping ...

Computer Networks

Fundamentals of Computer Networking

A computer network is a collection of interconnected computing devices that exchange data using shared protocols. Understanding networks requires grasping both the physical mechanisms of data transmission and the layered software protocols that organize communication into manageable abstractions.

The OSI model organizes network communication into seven layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application. Each layer provides services to the layer above and uses services from the layer below, communicating with its peer layer on the remote side through protocol data units (PDUs). In practice, the TCP/IP model consolidates these into four layers: Network Access (Physical plus Data Link), Internet (Network), Transport, and Application.

The Physical layer deals with raw bit transmission over a medium — encoding, modulation, and signaling. Bandwidth (in Hertz) measures the range of frequencies a channel supports; throughput (in bits per second) measures actual data delivery rate. Shannon's theorem gives the maximum theoretical channel capacity: C = B log2(1 + S/N), where B is bandwidth in Hz and S/N is the signal-to-noise ratio. Nyquist's theorem applies to noise-free channels: maximum data rate = 2B log2 V, where V is the number of discrete signal levels.

The Data Link layer handles framing, error detection and correction, and medium access control (MAC). Error detection techniques include parity bits, checksums, and CRC (Cyclic Redundancy Check). CRC is the most powerful and is tested in GATE: given a message and a generator polynomial, compute the remainder when the message (appended with r zeros, where r is the degree of the generator) is divided by the generator using binary (modulo-2) arithmetic. A received frame is error-free if dividing it by the generator yields zero.

The Network layer is responsible for logical addressing (IP addresses) and routing. Routers operate at this layer, maintaining routing tables and forwarding packets hop by hop toward their destination. The Transport layer provides end-to-end communication services: TCP offers reliable, connection-oriented delivery with flow control and congestion control; UDP offers unreliable, connectionless, low-overhead delivery for applications that prioritize speed.

IP Addressing, Subnetting, and Routing

IP addressing and subnetting are among the most practically important and GATE-testable topics in computer networks. IPv4 uses 32-bit addresses written in dotted-decimal notation. The address space is divided into a network portion and a host portion, determined by the subnet mask.

Classful addressing divided the address space into Class A (first bit 0, 8-bit network prefix), Class B (first two bits 10, 16-bit prefix), and Class C (first three bits 110, 24-bit prefix). Classless Inter-Domain Routing (CIDR) replaced classful addressing, allowing arbitrary prefix lengths written as IP-address/prefix-length (e.g., 192.168.1.0/24). The prefix length specifies how many bits constitute the network portion.

Subnetting divides a single network into smaller sub-networks by extending the prefix. Given 192.168.1.0/24, subnetting into /26 adds two bits to the prefix, creating 2 raised to 2 equals 4 subnets, each with 2 raised to 6 equals 64 addresses (62 usable, subtracting network and broadcast addresses). GATE presents subnetting problems requiring you to determine the subnet address, broadcast address, and valid host range for a given IP and mask.

Variable Length Subnet Masking (VLSM) allows different subnets to have different mask lengths, optimizing address space usage. Given a large block and requirements for subnets of different sizes, allocate subnets from largest to smallest to minimize wasted addresses.

Routing algorithms determine paths through networks. Link-state algorithms (like Dijkstra's algorithm, used in OSPF) have each router flood the entire network with information about its directly connected links, then each router independently computes the shortest path tree. Distance-vector algorithms (like Bellman-Ford, used in RIP) have each router share its routing table only with immediate neighbors, propagating reachability information iteratively. Distance-vector is simpler but slower to converge and susceptible to the count-to-infinity problem, which split horizon and poison reverse mitigate.

TCP, UDP, and Application Layer Protocols

TCP (Transmission Control Protocol) provides reliable, ordered, and error-checked delivery of a byte stream between applications. It achieves reliability through sequence numbers, acknowledgments, and retransmission. The three-way handshake establishes a connection: the client sends SYN, the server replies with SYN-ACK, and the client sends ACK. Connection termination uses a four-way exchange involving FIN and ACK packets.

TCP flow control uses a sliding window mechanism. The receiver advertises a receive window (rwnd) indicating how many bytes it can buffer. The sender may have at most rwnd unacknowledged bytes in flight. This prevents the sender from overwhelming the receiver's buffer. TCP congestion control manages the rate at which data enters the network to prevent buffer overflow in routers.

The congestion window (cwnd) limits the sender's rate independently of rwnd. Slow start initializes cwnd at one MSS (Maximum Segment Size) and doubles it every RTT until it reaches the slow start threshold (ssthresh). Upon congestion (detected by timeout or triple duplicate ACK), ssthresh is halved. After a timeout, cwnd resets to 1 MSS. After triple duplicate ACK (used in TCP Reno), cwnd is set to ssthresh and enters congestion avoidance, incrementing by one MSS per RTT.

UDP provides no reliability, ordering, or flow control. Its minimal overhead makes it suitable for real-time applications (voice and video streaming, gaming, DNS queries) where retransmission delay is worse than occasional loss.

DNS maps human-readable domain names to IP addresses using a distributed hierarchical database. A DNS query for www.example.com first contacts a root name server, which refers to the .com TLD server, which refers to example.com's authoritative server, which provides the IP address. Recursive queries ask the DNS resolver to follow the chain; iterative queries return referrals for the client to follow.

HTTP is stateless and uses a request-response model over TCP. HTTP/1.1 introduced persistent connections (reuse of TCP connection for multiple requests). HTTP/2 added multiplexing (multiple streams over one connection) and header compression. HTTPS wraps HTTP in TLS for encryption and authentication.