UNIT 5: COMPUTER NETWORKS - COMPREHENSIVE NOTES
I. NETWORK ARCHITECTURE & FUNDAMENTALS
A. Reference Models
ISO-OSI Reference Model (7 Layers)
A theoretical framework for network communication, where each layer provides services to the layer above it.
| Layer | Function | Protocol/Device Examples |
|---|---|---|
| 7. Application | User interface, network services | HTTP, SMTP, DNS |
| 6. Presentation | Data translation, encryption, compression | SSL/TLS, JPEG, MPEG |
| 5. Session | Dialog control, synchronization | NetBIOS, RPC |
| 4. Transport | End-to-end reliability, flow control | TCP, UDP |
| 3. Network | Routing, logical addressing | IP, ICMP, routers |
| 2. Data Link | Framing, physical addressing, error control | Ethernet, PPP, switches, bridges |
| 1. Physical | Bit transmission over medium | RJ45, fiber, repeaters, hubs |
TCP/IP Protocol Suite (4/5-Layer Model)
Practical model that underpins the modern Internet.
| Layer | Function | Key Protocols |
|---|---|---|
| Application | Process-to-process communication | HTTP, FTP, SMTP, DNS |
| Transport | Host-to-host connectivity | TCP (reliable), UDP (unreliable) |
| Internet | Routing, logical addressing | IP, ICMP, ARP |
| Link (Network Access) | Framing, physical addressing | Ethernet, Wi-Fi (802.11), PPP |
[!TIP] OSI vs. TCP/IP Key Difference: OSI is a prescriptive reference model (what should be done). TCP/IP is a descriptive protocol suite (what is done). TCP/IP's layers are not strictly aligned with OSI's.
Comparison: OSI vs. TCP/IP Model
| Feature | OSI Model | TCP/IP Model |
|---|---|---|
| Layers | 7 distinct layers | 4 (or 5) layers |
| Design | Theoretical, protocol-independent | Practical, protocol-centric |
| Communication | Supports both connection-oriented & connectionless | Primarily connectionless at Network layer |
| Implementation | Not widely implemented in full | Universal Internet standard |
| Layer 3 & 4 | Network & Transport are separate | Internet (Network) & Transport are separate |
Connection-Oriented vs. Connectionless Services
| Aspect | Connection-Oriented | Connectionless |
|---|---|---|
| Path | Dedicated path established before data transfer | No dedicated path; each packet independent |
| Ordering | Guaranteed in-order delivery | No guarantee |
| Reliability | High (ACKs, retransmission) | Low (best-effort) |
| Overhead | Higher (setup/teardown) | Lower |
| Example | TCP (Telephony analogy) | UDP, IP (Postal analogy) |
Service Primitives
Operations a layer provides to the layer above it:
-
REQUEST: Entity asks for service.
-
INDICATION: Event notification to the entity.
-
RESPONSE: Entity provides answer to indication.
-
CONFIRM: Result of a request returned to requester.
B. Network Types & Topologies
Network Types by Scale
| Type | Scale | Example |
|---|---|---|
| PAN | Personal (10m) | Bluetooth, USB |
| LAN | Local (building/campus) | Ethernet, Wi-Fi |
| MAN | Metropolitan (city) | Cable TV network |
| WAN | Wide (country/globe) | Internet, leased lines |
Physical Topologies
| Topology | Description | Advantages | Disadvantages |
|---|---|---|---|
| Bus | Single central cable (backbone) | Simple, cheap, easy to extend | Single point of failure, performance degrades with nodes |
| Star | All nodes connect to central hub/switch | Easy to install/isolate failures, central management | Hub/switch failure brings down network |
| Ring | Nodes form closed loop, token passing | Deterministic access, no collisions | Complex, single node failure can break ring |
| Mesh | Every node connected to every other | High reliability, redundancy | Expensive, complex cabling |
| Tree | Hierarchical (bus of stars) | Scalable, easy to manage | Root node failure affects entire network |
C. Switching Techniques
| Technique | Principle | Advantages | Disadvantages |
|---|---|---|---|
| Circuit Switching | Dedicated physical path established before communication (e.g., telephone). | Guaranteed bandwidth, low delay once setup. | Inefficient (idle capacity wasted), setup delay. |
| Packet Switching | Data split into packets; each routed independently. <br> - Datagram: No connection, each packet routed separately. <br> - Virtual Circuit: Logical path established. | Efficient bandwidth use, robust to failures. | Variable delay, packets may arrive out-of-order. |
| Message Switching | Store-and-forward of entire messages (not packets). | Can prioritize messages, handle different speeds. | High delay, requires large buffers. |
[!TIP] Key Exam Point: Packet Switching (Datagram) is the foundation of the Internet (IP). Virtual Circuits are used in Frame Relay & ATM.
II. PHYSICAL LAYER & TRANSMISSION MEDIA
A. Guided Media (Wired)
| Media | Description | Use Case |
|---|---|---|
| Twisted Pair (UTP/STP) | 2 insulated copper wires twisted. STP has shielding. | Ethernet (10/100BASE-T), telephone lines. |
| Coaxial Cable | Central conductor, insulator, shield, jacket. | Cable TV, older Ethernet (10BASE2/5). |
| Fiber Optic | Glass/plastic fiber, light pulses. <br> - Single-mode: One light ray, long distance. <br> - Multi-mode: Multiple rays, shorter distance. | Backbones, high-speed links (Gigabit Ethernet). |
B. Unguided Media (Wireless)
| Media | Characteristics |
|---|---|
| Radio Waves | Omnidirectional, penetrate walls. Used for Wi-Fi, cellular, Bluetooth. |
| Microwaves | Directional, line-of-sight. Used for satellite, point-to-point links. |
| Infrared | Very short range, line-of-sight, cannot penetrate walls. Used for remote controls. |
C. Signal & Transmission Concepts
-
Bandwidth (Hz): Frequency range a medium can support.
-
Data Rate (bps): Bits transmitted per second.
-
Throughput (bps): Actual achieved data rate (affected by protocol overhead, congestion).
-
Propagation Delay (s): Time for a bit to travel from source to destination.
Propagation Delay = Distance / Propagation Speed.
Key Formulas
- Nyquist Theorem (Noiseless Channel):
$$ \text{Max Bit Rate} = 2 \times B \times \log_2(M) $$
Where `B` = bandwidth (Hz), `M` = number of signal levels.
> \boxed{\text{Increasing signal levels } M \text{ increases data rate but reduces noise immunity.}}
- Shannon's Theorem (Noisy Channel):
$$ C = B \log_2(1 + \text{SNR}) $$
Where `C` = channel capacity (bps), `SNR` = signal-to-noise ratio (linear, not dB).
> \boxed{\text{Defines the absolute maximum theoretical data rate for a noisy channel.}}
D. Multiplexing
| Technique | Principle |
|---|---|
| FDM | Different signals on different frequency bands (radio, TV). |
| TDM | Different signals on different time slots. <br> - Synchronous: Fixed time slots, even if no data. <br> - Statistical: Dynamic slot allocation based on demand. |
| WDM | FDM applied to fiber optics (different wavelengths). |
E. Line Coding (Digital-to-Digital)
| Scheme | Encoding Rule | Features |
|---|---|---|
| Unipolar | All positive (e.g., 0=0V, 1=+V) |
Simple, has DC component. |
| Polar | 0=-V, 1=+V (NRZ) |
No DC component, but no synchronization. |
| Manchester | 0: High-to-Low transition mid-bit. 1: Low-to-High transition. |
Self-clocking, used in Ethernet (10BASE-T). |
| Differential Manchester | Mid-bit transition always. 0: transition at start, 1: no transition. |
More robust to noise, used in Token Ring. |
| Bipolar (AMI) | 0=0V, 1=alternating +V/-V. |
No DC, but long 0s cause sync loss. |
| 4B/5B | 4 data bits encoded as 5-bit code with no more than one 0 between 1s. |
Used in Fast Ethernet (100BASE-TX) for clock recovery. |
III. DATA LINK LAYER
A. Functions & Services
Framing
-
Byte/Flag Oriented: Use special flag byte (e.g.,
01111110in HDLC) to delimit frame. Requires Byte Stuffing (insertESCafter flag). -
Bit Oriented: Use bit pattern flag (e.g.,
01111110). Requires Bit Stuffing (insert0after five consecutive1s).
Error Detection & Correction
| Method | Principle | Capability |
|---|---|---|
| Parity Check | Add 1 bit to make number of 1s even/odd. |
Detects single-bit errors only. |
| Checksum | Sum of data words (1's complement), complement at sender. | Detects errors in burst, not robust. |
| CRC (Cyclic Redundancy Check) | Polynomial division modulo-2. Data D(x) divided by generator G(x), remainder R(x) is CRC. Transmit D(x) * x^r + R(x). |
Powerful, detects all single/double-bit errors, odd number of errors, burst errors < r+1 bits. |
| Hamming Code | Adds redundant bits at specific positions (powers of 2). Can correct single-bit errors. | d_min = 3 → 1-bit correction. |
[!TIP] CRC Calculation Steps:
- Append
rzeros to data (wherer= degree ofG(x)).
- Perform modulo-2 division (XOR) by
G(x).
- Remainder
R(x)is the CRC.
- Transmit original data +
R(x).
Flow & Error Control (ARQ)
| Protocol | Sender Window | Receiver Window | ACK Type | Retransmission |
|---|---|---|---|---|
| Stop-and-Wait ARQ | 1 | 1 | Individual | Timeout for current frame. |
| Go-Back-N (GBN) | N (max) |
1 | Cumulative (ACK k = all up to k-1 received) |
All frames from lost frame onward. |
| Selective Repeat (SR) | N (max) |
N (max) |
Individual (ACK for each) | Only lost/corrupted frames. |
| Hybrid ARQ | Combines FEC (Forward Error Correction) & ARQ. |
Window Size Constraints:
-
GBN:
N ≤ 2^k - 1(wherek= sequence number bits). -
SR:
N ≤ 2^{k-1}.
B. Data Link Protocols
HDLC (High-Level Data Link Control)
-
Frame Format: Flag
01111110, Address, Control, Info, FCS, Flag. -
Modes: Normal (NRM), Asynchronous (ARM). Uses Supervisory (S) frames for ACK/NAK.
-
Operation: Bit stuffing, CRC-32, supports full-duplex.
PPP (Point-to-Point Protocol)
-
Phases: Link Establishment (LCP), Authentication (PAP/CHAP), Network Layer Protocol (NCP), Termination.
-
Frame Format: Flag, Address (
11111111), Control (00000011), Protocol (e.g.,0x0021for IP), Data, FCS, Flag. -
Features: Simple, supports multiple protocols, authentication.
SLIP (Serial Line IP)
- Limitations: No error detection, no authentication, only supports IP, requires static IPs. Obsolete, replaced by PPP.
C. Sliding Window Protocols
Stop-and-Wait
-
Sender sends 1 frame, waits for ACK.
-
Efficiency:
η = T_Tx / (T_Tx + 2 * T_prop + T_ack). -
Problem: Inefficient for long propagation delays (high
T_prop).
Go-Back-N (GBN)
-
Sender can have up to
Nunacknowledged frames. -
Receiver only accepts in-order frames; out-of-order frames are discarded.
-
Timeout: Retransmit all frames from lost frame onward.
-
Utilization:
U = N / (1 + 2a)wherea = T_prop / T_Tx.
Selective Repeat (SR)
-
Sender & receiver windows of size
N. -
Receiver buffers out-of-order frames.
-
Individual ACKs; sender retransmits only missing frames.
-
Window Size Rule:
N ≤ 2^{k-1}to avoid sequence number ambiguity.
Piggybacking
- Attaching ACK to a data frame going in the reverse direction (instead of separate ACK frame). Improves efficiency in full-duplex.
D. Bit/Byte Stuffing
-
Bit Stuffing (HDLC-like): After flag
01111110, insert0after five consecutive1s in data. At receiver, remove0after five1s. -
Byte Stuffing (PPP-like): Use
ESCcharacter (0x7D). If data byte equalsFLAGorESC, insertESCbefore it. Receiver removesESC.
IV. MEDIUM ACCESS CONTROL (MAC) SUB-LAYER
A. Channel Allocation
| Type | Method | Example |
|---|---|---|
| Static | FDM, TDM, CDMA (code division) | Traditional telephone, cellular (3G). |
| Dynamic | Random Access (ALOHA, CSMA), Controlled Access (Polling, Token), Channelization. | Ethernet (CSMA/CD), Wi-Fi (CSMA/CA), Token Ring. |
B. Random Access (Contention) Protocols
| Protocol | Principle | Throughput (Max) | Vulnerable Period |
|---|---|---|---|
| Pure ALOHA | Transmit anytime; collision → retransmit after random delay. | S = G * e^{-2G} → ~18.4% at G=0.5 |
2 * T_Tx |
| Slotted ALOHA | Transmit only at slot start (synchronized). | S = G * e^{-G} → ~36.8% at G=1 |
T_Tx |
| 1-Persistent CSMA | Sense channel; if idle, transmit immediately; if busy, sense continuously. | Better than ALOHA, but collisions possible during propagation. | Propagation delay (T_prop) |
| Non-Persistent CSMA | Sense; if busy, wait random time, then sense again. | Reduces collisions, but may cause idle slots. | T_prop |
| P-Persistent CSMA | For slotted channels: if idle, transmit with prob p, defer to next slot with 1-p. |
Balances collision & idle probability. | T_prop |
| CSMA/CD | Ethernet. Sense, transmit, detect collision during transmission, abort, send jam signal, binary exponential backoff. | Efficiency ≈ 1 / (1 + 5.44a) where a = T_prop / T_Tx. |
2 * T_prop (round-trip) |
| CSMA/CA | Wi-Fi. Avoid collisions: RTS/CTS optional, DIFS/SIFS timing, NAV (virtual carrier sense). | Lower efficiency than CSMA/CD due to avoidance overhead. | N/A (avoids, doesn't detect) |
[!TIP] CSMA/CD Minimum Frame Size: Must be at least
2 * T_prop * Bandwidthto ensure collision detection before transmission ends.
$$ \text{Min Frame Size} \geq 2 \times \text{Propagation Delay} \times \text{Bandwidth} $$
C. Controlled Access Protocols
-
Reservation: Stations reserve future slots.
-
Polling: Central controller (master) polls each station.
-
Token Passing: Token (control frame) passed sequentially; only token holder can transmit.
D. IEEE 802 Standards & LAN Technologies
| Standard | Name | Access Method | Topology | Key Features |
|---|---|---|---|---|
| 802.3 | Ethernet | CSMA/CD | Bus/Star | Dominant LAN tech. Frame: Preamble, Dest/Src MAC, Type, Data, FCS. |
| 802.4 | Token Bus | Token Passing | Logical Bus, Physical Star | Used in manufacturing. |
| 802.5 | Token Ring | Token Passing | Ring | 4/16 Mbps, active monitor, beaconing on failure. |
| 802.11 | Wi-Fi | CSMA/CA | Star (with AP) | Hidden/exposed terminal problem. Uses RTS/CTS. |
| FDDI | Fiber Distributed Data Interface | Token Passing | Dual Ring (primary/secondary) | 100 Mbps, high reliability, uses fiber. |
E. Bridging & Switching
| Device | Layer | Function | Key Mechanism |
|---|---|---|---|
| Hub | 1 (Physical) | Repeater, broadcasts to all ports. | No intelligence. |
| Bridge | 2 (Data Link) | Connects LAN segments, filters traffic. | Transparent Bridging: Learns MACs, forwards/floods, filters. |
| Switch | 2 (Data Link) | Multi-port bridge, full-duplex per port. | Builds MAC address table (source MAC → port). Ages unused entries. |
| Router | 3 (Network) | Connects networks, routes based on IP address. | Uses routing tables, handles broadcast containment. |
| Gateway | 5-7 (Application) | Protocol conversion between dissimilar networks. | E.g., Email gateway, VoIP gateway. |
[!TIP] Switch vs. Bridge: Switch is essentially a multi-port bridge with higher port density, typically supporting full-duplex and higher speeds.
Remote Bridging
Connecting geographically separated LANs via WAN links (e.g., leased lines). Challenges: High latency breaks token passing/TCP efficiency, spanning tree may block redundant links, expensive.
V. NETWORK LAYER
A. Functions & Design Issues
-
Forwarding: Move packet from input to output link (per-hop, in router).
-
Routing: Determine end-to-end path (routing algorithms).
-
Congestion Control: Prevent overload (network layer: packet discarding, load shedding).
-
Fragmentation & Reassembly: Break packets to fit MTU (Maximum Transmission Unit) of outgoing link. Fields in IP header: Identification, Flags (DF, MF), Fragment Offset.
B. Routing Algorithms
Optimality Principle
Any optimal path from A to B consists of optimal subpaths from any intermediate node X to B.
Shortest Path Routing (Dijkstra's Algorithm - Link State)
-
Start with source node
S. Setcost(S)=0,cost(others)=∞. -
Find node
Xwith smallest tentative cost not yet permanent. -
Make
cost(X)permanent. -
Update costs of neighbors
YofX: ifcost(X) + cost(X,Y) < cost(Y), updatecost(Y)and set predecessor. -
Repeat until all nodes permanent or destination found.
Advantages: Fast convergence, global view. Limitations: High overhead (link-state advertisements), memory intensive.
Distance Vector Routing (Bellman-Ford)
-
Each node maintains a distance vector (cost to all destinations via each neighbor).
-
Periodically (or on change), send entire vector to direct neighbors.
-
On receipt, apply Bellman-Ford equation:
$$ D_x(y) = \min_v \{ c(x,v) + D_v(y) \} $$
(Cost from `x` to `y` = min over neighbors `v` of [cost(x,v) + cost(v to y)]).
- Update own table if a better path found.
Problems: Count-to-infinity, routing loops, slow convergence.
Solutions: Split horizon (don't advertise route back to source), poison reverse (advertise infinite metric back), triggered updates.
Comparison: Link State vs. Distance Vector
| Feature | Link State (Dijkstra) | Distance Vector (Bellman-Ford) |
|---|---|---|
| Information | Complete map of network. | Only own cost to neighbors + neighbors' vectors. |
| Convergence | Fast (O(n²) packets). | Slow (count-to-infinity). |
| Overhead | High initially, low later. | Low per packet, but periodic full updates. |
| Robustness | Can fail if LSAs lost. | Can loop during convergence. |
| Scalability | Better for large networks (with hierarchy). | Suitable for small/medium networks. |
C. IP Addressing (IPv4)
Classful Addressing (Legacy)
| Class | First Bit(s) | Network ID | Host ID | Default Mask | Range |
|---|---|---|---|---|---|
| A | 0 |
1st octet | last 3 octets | 255.0.0.0 |
1.0.0.0 - 126.255.255.255 |
| B | 10 |
1st 2 octets | last 2 octets | 255.255.0.0 |
128.0.0.0 - 191.255.255.255 |
| C | 110 |
1st 3 octets | last octet | 255.255.255.0 |
192.0.0.0 - 223.255.255.255 |
| D | 1110 |
- | - | - | Multicast (224.0.0.0 - 239.255.255.255) |
| E | 1111 |
- | - | - | Experimental (240.0.0.0 - 255.255.255.255) |
Limitations: Wasted addresses (large blocks for small orgs), no flexibility, routing table explosion.
Subnetting
-
Goal: Divide a large network (
/n) into smaller logical sub-networks. -
Process:
-
Determine number of subnets needed (
S). Findssuch that2^s ≥ S. New mask = originaln + s. -
List all subnets by incrementing the subnet part.
-
For each subnet: Subnet ID (all host bits
0), Valid Host Range (Subnet ID+1 to Broadcast-1), Broadcast Address (all host bits1).
-
-
Example:
192.168.10.0/24into 4 subnets.-
s=2(since2^2=4). New mask:/26or255.255.255.192. -
Increment =
2^{32-26} = 64. -
Subnets:
192.168.10.0/26,192.168.10.64/26,192.168.10.128/26,192.168.10.192/26. -
First subnet hosts:
192.168.10.1-192.168.10.62, broadcast192.168.10.63.
-
CIDR (Classless Inter-Domain Routing)
-
Notation:
a.b.c.d/n(prefix lengthn). -
Aggregation/Supernetting: Combine multiple contiguous prefixes into one larger prefix to reduce routing table size.
- Example:
192.168.0.0/24,192.168.1.0/24,192.168.2.0/24,192.168.3.0/24→192.168.0.0/22.
- Example:
ARP (Address Resolution Protocol)
-
Need: Map IP address (Layer 3) to MAC address (Layer 2) on a local network.
-
Operation:
-
Host
Awith IPIP_Awants to send toIP_Bon same LAN. -
Achecks ARP cache. If miss, broadcasts ARP Request: "Who hasIP_B? TellIP_A(MAC_A)." -
Host
B(withIP_B) unicasts ARP Reply: "IP_Bis atMAC_B" toA. -
AcachesIP_B → MAC_Bmapping.
-
RARP (Reverse ARP)
- Diskless machine (no storage) knows its MAC, needs IP. Broadcasts RARP request. RARP server replies with IP.
ICMP (Internet Control Message Protocol)
-
Role: Network layer protocol for error reporting & diagnostics (not for user data).
-
Common Messages:
-
Destination Unreachable (Type 3): No route, port unreachable.
-
Time Exceeded (Type 11): TTL expired (used by
traceroute). -
Echo Request/Reply (Type 8/0): Used by
ping. -
Redirect (Type 5): Suggest better route.
-
D. IPv6
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Size | 32 bits | 128 bits |
| Header | Variable (20-60 bytes), complex | Fixed 40 bytes, simplified (no IHL, Flags, Fragmentation fields) |
| Fragmentation | Done by routers & hosts | Only by source host (router doesn't fragment). |
| Addresses | Classful/CIDR, broadcast | No broadcast, anycast, multicast. |
| Autoconfig | Manual/DHCP | Stateless Address Autoconfiguration (SLAAC). |
| Security | Optional (IPsec) | IPsec mandatory (but not always used). |
| Header Extension | Options field (rare) | Extension headers (Hop-by-Hop, Routing, Fragment, etc.). |
| Notation | Dotted decimal (192.168.1.1) |
Hexadecimal (2001:0db8:85a3::8a2e:0370:7334) |
IPv6 Address Types:
-
Unicast: Single interface.
-
Multicast: Group of interfaces.
-
Anycast: Nearest of multiple interfaces (same address).
Transition Strategies:
-
Dual Stack: Host/run both IPv4 & IPv6.
-
Tunneling: Encapsulate IPv6 packet inside IPv4 packet.
-
Header Translation: Convert IPv6 header to IPv4 (and vice versa).
VI. TRANSPORT LAYER
A. Functions & Services
-
Process-to-Process Communication: Uses port numbers (16-bit) to identify application layer processes.
-
Multiplexing/Demultiplexing: Multiple application processes share one transport connection.
-
Connection Control: Connection-oriented (TCP) vs. Connectionless (UDP).
-
Flow Control: Receiver-driven (prevents sender from overwhelming receiver). TCP uses sliding window.
-
Congestion Control: Network-wide issue (prevent overload). Open-loop (prevent) vs. Closed-loop (detect & recover).
-
Load Shedding: Discarding packets during congestion.
Congestion Control Techniques
| Technique | Principle |
|---|---|
| Leaky Bucket | Output rate fixed; bursty input smoothed. Can lose packets if bucket full. |
| Token Bucket | Tokens accumulate at rate r. To send n bytes, need n tokens. Allows burst up to b tokens. More flexible than leaky bucket. |
[!TIP] Leaky Bucket vs. Token Bucket: Leaky bucket enforces strict average rate. Token bucket allows bursts up to a limit, then enforces average rate.
B. User Datagram Protocol (UDP)
-
Connectionless, unreliable, no-frills.
-
Header (8 bytes): Source Port, Dest Port, Length, Checksum.
-
Applications: DNS, streaming media, VoIP, TFTP, SNMP (where speed > reliability).
C. Transmission Control Protocol (TCP)
-
Connection-oriented, reliable, byte-stream.
-
Header Format (20-60 bytes):
-
Source/Dest Port: 16 bits each.
-
Sequence Number: Byte number of first byte in segment.
-
Acknowledgment Number: Next expected byte number (cumulative ACK).
-
Flags (6 bits): URG, ACK, PSH, RST, SYN, FIN.
-
Window Size: Receiver's available buffer (flow control).
-
Checksum: Covers header+data+pseudo-header.
-
Urgent Pointer: Valid if URG set.
-
Options: MSS, window scaling, timestamps.
-
Connection Management
-
Three-Way Handshake (Establishment):
-
A → B:SYN=1, seq=x -
B → A:SYN=1, ACK=1, seq=y, ack=x+1 -
A → B:ACK=1, seq=x+1, ack=y+1
Why 3-way? Prevents old duplicate connection initiations (security). SYN consumes a sequence number.
-
-
Four-Way Handshake (Termination - Graceful Release):
-
A → B:FIN=1, seq=u -
B → A:ACK=1, ack=u+1(may still send data) -
B → A:FIN=1, seq=v -
A → B:ACK=1, ack=v+1
Why 4-way? TCP is full-duplex. Each direction closed independently.
TIME_WAITstate (2MSL) ensures last ACK received & old duplicates expire. -
TCP Congestion Control
-
Slow Start:
cwndstarts at1 MSS. On each ACK,cwnd += 1 MSS. Exponential growth until ssthresh. -
Congestion Avoidance: After
cwnd ≥ ssthresh,cwnd += 1 MSSper RTT (linear growth). -
Fast Retransmit: On 3 duplicate ACKs, retransmit missing segment without waiting for timeout. Set
ssthresh = cwnd / 2,cwnd = ssthresh + 3 MSS. -
Fast Recovery: After fast retransmit, for each duplicate ACK,
cwnd += 1 MSS. On new ACK (for new data), setcwnd = ssthresh(exit fast recovery).
D. Comparison: TCP vs. UDP
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Guaranteed (ACKs, retransmission) | No guarantee |
| Ordering | In-order delivery | No ordering |
| Congestion Control | Yes (Slow Start, etc.) | No |
| Header Size | 20-60 bytes | 8 bytes |
| Flow Control | Yes (sliding window) | No |
| Speed | Slower (overhead) | Faster |
| Use Cases | Web (HTTP), Email (SMTP), File Transfer (FTP) | DNS, VoIP, streaming, gaming |
VII. APPLICATION LAYER
A. Domain Name System (DNS)
-
Need: Map human-readable domain names (
www.rgpvonline.com) to IP addresses. -
Hierarchical Structure:
-
Root Servers (13 sets): Top-level.
-
TLD Servers:
.com,.org,.in, country-code TLDs. -
Authoritative Servers: Hold records for specific domains.
-
Local DNS Resolver: Usually at ISP or organization.
-
-
Resolution Process:
-
Resolver queries root server for
comTLD server. -
Queries
comTLD server forrgpvonline.comauthoritative server. -
Queries authoritative server for
www.rgpvonline.comA record. -
Returns IP to resolver → client.
-
Iterative Query: Server returns best known answer (referral to another server).
-
Recursive Query: Server takes full responsibility to find answer (usually from resolver to local server).
-
-
Caching: Resolver caches answers with TTL (Time-To-Live). Servers also cache.
-
Resource Records (RR):
A(IPv4),AAAA(IPv6),CNAME(alias),MX(mail server),NS(name server).
B. Electronic Mail (Email)
Architecture
-
User Agent (UA): Email client (Outlook, Thunderbird).
-
Message Transfer Agent (MTA): Mail server (Sendmail, Postfix). SMTP between MTAs.
-
Mail Delivery Agent (MDA): Delivers to user's mailbox (e.g.,
procmail).
Protocols
-
SMTP (Simple Mail Transfer Protocol):
-
Push protocol (port 25). ASCII command/response.
-
ESMTP (Extended SMTP): Adds
STARTTLS, authentication, MIME. -
Limitation: Body must be 7-bit ASCII.
-
-
MIME (Multipurpose Internet Mail Extensions):
-
Encodes non-ASCII (binary, images) into 7-bit ASCII using
Base64orquoted-printable. -
Defines multipart messages (attachments).
-
-
POP3 (Post Office Protocol v3):
- Pull protocol (port 110). Download-and-delete model. Simple, no remote mailbox management.
-
IMAP (Internet Message Access Protocol):
- Pull protocol (port 143/993). Remote mailbox management. Messages stay on server; can create folders, search.
C. World Wide Web (WWW) & HTTP
-
HTTP (Hypertext Transfer Protocol):
-
Request/Response model (client-server).
-
Stateless: Server does not retain user state between requests (cookies/sessions used for state).
-
Methods:
GET(retrieve),POST(submit data),PUT(upload),DELETE. -
Status Codes:
1xx(informational),2xx(success),3xx(redirect),4xx(client error),5xx(server error). -
Connections: Non-persistent (one request/response per TCP connection) vs. Persistent (HTTP/1.1 default, multiple requests per connection).
-
-
HTTPS: HTTP over TLS/SSL (port 443). Provides encryption, server authentication (certificates).
D. Other Application Layer Protocols
-
SNMP (Simple Network Management Protocol):
-
Manager (NMS) ↔ Agent (managed device).
-
MIB (Management Information Base): Database of managed objects.
-
Operations:
GET,SET,GETNEXT,TRAP(asynchronous notification).
-
-
FTP (File Transfer Protocol):
-
Separate control (port 21) & data (port 20) connections.
-
Active Mode: Server connects to client's data port.
-
Passive Mode: Client connects to server's data port (firewall-friendly).
-
-
Cryptography (Basic Concepts):
-
Symmetric: Same key for encryption/decryption (AES, DES). Fast, key distribution problem.
-
Asymmetric: Public/private key pair (RSA). Slow, solves key distribution.
-
Digital Signature: Hash of message encrypted with sender's private key. Provides authentication, integrity, non-repudiation.
-
Certificate: Digital document binding public key to entity, signed by CA (Certificate Authority).
-
VIII. PRACTICAL PROBLEMS & CALCULATIONS
A. Nyquist Theorem
Problem: Noiseless channel, bandwidth
B = 3 kHz,M = 4signal levels. Find max bit rate.
Solution:
$$ R_{max} = 2 \times 3000 \times \log_2(4) = 6000 \times 2 = 12000 \text{ bps} = 12 \text{ kbps} $$
If
Mincreases,R_maxincreases logarithmically.
B. CRC Computation
Problem: Data
D(x) = x^5 + x^4 + x^2 + 1(binary1101011011), GeneratorG(x) = x^3 + x + 1(binary1011). Find transmitted codeword.
Solution:
- Data:
1101011011(10 bits). Append3zeros →1101011011000.
- Divide by
1011(modulo-2):
1100010101 (quotient)
---------------
1011 ) 1101011011000
1011
-----
1111
1011
-----
1000
1011
-----
0110
0000
----
1101
1011
-----
0110
0000
-----
1100
1011
-----
0110 → Remainder R(x) = 110
- CRC =
110.
- Transmitted Codeword: Original data + CRC =
1101011011+110=1101011011110.
C. Subnetting
Problem: Divide
192.168.10.0/24into 4 subnets.
Solution:
- Need
2^s ≥ 4→s=2. New mask:/26=255.255.255.192.
- Block size =
2^{32-26} = 64.
- Subnets:
* **Subnet 0:** `192.168.10.0/26` <br> Hosts: `192.168.10.1` - `192.168.10.62` <br> Broadcast: `192.168.10.63`
* **Subnet 1:** `192.168.10.64/26` <br> Hosts: `192.168.10.65` - `192.168.10.126` <br> Broadcast: `192.168.10.127`
* **Subnet 2:** `192.168.10.128/26` <br> Hosts: `192.168.10.129` - `192.168.10.190` <br> Broadcast: `192.168.10.191`
* **Subnet 3:** `192.168.10.192/26` <br> Hosts: `192.168.10.193` - `192.168.10.254` <br> Broadcast: `192.168.10.255`
D. Throughput & Efficiency
-
Pure ALOHA Throughput:
S = G * e^{-2G}. MaxS ≈ 0.184atG=0.5. -
Slotted ALOHA Throughput:
S = G * e^{-G}. MaxS ≈ 0.368atG=1. -
Stop-and-Wait Efficiency:
$$ \eta = \frac{T_{Tx}}{T_{Tx} + 2 T_{prop} + T_{ack}} $$
For high bandwidth-delay product, `η` is very low.
- Go-Back-N Utilization:
$$ U = \frac{N}{1 + 2a} \quad \text{where } a = T_{prop} / T_{Tx} $$
Max `N` limited by sequence number space.
E. CSMA/CD Minimum Frame Size
Problem: LAN length
2 km, bandwidth10^7 bps, signal speed2×10^8 m/s. Find min frame size.
Solution:
- Round-trip propagation delay:
T_{prop} = Distance / Speed = 2000 / (2×10^8) = 10^{-5} s.
- Round-trip time:
2 * T_{prop} = 2 × 10^{-5} s.
- Min frame transmission time must ≥ round-trip time:
`T_Tx ≥ 2 * T_prop`
`Frame Size / Bandwidth ≥ 2 × 10^{-5}`
`Frame Size ≥ 10^7 × 2 × 10^{-5} = 200 bits`.
Answer: Minimum frame size = 200 bits (or 25 bytes).
F. TDM Frame Size & Data Rate
Problem: Multiplex 3 channels (2 kbps, 3 kbps, 4 kbps) using synchronous TDM. Find frame size (bits) and data rate.
Solution:
- Each channel gets 1 time slot per frame.
- To avoid waste, each slot must carry enough bits for the slowest channel? No, in synchronous TDM, slots are fixed size. Typically, slot size = bits per sample. If channels are byte-oriented, slot size might be 8 bits.
- Assumption: Each channel provides 1 byte (8 bits) per frame.
- Frame Size: 3 slots × 8 bits = 24 bits.
- Frame Rate: Must match fastest channel's sampling rate. Fastest channel = 4 kbps. If 1 byte/sample → 4000 samples/sec → 4000 frames/sec.
- Data Rate:
Frame Rate × Frame Size = 4000 × 24 = 96,000 bps = 96 kbps.
G. TCP Header Analysis (Hex Dump)
Dump:
05320017 00000001 00000000 500207FF 00000000
Break into 32-bit words:
05320017→ Source Port:0x0532= 1330 decimal. Dest Port:0x0017= 23 decimal (Telnet).
00000001→ Seq = 1.
00000000→ Ack = 0 (no ACK, connection setup).
500207FF→ Header length:0x50= 80 bytes? No,0x50in hex = 80 decimal →80/4 = 20words → 20 bytes (standard). Flags:0x07=00000111→ URG, ACK, PSH set? Wait,0x07in lower byte? Actually,500207FF:50=HLEN,02=flags? Let's decode properly:
* First 4 bits: `5` → `5 * 4 = 20` bytes.
* Next 6 bits: Reserved (0).
* Next 6 bits: Flags. `02` in hex = `00000010` binary → only **SYN** flag set? Actually, byte `02` = `00000010`, so bit positions: URG(0), ACK(0), PSH(0), RST(0), SYN(1), FIN(0). So **SYN** set.
* Window size: `0x07FF` = **2047**.
00000000→ Checksum, Urgent Pointer (0).
Summary:
- Source Port: 1330
- Dest Port: 23 (Telnet)
- Seq: 1
- Ack: 0
- Header Len: 20 bytes
- Flags: SYN (connection request)
- Window Size: 2047
IX. SHORT NOTE TOPICS (FREQUENT 3-4m QUESTIONS)
ARP, RARP, and ICMP Protocols
-
ARP: Maps IP → MAC on local LAN. Uses broadcast request, unicast reply. Cache entries timeout.
-
RARP: Diskless machine (knows MAC) gets IP from RARP server. Obsolete (replaced by BOOTP/DHCP).
-
ICMP: Network layer error/diagnostic protocol.
ping(Echo Request/Reply),traceroute(Time Exceeded), Destination Unreachable.
PPP, SLIP, and HDLC Protocols
| Protocol | Layer | Frame Format | Features |
|---|---|---|---|
| HDLC | Data Link | Flag, Addr, Ctrl, Info, FCS, Flag | Bit stuffing, synchronous, supports full-duplex. |
| PPP | Data Link | Flag, Addr (ff), Ctrl (03), Protocol, Data, FCS, Flag | Byte stuffing, authentication (PAP/CHAP), multiprotocol, phases (LCP/NCP). |
| SLIP | Data Link | Simple framing, no flags | No error detection, no authentication, only IP, requires static IP. Obsolete. |
Guided and Unguided Transmission Media
-
Guided: Copper wire (Twisted Pair, Coaxial), Fiber Optic. Signals confined to physical path.
-
Unguided: Radio, Microwave, Infrared. Signals propagate through air/space, no physical conductor.
Virtual LAN (VLAN)
-
Need: Segment a physical LAN into multiple broadcast domains for security, performance, management.
-
Operation: Switch ports assigned to VLANs. Frames tagged with VLAN ID (IEEE 802.1Q header). Traffic confined to same VLAN unless via router.
-
Benefits: Reduced broadcast traffic, improved security, flexible user grouping.
HTTP
-
Application layer protocol for World Wide Web.
-
Request/Response model. Stateless (cookies/sessions for state).
-
Methods:
GET,POST,PUT,DELETE. -
Status Codes:
200 OK,404 Not Found,500 Server Error. -
HTTPS: HTTP over TLS/SSL (port 443).
UDP
-
Connectionless, unreliable, no-frills transport protocol.
-
Header: Source Port, Dest Port, Length, Checksum (optional in IPv4, mandatory in IPv6).
-
Use: DNS, streaming, VoIP, where speed > reliability or application handles reliability.
Cryptography
-
Symmetric: Single shared key (AES, DES). Fast, key distribution issue.
-
Asymmetric: Public/private key pair (RSA). Slow, solves key distribution.
-
Digital Signature: Hash(message) encrypted with sender's private key. Verifies sender, integrity, non-repudiation.
-
Certificate: Digital document (signed by CA) binding public key to entity.
FDM and TDM
-
FDM: Different signals on different frequencies (radio channels, cable TV).
-
TDM: Different signals on different time slots. Synchronous (fixed slots), Statistical (dynamic allocation).
Token Ring & FDDI
-
Token Ring (802.5): Ring topology, token passing access. Single token circulates; only holder transmits. Beaconing for ring recovery. 4/16 Mbps.
-
FDDI: High-speed (100 Mbps) dual-ring (primary/secondary) using fiber. Token passing like Token Ring but faster, more reliable (dual-ring fault tolerance).
SMTP
-
Push protocol for email transfer between MTAs (port 25).
-
ASCII command/response (e.g.,
HELO,MAIL FROM,RCPT TO,DATA). -
ESMTP: Extensions (
STARTTLS,AUTH,SIZE). -
Limitation: 7-bit ASCII only → MIME used for binary.
Congestion Control
-
Need: Prevent network overload (packet loss, high delay).
-
Network Layer: Packet discarding, load shedding.
-
Transport Layer (TCP): Closed-loop feedback control.
-
Slow Start: Exponential
cwndgrowth. -
Congestion Avoidance: Linear
cwndgrowth. -
Fast Retransmit/Recovery: React to duplicate ACKs.
-
-
Techniques: Leaky Bucket, Token Bucket (traffic shaping).
DNS
-
Hierarchical, distributed database mapping domain names ↔ IP addresses.
-
Components: Root servers, TLD servers, Authoritative servers, Resolvers.
-
Resolution: Iterative/recursive queries, caching with TTL.
-
RR Types:
A,AAAA,CNAME,MX,NS.
SNMP
-
Network management protocol (application layer).
-
Architecture: Manager (NMS) ↔ Agent (managed device).
-
MIB: Database of managed objects (variables).
-
Operations:
GET,SET,GETNEXT,TRAP(asynchronous alert).
MLMA (Multiple Access with Collision Avoidance)
-
Refers to CSMA/CA (used in IEEE 802.11 Wi-Fi).
-
Principle: Avoid collisions rather than detect them (hard in wireless).
-
Mechanisms:
-
Physical Carrier Sense: CCA (Clear Channel Assessment).
-
Virtual Carrier Sense: NAV (Network Allocation Vector) from RTS/CTS.
-
RTS/CTS: Optional handshake to reserve channel for long frames.
-
DIFS/SIFS: Inter-frame spacing priorities.
-
Broadcast and Multicast Routing
-
Broadcast Routing: Send to all nodes in network.
-
Flooding: Simple but causes broadcast storm.
-
Reverse Path Forwarding (RPF): Router forwards broadcast only if received on shortest path from source.
-
-
Multicast Routing: Send to group of interested receivers.
-
DVMRP: Distance Vector Multicast Routing Protocol (uses reverse path).
-
PIM: Protocol Independent Multicast (Sparse/Dense modes).
-
MOSPF: Multicast extension to OSPF.
-
Frame Relay (Protocol Architecture)
-
Layer 2 (Data Link) WAN protocol, packet-switched.
-
Connection-oriented (virtual circuits: PVCs/SVCs).
-
Functions:
-
Frame Format: Flag, DLCI (virtual circuit ID), Control, Data, FCS, Flag.
-
No error correction (only error detection, relies on higher layers).
-
Congestion Control: Discard (DE bit), congestion notification (FECN/BECN bits).
-
-
Devices: DTE (customer router), DCE (switch).
Router and Gateways
-
Router (Layer 3): Connects different networks (IP subnets). Forwards based on IP address. Uses routing tables. Contains broadcast domains.
-
Gateway (Layer 5-7): Protocol converter between dissimilar networks (e.g., Email gateway, VoIP gateway, application-level gateway).
Connection Establishment and Release (TCP)
-
Establishment (3-Way Handshake):
-
A → B:SYN=1, seq=x -
B → A:SYN=1, ACK=1, seq=y, ack=x+1 -
A → B:ACK=1, seq=x+1, ack=y+1
Why 3-way? Prevents old duplicate SYN attacks. SYN consumes a sequence number.
-
-
Release (4-Way Handshake - Graceful):
-
A → B:FIN=1, seq=u -
B → A:ACK=1, ack=u+1(may still send data) -
B → A:FIN=1, seq=v -
A → B:ACK=1, ack=v+1
Why 4-way? TCP full-duplex; each direction closed independently.
TIME_WAIT(2MSL) ensures last ACK delivered & old duplicates expire. -
Electronic Mail Working
-
Composition: User writes email in UA (User Agent).
-
Transfer: UA hands message to MTA (Mail Transfer Agent) via SMTP.
-
Routing: MTAs use DNS to find destination domain's MX record (mail server). SMTP hops between MTAs.
-
Delivery: Destination MTA stores message in user's mailbox (via MDA).
-
Retrieval: User retrieves via POP3 (download-and-delete) or IMAP (remote management).
QoS Techniques in Internetworking
-
Need: Provide preferential treatment (low delay, jitter, loss) for real-time traffic (VoIP, video).
-
Techniques:
-
Scheduling: Priority queuing, Weighted Fair Queuing (WFQ).
-
Traffic Shaping: Leaky Bucket, Token Bucket (smooth bursty traffic).
-
Resource Reservation: RSVP (Resource Reservation Protocol) - hosts request QoS from routers.
-
DiffServ (Differentiated Services): Per-hop behavior (PHB) based on DSCP bits in IP header. Simple, scalable.
-
IntServ (Integrated Services): Per-flow state & reservation (not scalable for Internet).
-
Leaky Bucket vs. Token Bucket
| Feature | Leaky Bucket | Token Bucket |
|---|---|---|
| Output Rate | Constant (fixed). | Burst-capable (up to b tokens). |
| Burst Handling | Discards excess packets. | Allows bursts up to token accumulation. |
| Analogy | Water drips steadily from hole. | Tokens accumulate; need tokens to send data. |
| Use Case | Smoothing, policing. | Traffic shaping, allowing some burstiness. |
Pure vs. Slotted ALOHA
| Feature | Pure ALOHA | Slotted ALOHA |
|---|---|---|
| Transmission Timing | Anytime. | Only at slot boundaries (synchronized). |
| Vulnerable Period | 2 * T_Tx |
T_Tx |
| Max Throughput | ~18.4% at G=0.5 |
~36.8% at G=1 |
| Efficiency | Lower | Double that of Pure ALOHA. |
| Complexity | Simpler (no sync needed). | Requires global clock synchronization. |