UNIT 2: COMPUTER NETWORKS - SHORT NOTES
I. NETWORK MODELS AND ARCHITECTURE
A. ISO-OSI Reference Model
Definition: A 7-layer theoretical framework for network communication, developed by ISO. Each layer provides services to the layer above it and uses services from the layer below.
| Layer | Function | Protocols/Devices |
|---|---|---|
| 7. Application | User interface, network services | HTTP, SMTP, DNS |
| 6. Presentation | Data translation, encryption, compression | SSL/TLS (security) |
| 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, error control, MAC | Ethernet, PPP, switches |
| 1. Physical | Bit transmission, physical media | Coaxial, fiber, hubs |
Service Primitives: Request, Indication, Response, Confirm (used between adjacent layers).
[!TIP] CRITIQUE: OSI is reference model only; no widespread real-world implementation. Protocols were designed after the model, causing mismatches. TCP/IP was developed concurrently and gained adoption.
B. TCP/IP Reference Model
Layers:
-
Network Interface (Link): Combines OSI's Physical & Data Link. Handles hardware addressing (MAC).
-
Internet: OSI's Network layer. Core protocol: IP. Handles logical addressing & routing.
-
Transport: OSI's Transport. Protocols: TCP (reliable), UDP (unreliable).
-
Application: Combines OSI's Application, Presentation, Session. Protocols: HTTP, DNS, SMTP.
Advantages: Practical, implemented first, scalable, protocol-independent. Disadvantages: Less rigid layering, no clear separation of services (e.g., no distinct session/presentation layers).
C. OSI vs. TCP/IP Comparison
| Feature | OSI Model | TCP/IP Model |
|---|---|---|
| Layers | 7 layers | 4 layers |
| Approach | Theoretical, general | Practical, protocol-centric |
| Communication | Supports both connection-oriented & connectionless (network layer) | Connectionless at network layer (IP); connection-oriented/less at transport (TCP/UDP) |
| Protocols | Protocols designed for model (e.g., CLNP, TP4) | Protocols designed first, model later (IP, TCP, UDP) |
| Implementation | Limited (mostly academic) | Universal (Internet) |
| Layer Mapping | Strict layer separation | Application layer combines OSI L5-L7 |
II. PHYSICAL LAYER AND TRANSMISSION MEDIA
A. Guided Transmission Media
| Media | Type | Characteristics | Use Case |
|---|---|---|---|
| Twisted Pair (UTP/STP) | Copper | UTP: Unshielded, cheap, up to 1 Gbps (Cat 5e/6). STP: Shielded, less EMI. | Ethernet (LAN), telephone |
| Coaxial Cable | Copper | Central conductor, insulation, shield. Higher bandwidth than TP, 10 Mbps - 10 Gbps. | Cable TV, older Ethernet (10BASE2/5) |
| Fiber Optic | Glass/Plastic | Single-mode: Small core, laser, long distance (>100 km). Multi-mode: Larger core, LED, shorter (<2 km). Very high bandwidth, immune to EMI. | Backbones, long-haul, high-speed LANs |
B. Unguided Transmission Media
| Media | Frequency | Characteristics |
|---|---|---|
| Radio Waves | kHz - GHz | Omni-directional, penetrate walls. Used for Wi-Fi, cellular, Bluetooth. |
| Microwave | GHz | Directional (line-of-sight), high bandwidth. Terrestrial (towers) & Satellite (geostationary). |
| Infrared | THz | Short range, line-of-sight, cannot penetrate walls. Used for remote controls, IrDA. |
C. Multiplexing Techniques
| Technique | Principle | Formula/Key Point |
|---|---|---|
| FDM | Different signals on different frequency bands. Guard bands prevent interference. | Total Bandwidth = Σ (Channel Bandwidth + Guard Band) |
| TDM | Different signals on different time slots in a frame. | Frame Rate = 1 / Frame Time. Data Rate = (bits per slot × number of slots) / frame time |
| WDM | Optical version of FDM. Multiple light wavelengths on same fiber. | Dense WDM (DWDM): 40+ wavelengths, 0.8 nm spacing. |
D. Line Coding Techniques
Maps binary data to physical signals.
| Scheme | 0 | 1 | Features |
|---|---|---|---|
| NRZ-L | Low | High | No transition at bit boundary, DC component, clock recovery issue. |
| NRZ-I | Transition | No transition | Transition at '1'. Better than NRZ-L. |
| RZ | Mid→Low, return to 0 | Mid→High, return to 0 | Self-clocking, but 2 signal changes/bit, wider bandwidth. |
| Manchester | Low→High | High→Low | Transition in middle of every bit. Self-clocking, used in Ethernet (10BASE-T). |
| Diff. Manchester | Transition at start of bit period | No transition at start | Transition always at bit start; '0' has mid-bit transition. More robust to noise. |
E. Transmission Capacity (Nyquist & Shannon)
1. Nyquist Theorem (Noiseless Channel):
Maximum bit rate = $$\displaystyle 2 \times B \times \log_2(M) $$
-
$B$ = Bandwidth (Hz)
-
$M$ = Number of discrete signal levels (voltage levels)
Example: $$\displaystyle B = 3 $$ kHz, $$\displaystyle M = 4 $$ (2 bits/level). Max rate = $$\displaystyle 2 \times 3000 \times \log_2(4) = 2 \times 3000 \times 2 = 12,000 $$ bps.
If $M$ increases to 8 (3 bits/level), rate = $$\displaystyle 2 \times 3000 \times 3 = 18,000 $$ bps.
2. Shannon's Theorem (Noisy Channel):
Channel Capacity $$\displaystyle C = B \log_2(1 + \text{SNR}) $$
-
$B$ = Bandwidth (Hz)
-
$\text{SNR}$ = Signal-to-Noise Ratio (linear, not dB)
Example: $$\displaystyle B = 4 $$ kHz, $$\displaystyle \text{SNR} = 1000 $$ (30 dB). $$\displaystyle C = 4000 \log_2(1001) \approx 4000 \times 9.97 \approx 39,880 $$ bps.
Key Relationship: Capacity increases with bandwidth and SNR. Nyquist gives an upper bound for a given $M$; Shannon gives the absolute maximum for a noisy channel.
III. DATA LINK LAYER
A. Functions & Services
-
Framing: Packet (network layer) → Frame (adds header/trailer).
-
Error Control: Detection (CRC) & Correction (Hamming).
-
Flow Control: Prevent fast sender from overwhelming slow receiver (Stop-and-Wait, Sliding Window).
-
Access Control: MAC protocols for shared media (Ethernet, Wi-Fi).
B. Error Detection & Correction
| Method | Mechanism | Pros | Cons |
|---|---|---|---|
| Parity | Single bit (even/odd). | Simple, detects single-bit errors. | Cannot correct, fails on even-bit errors. |
| Checksum | Sum of data words (1's complement). | Simple, catches many errors. | Weak, not as robust as CRC. |
| CRC | Polynomial division (modulo-2). Generator polynomial $G(x)$ divides $$\displaystyle D(x) \cdot x^r $$. | Very powerful, standard (Ethernet, Wi-Fi). | More complex computation. |
| Hamming Code | Adds redundant bits at power-of-2 positions. | Can correct single-bit errors. | Overhead, only for single-bit correction. |
CRC Computation Steps:
-
Append $r$ zeros to data $D(x)$ ($r$ = degree of $G(x)$).
-
Divide $$\displaystyle D(x) \cdot x^r $$ by $G(x)$ (modulo-2).
-
Remainder $R(x)$ is the CRC checksum.
-
Transmit $$\displaystyle D(x) \cdot x^r + R(x) $$.
-
Receiver divides by same $G(x)$. Zero remainder = no error.
Example (Jun 2025): $$\displaystyle D(x)=x^5+x^4+x^2+1 $$ (binary
110101), $$\displaystyle G(x)=x^3+x+1 $$ (binary1011). After division, remainder011. Codeword:110101011.
C. Data Link Protocols
| Protocol | Type | Frame Format Key | Features |
|---|---|---|---|
| HDLC | Bit-oriented | Flag 01111110, Address, Control, Info, FCS |
NRM, ABM, ARM modes. Used in legacy WANs. |
| PPP | Byte-oriented | Flag, Address, Control, Protocol, Data, FCS | LCP (link config), NCP (network layer protocol). Used in dial-up, DSL. |
| SLIP | Byte-oriented | END (0xC0), ESC (0xDB) |
Legacy. No error detection, no multi-protocol, no IP address negotiation. |
D. Framing & Stuffing
| Type | Delimiter | Stuffing Mechanism | Example |
|---|---|---|---|
| Character-Oriented (Byte Stuffing) | Special char (e.g., 0x07 for SYN) |
Insert escape char (0x1B) before delimiter in data. |
Data: A B SYN C → Transmit: A B ESC SYN C |
| Bit-Oriented | Flag 01111110 |
Bit stuffing: Insert '0' after five consecutive '1's in data. | Data: 01111110 → Transmit: 011111010 |
| Length-Based | Length field in header | No stuffing; length field indicates frame size. | Used in some LANs (e.g., Token Ring). |
Example (Nov 2022): Bit string
011110111110111101111110111101111110. After bit stuffing (insert '0' after 5 '1's):011110111110111101011111101111010111110.
E. Flow Control Protocols
1. Stop-and-Wait:
-
Sender sends 1 frame, waits for ACK before next.
-
Efficiency $$\displaystyle \eta = \frac{1}{1 + 2a} $$, where $$\displaystyle a = \frac{\text{Propagation Delay}}{\text{Transmission Time}} $$.
-
Problem: Low utilization for long propagation delays (high $a$).
2. Sliding Window:
-
Sender Window ($$\displaystyle W_s $$): Max unacknowledged frames.
-
Receiver Window ($$\displaystyle W_r $$): Max frames receiver can accept (usually 1 for Go-Back-N, >1 for Selective Repeat).
-
Piggybacking: ACK carried in data frame going opposite direction (improves efficiency).
| Protocol | $$\displaystyle W_s $$ | $$\displaystyle W_r $$ | On Error | Efficiency |
|---|---|---|---|---|
| Go-Back-N | $$\displaystyle 2^n - 1 $$ | 1 | Sender retransmits all unacked frames from error onward. | Better than Stop-and-Wait. |
| Selective Repeat | $$\displaystyle 2^{n-1} $$ | $$\displaystyle 2^{n-1} $$ | Only erroneous frame retransmitted. | Higher efficiency, complex receiver buffer. |
F. Multiple Access Protocols (MAC Sublayer)
Static Channel Allocation: FDM/TDM. Inefficient for bursty traffic.
Dynamic Allocation (Random Access):
| Protocol | Principle | Throughput ($S$) | Key Points |
|---|---|---|---|
| Pure ALOHA | Transmit anytime. Vulnerable period = $2 \times \tau$. | $$\displaystyle S = G e^{-2G} $$ (max at $$\displaystyle G=0.5 $$, $$\displaystyle S_{max}=0.184 $$) | Simple, very low efficiency. |
| Slotted ALOHA | Transmit only at slot start. Vulnerable period = $\tau$. | $$\displaystyle S = G e^{-G} $$ (max at $$\displaystyle G=1 $$, $$\displaystyle S_{max}=0.368 $$) | Double throughput of pure ALOHA. |
| CSMA | Sense channel before transmit. | Improves with persistence. | Still has collision possibility due to propagation delay. |
| 1-Persistent CSMA | If idle, transmit immediately; if busy, sense continuously. | High collision probability under load. | |
| Non-Persistent CSMA | If busy, wait random time, then sense. | Lower collision, but may cause idle gaps. | |
| p-Persistent CSMA | If idle, transmit with probability $p$, defer with $1-p$. | Balances collision & idle time. | |
| CSMA/CD (Ethernet) | Collision Detection. Abort on collision, binary exponential backoff. | Efficiency $$\displaystyle \eta = \frac{1}{1 + 6.44a} $$ for $a \ll 1$. | Minimum Frame Size: $2 \times \text{Propagation Delay} \times \text{Bandwidth}$. |
| CSMA/CA (Wi-Fi) | Collision Avoidance. RTS/CTS, interframe spaces (SIFS, DIFS). | No collision detection in wireless (hidden terminal). | Uses DCF (mandatory) & PCF (optional). |
Binary Exponential Backoff (BEB):
After $k$-th collision, wait random slots from $0$ to $$\displaystyle 2^k - 1 $$.
Example: 1st collision → 0 or 1 slot; 2nd → 0-3 slots; max $$\displaystyle k=10 $$ (1023 slots).
IV. LOCAL AREA NETWORKS (LAN) STANDARDS
A. IEEE 802 Standards Overview
Defines LAN/MAN standards. Sublayers:
-
LLC (Logical Link Control): Common interface to network layer (IEEE 802.2).
-
MAC (Media Access Control): Media-specific access method.
B. Ethernet (IEEE 802.3)
Access Method: CSMA/CD. Frame Format (64-1518 bytes):
[Preamble 7B][SFD 1B][Dest MAC 6B][Src MAC 6B][Type 2B][Data 46-1500B][FCS 4B]
-
Preamble/SFD: Clock synchronization.
-
Type: Indicates upper-layer protocol (e.g., 0x0800 = IPv4).
-
FCS: CRC-32.
Physical Variants:
-
10BASE-T: 10 Mbps, Cat 3 TP, star topology, max segment 100m.
-
100BASE-TX: Fast Ethernet, 100 Mbps, Cat 5 TP.
-
1000BASE-T: Gigabit Ethernet, all 4 pairs, full-duplex.
Performance: Excellent for light load; efficiency drops with heavy load due to collisions. Minimum Frame Size: Ensures collision detection before transmission ends.
C. Token Bus (IEEE 802.4)
-
Access: Token passing on a logical bus (physical can be bus/star).
-
Operation: Station with token can transmit. Token passed by address (highest to lowest).
-
Performance: Deterministic, good for factory automation. Complex token management.
D. Token Ring (IEEE 802.5)
-
Access: Token passing on logical ring (physical star via MAU).
-
Frame Format:
[SD][FC][DA][SA][DSAP][SSAP][Control][Data][FCS][ED][FS]
-
SD (Starting Delimiter):
0xF7(violates bit stuffing rule). -
FC (Frame Control): Indicates frame type.
-
Ring Maintenance: Active Monitor (AM) handles token recovery, beaconing on failures.
-
Priority: 8 priority levels via reservation bits.
-
Performance: Deterministic, but complex and slower than Ethernet.
E. FDDI (Fiber Distributed Data Interface)
-
Dual ring: Primary & secondary. Counter-rotating.
-
Token passing: Like Token Ring, but higher speed (100 Mbps).
-
Reliability: Single break doesn't fail network (ring wraps).
-
Topology: Dual ring of stations (dual-attached).
F. Wireless LAN (IEEE 802.11)
MAC Sublayer:
-
DCF (Distributed Coordination Function): Mandatory, CSMA/CA with RTS/CTS.
-
PCF (Point Coordination Function): Optional, AP-centric, contention-free.
Frame Types:
-
Management: Authentication, association (Beacon frames).
-
Control: RTS, CTS, ACK.
-
Data: Carries payload.
Interframe Spaces (IFS):
-
SIFS (Short IFS): Highest priority (ACK, CTS).
-
PIFS (PCF IFS): PCF frames.
-
DIFS (DCF IFS): DCF data frames.
G. LAN Standards Comparison (802.3 vs 802.4 vs 802.5)
| Feature | Ethernet (802.3) | Token Bus (802.4) | Token Ring (802.5) |
|---|---|---|---|
| Access Method | CSMA/CD | Token passing (bus) | Token passing (ring) |
| Topology | Bus/Star | Logical bus | Logical ring / Physical star |
| Performance | High under light load, unpredictable under heavy load | Deterministic, medium throughput | Deterministic, lower than Ethernet |
| Complexity | Low | Medium | High (monitor, beacon) |
| Real-World | Dominant (99% LANs) | Rare (industrial) | Legacy (IBM networks) |
V. NETWORKING DEVICES AND BRIDGING
| Device | OSI Layer | Function | Key Points |
|---|---|---|---|
| Repeater/Hub | Physical | Regenerates signal, extends distance. | Hubs: Multiport repeaters, create single collision domain. No intelligence. |
| Bridge | Data Link | Connects homogeneous LANs (same MAC protocol). | Functions: Learning (builds MAC table), Forwarding, Filtering, Flooding. Types: Local, Remote. Modes: Store-and-forward (error check), Cut-through (fast, no error check). |
| Switch | Data Link | Multiport bridge. Connects multiple LAN segments. | MAC Table: Built by learning source MACs. Forwarding: Store-and-forward (most common). VLANs: Logical segmentation (IEEE 802.1Q tagging). |
| Router | Network | Connects heterogeneous networks (different protocols). | Functions: Routing (path selection), Forwarding, Congestion control, Fragmentation. |
| Gateway | Application | Protocol conversion between different architectures (e.g., SMTP ↔ X.400). | Highest layer, complex. |
[!TIP] KEY DIFFERENCE: Hubs/Switches/Bridges operate at L2 (MAC addresses). Routers at L3 (IP addresses). Gateways at L7.
VI. NETWORK LAYER
A. Design Issues
Routing, congestion control, addressing, fragmentation/reassembly, error handling (ICMP).
B. IP Addressing
1. Classful Addressing (Legacy):
-
Class A:
0prefix, /8, 16M hosts. Range:1.0.0.0-126.255.255.255 -
Class B:
10prefix, /16, 64K hosts. Range:128.0.0.0-191.255.255.255 -
Class C:
110prefix, /24, 254 hosts. Range:192.0.0.0-223.255.255.255 -
Class D:
1110prefix, multicast. -
Class E:
1111prefix, experimental.
Limitations: Rapid depletion of Class B, inefficient use of addresses (many organizations needed <254 hosts but got /24).
2. CIDR (Classless Inter-Domain Routing):
-
Notation:
a.b.c.d/n(e.g.,192.168.1.0/24). -
Aggregation (Supernetting): Combine contiguous prefixes into larger block (e.g.,
192.168.0.0/24+192.168.1.0/24→192.168.0.0/23). -
Solves routing table explosion & address waste.
3. Subnetting:
-
Divide a network into smaller subnetworks.
-
Subnet Mask: 32-bit number separating network/host bits (e.g.,
255.255.255.0=/24). -
Steps:
-
Determine required subnets/hosts.
-
Borrow bits from host part for subnet ID.
-
New prefix = original prefix + borrowed bits.
-
Subnet Increment = $$\displaystyle 2^{\text{borrowed bits}} $$.
-
Calculate ranges: First usable = Network ID + 1; Last usable = Broadcast ID - 1; Broadcast = Network ID + Increment - 1.
-
Example (Jun 2023, May 2024):
192.168.10.0/24into 4 subnets.
- Borrow 2 bits → new prefix
/26(mask255.255.255.192).
- Increment = $$\displaystyle 2^2 = 64 $$.
- Subnets:
192.168.10.0/26→ Range:192.168.10.1-192.168.10.62, Broadcast:192.168.10.63
192.168.10.64/26→ Range:65-126, Broadcast:127
192.168.10.128/26→ Range:129-190, Broadcast:191
192.168.10.192/26→ Range:193-254, Broadcast:255
4. IPv4 vs IPv6:
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Size | 32 bits | 128 bits |
| Header | 20-60 bytes (variable) | 40 bytes (fixed) |
| Fields | Options, fragmentation fields | Extension headers (routing, fragmentation, security) |
| Addressing | Classful/CIDR, broadcast | Hierarchical, no broadcast (multicast/anycast) |
| Configuration | Manual/DHCP | Auto-configuration (SLAAC) |
| Security | Optional (IPsec) | Mandatory (IPsec) |
| Transition | - | Tunneling (6to4, 6in4), Dual-stack, Translation |
C. Address Resolution
ARP (Address Resolution Protocol):
-
Purpose: Map IP address → MAC address on local network.
-
Operation:
-
Host checks ARP cache.
-
If missing, broadcasts ARP request: "Who has IP X? Tell Y (MAC of sender)."
-
Owner replies with ARP reply (unicast): "IP X is at MAC Z."
-
Both update ARP caches.
-
-
RARP: Reverse ARP. Diskless node broadcasts its MAC, asks for IP (legacy, replaced by BOOTP/DHCP).
-
InARP: Used in Frame Relay/ATM to map DLCI to IP.
-
BOOTP/DHCP: Dynamic IP assignment (DHCP is enhanced BOOTP).
D. ICMP (Internet Control Message Protocol)
-
Role: Network layer error-reporting & diagnostic protocol.
-
Encapsulated in IP (Protocol number 1).
-
Message Types:
-
Error Reporting:
-
Destination Unreachable (Port, Network, Host unreachable)
-
Time Exceeded (TTL expired, fragment reassembly timeout)
-
Parameter Problem (Invalid header field)
-
-
Query:
-
Echo Request/Reply (
ping) -
Timestamp Request/Reply
-
Router Advertisement/Solicitation (for autoconfiguration)
-
-
E. Routing Algorithms
1. Distance Vector Routing (Bellman-Ford):
-
Principle: Each router knows distance (cost) to destination via each neighbor. Shares entire routing table with neighbors periodically.
-
Algorithm: $$\displaystyle D_x(y) = \min_{v \in \text{neighbors}} \{ \text{cost}(x,v) + D_v(y) \} $$
-
Example (Nov 2023): Given delay vectors from neighbors, router J computes new distances.
-
RIP: Uses DV, hop count metric (max 15 hops). Problems: Count-to-infinity, slow convergence, routing loops.
-
Solutions: Split horizon (don't advertise route back to source), Poison reverse (advertise infinite metric back), Hold-down timers.
2. Link State Routing (Dijkstra):
-
Principle: Each router has complete map of network (link state database). Computes shortest path to all destinations using Dijkstra's algorithm.
-
Steps:
-
Flood LSA (Link State Advertisement) to all routers.
-
Build identical LSDB (Link State Database).
-
Run Dijkstra on LSDB.
-
-
Algorithm (Shortest Path First - SPF):
-
Set $N'$ = {source node}, cost to self = 0.
-
Find node $w$ not in $N'$ with smallest tentative cost.
-
Add $w$ to $N'$, update costs to neighbors via $w$.
-
Repeat until all nodes in $N'$.
-
-
Advantages: Fast convergence, no count-to-infinity, supports complex metrics.
-
Disadvantages: High memory/computation (O($$\displaystyle n^2 $$)), flooding overhead.
Comparison:
| Feature | Distance Vector | Link State |
|---|---|---|
| Information Shared | Entire routing table | Link state to all neighbors |
| Convergence | Slow (count-to-infinity) | Fast |
| Scalability | Poor (periodic full updates) | Good (only changes flooded) |
| Resource Use | Low memory, high bandwidth (periodic) | High memory (LSDB), low bandwidth (event-driven) |
| Example | RIP, IGRP | OSPF, IS-IS |
VII. TRANSPORT LAYER
A. Services & Functions
-
Segmentation & reassembly.
-
Connection management (establishment, termination).
-
Flow control (receiver-driven).
-
Error control (retransmission).
-
Multiplexing/demultiplexing (ports).
B. Connection-Oriented vs Connectionless
| Connection-Oriented (TCP) | Connectionless (UDP) | |
|---|---|---|
| Setup | 3-way handshake | None |
| Reliability | Guaranteed (ACK, retransmission) | None |
| Ordering | Guaranteed (sequence numbers) | Not guaranteed |
| Congestion Control | Yes (slow start, congestion avoidance) | No |
| Flow Control | Yes (sliding window) | No |
| Overhead | High (20-60 bytes header) | Low (8 bytes header) |
| Use Cases | Web, email, file transfer | DNS, VoIP, streaming, DHCP |
C. Transmission Control Protocol (TCP)
Header Format (20-60 bytes):
[Source Port 16][Dest Port 16][Seq Num 32][Ack Num 32][Data Offset 4][Reserved 6][Flags 6][Window 16][Checksum 16][Urgent Ptr 16][Options 0-40][Padding]
-
Flags: URG, ACK, PSH, RST, SYN, FIN.
-
Window: Receiver's advertised window size (flow control).
-
Checksum: Covers header+data, pseudo-header (src IP, dst IP, protocol, length).
Connection Establishment (3-Way Handshake):
-
SYN: Client → Server,
SEQ=x,SYN=1. -
SYN-ACK: Server → Client,
SEQ=y,ACK=x+1,SYN=1,ACK=1. -
ACK: Client → Server,
SEQ=x+1,ACK=y+1,ACK=1.
Connection Termination (4-Way Handshake - Graceful):
-
FIN: A → B,
FIN=1,SEQ=u. -
ACK: B → A,
ACK=u+1,ACK=1. -
FIN: B → A,
FIN=1,SEQ=v. -
ACK: A → B,
ACK=v+1,ACK=1.
Why Graceful? Ensures all data delivered, resources released cleanly, prevents data loss.
Flow Control: Receiver advertises window size in ACK. Sender's send window = min( congestion window, receiver window ).
Congestion Control:
-
Slow Start: Start with $$\displaystyle cwnd=1 $$ MSS, double each RTT until ssthresh.
-
Congestion Avoidance: After ssthresh, increase $cwnd$ by 1 MSS per RTT (linear).
-
Fast Retransmit: 3 duplicate ACKs → retransmit missing segment immediately.
-
Fast Recovery: After fast retransmit, set ssthresh = cwnd/2, cwnd = ssthresh + 3, then linear increase.
Goal: Probe for available bandwidth, avoid network collapse.
D. User Datagram Protocol (UDP)
Header Format (8 bytes):
[Source Port 16][Dest Port 16][Length 16][Checksum 16]
-
Length: Header + data (bytes).
-
Checksum: Optional in IPv4, mandatory in IPv6. Covers pseudo-header.
-
Characteristics: Connectionless, no reliability, no ordering, no congestion control.
-
Applications: DNS (queries), VoIP, streaming, DHCP, SNMP.
E. TCP vs UDP Summary
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Yes (ACK, retransmit) | No |
| Ordering | Yes (sequence numbers) | No |
| Congestion Control | Yes | No |
| Flow Control | Yes (sliding window) | No |
| Header Size | 20-60 bytes | 8 bytes |
| Speed | Slower (overhead) | Faster |
| Use Cases | Web (HTTP/HTTPS), Email (SMTP/POP3/IMAP), FTP | DNS, DHCP, VoIP, video streaming |
VIII. APPLICATION LAYER
A. Domain Name System (DNS)
-
Purpose: Hierarchical, distributed database mapping domain names → IP addresses.
-
Hierarchy:
-
Root Servers (13 sets): Top-level.
-
TLD Servers:
.com,.org,.in, country-code TLDs. -
Authoritative Servers: Organizations' own servers (e.g.,
google.com). -
Local DNS Resolver: ISP/organization's server.
-
-
Resolution:
-
Recursive: Resolver asks server, server returns final answer (or error).
-
Iterative: Server returns referral to lower-level server if not authoritative.
-
-
Caching: Each server caches responses with TTL (Time-To-Live). Reduces latency & traffic.
-
Resource Records (RR):
-
A: IPv4 address.
-
AAAA: IPv6 address.
-
CNAME: Canonical name (alias).
-
MX: Mail exchange server.
-
NS: Name server.
-
PTR: Pointer (reverse lookup).
-
B. Electronic Mail (Email)
Architecture:
-
User Agent (UA): Email client (Outlook, Thunderbird).
-
Message Transfer Agent (MTA): Server that transfers email (sendmail, Postfix).
-
Message Delivery Agent (MDA): Delivers to mailbox (procmail).
Protocols:
-
SMTP (Simple Mail Transfer Protocol) - Port 25:
-
Push protocol (client → server).
-
Commands:
HELO,MAIL FROM,RCPT TO,DATA,QUIT. -
ESMTP: Extended with
EHLO, supports extensions (size, authentication, TLS).
-
-
POP3 (Post Office Protocol v3) - Port 110:
-
Pull protocol. Downloads & deletes (or keeps) from server.
-
Simple, no folder support.
-
-
IMAP (Internet Message Access Protocol) - Port 143/993 (SSL):
- Pull protocol. Keeps mail on server, supports folders, partial fetch.
Message Format (RFC 5322):
Header:
From: [email protected]
To: [email protected]
Subject: Hello
Date: ...
Body:
This is the message.
C. World Wide Web (WWW)
-
HTTP (Hypertext Transfer Protocol):
-
Request:
Method SP Request-URI SP HTTP/1.1\r\n+ headers. -
Methods:
GET(retrieve),POST(submit),PUT,DELETE. -
Response:
HTTP/1.1 Status-Code Reason-Phrase\r\n+ headers + body. -
Status Codes:
200 OK,301 Moved Permanently,404 Not Found,500 Internal Server Error.
-
-
HTTPS: HTTP over TLS/SSL (port 443). Provides encryption, server authentication.
-
URL (Uniform Resource Locator):
scheme://host:port/path?query#fragment -
Cookies: Key-value pairs stored by browser, sent with requests (session management).
-
Sessions: Maintain state via cookies, URL rewriting, hidden fields.
D. File Transfer Protocol (FTP)
-
Two Connections:
-
Control Connection: Port 21, persistent, commands/responses.
-
Data Connection: Port 20 (active mode) or dynamic port (passive mode), per file transfer.
-
-
Active Mode: Server connects back to client's port 20.
-
Passive Mode: Client initiates data connection to server's dynamic port (firewall-friendly).
-
Commands:
USER,PASS,LIST,RETR,STOR,QUIT.
E. Simple Network Management Protocol (SNMP)
-
Components:
-
Manager: Central monitoring station.
-
Agent: Software on managed device (router, switch).
-
MIB (Management Information Base): Database of manageable objects (variables).
-
Management Station: Runs manager software.
-
-
Operations:
-
get,get-next,set(from manager to agent). -
trap(asynchronous alert from agent to manager).
-
-
Versions:
-
SNMPv1: Community-based (no encryption).
-
SNMPv2c: Enhanced operations, still community-based.
-
SNMPv3: User-based, authentication & encryption (secure).
-
IX. MISCELLANEOUS TOPICS
A. Network Topologies
| Topology | Diagram | Advantages | Disadvantages |
|---|---|---|---|
| Bus | Single cable, terminators at ends. | Simple, cheap, easy to extend. | Single point of failure, performance degrades with nodes, difficult fault isolation. |
| Star | All nodes connected to central hub/switch. | Easy to manage, single node failure doesn't affect others, central monitoring. | Hub/switch failure brings down network, cable cost high. |
| Ring | Nodes connected in a circle. | Deterministic access (token), no collisions. | Single node failure breaks ring (unless dual ring), difficult to add nodes. |
| Mesh | Every node connected to every other node. | High reliability, no congestion, fault-tolerant. | Very expensive, complex, high cabling. |
| Tree | Hierarchical star. | Scalable, easy to manage. | Root node failure affects entire network. |
| Hybrid | Combination (e.g., star-bus). | Flexible, scalable. | Complex design. |
Star vs Mesh: Star is centralized, cost-effective for LANs. Mesh is fully decentralized, used in WAN backbones for reliability.
B. Virtual LANs (VLANs)
-
Concept: Logical segmentation of a physical LAN into multiple broadcast domains.
-
Benefits:
-
Security: Isolate sensitive groups.
-
Broadcast Reduction: Smaller broadcast domains.
-
Flexibility: Users can be grouped by function, not location.
-
-
Tagging (IEEE 802.1Q): Inserts 4-byte VLAN tag in Ethernet frame header (between source MAC and EtherType). Tag includes VLAN ID (12 bits, 4094 VLANs max).
-
Implementation: Switch ports configured as access (single VLAN, untagged) or trunk (multiple VLANs, tagged).
C. Network Design & Performance Metrics
-
Throughput: Actual achieved data rate (bps).
-
Bandwidth: Maximum theoretical capacity (bps).
-
Delay (Latency): Time for a bit to travel from source to destination.
- $$\displaystyle \text{Total Delay} = \text{Transmission Delay} + \text{Propagation Delay} + \text{Queuing Delay} + \text{Processing Delay} $$
-
Reliability: Measured by MTBF (Mean Time Between Failures), error rates.
D. Service Primitives (OSI)
Four primitives for layer-to-layer communication:
-
Request: Service user → service provider (e.g., "connect").
-
Indication: Service provider → service user (e.g., "incoming call").
-
Response: Service user → service provider (e.g., "accept call").
-
Confirm: Service provider → service user (e.g., "connection confirmed").
Used in connection-oriented services (e.g., transport layer).
X. CALCULATION-BASED PROBLEMS (EXAM FOCUS)
1. Nyquist Capacity
$$C = 2B \log_2 M$$
Example: $$\displaystyle B=3 $$ kHz, $$\displaystyle M=4 $$ → $$\displaystyle C=12 $$ kbps. If $$\displaystyle M=8 $$ → $$\displaystyle C=18 $$ kbps.
2. Shannon Capacity
$$C = B \log_2 (1 + \text{SNR})$$
Example: $$\displaystyle B=4 $$ kHz, SNR=1000 → $C \approx 39.88$ kbps.
3. ALOHA Throughput
-
Pure: $$\displaystyle S = G e^{-2G} $$, $$\displaystyle S_{max}=0.184 $$ at $$\displaystyle G=0.5 $$.
-
Slotted: $$\displaystyle S = G e^{-G} $$, $$\displaystyle S_{max}=0.368 $$ at $$\displaystyle G=1 $$.
Given idle probability $$\displaystyle P_{idle}=0.1 $$ (slotted): $$\displaystyle P_{idle} = e^{-G} = 0.1 $$ → $$\displaystyle G = -\ln(0.1) \approx 2.302 $$. Throughput $$\displaystyle S = G e^{-G} = 2.302 \times 0.1 = 0.2302 $$. $$\displaystyle G>1 $$ → overload (more stations than optimal).
4. TDM Frame Size
Data Rate = $$\displaystyle \frac{\text{Total bits per frame}}{\text{Frame time}} $$.
Example (Jun 2023): 190 kbps + 180 kbps channels. Frame must carry bits from both. Frame size in bits = sum of bits from each channel per frame. Data rate = frame size / frame time. If no sync bits, and each channel sends 1 bit per frame, frame size = 190+180 = 370 bits. But typically, each channel contributes multiple bits. Clarify: if multiplexing n channels each with rate $$\displaystyle R_i $$, frame size $$\displaystyle L = \sum R_i \times T_{frame} $$, data rate = $$\displaystyle L / T_{frame} = \sum R_i $$.
5. CRC Polynomial Computation
Steps: Append zeros, divide by $G(x)$, remainder is CRC.
Example (Jun 2025): $$\displaystyle D(x)=x^5+x^4+x^2+1 $$ (
110101), $$\displaystyle G(x)=x^3+x+1 $$ (1011). Division yields remainder011. Codeword:110101011.
6. Stop-and-Wait Efficiency
$$\eta = \frac{1}{1 + 2a}, \quad a = \frac{\text{Propagation Delay}}{\text{Transmission Time}}$$
For $\eta \ge 0.5$: $1/(1+2a) \ge 0.5$ → $1 \ge 0.5 + a$ → $a \le 0.5$. So propagation delay ≤ transmission time.
7. CSMA/CD Minimum Packet Size
$$\text{Min Frame Size} = 2 \times \text{Propagation Delay} \times \text{Bandwidth}$$
Example (Nov 2022): 2 km, bandwidth $$\displaystyle 10^7 $$ bps, signal speed $$\displaystyle 2 \times 10^8 $$ m/s.
Propagation delay = distance / speed = $$\displaystyle 2000 / (2 \times 10^8) = 10^{-5} $$ s = 10 µs.
Min frame size = $$\displaystyle 2 \times 10^{-5} \times 10^7 = 200 $$ bits = 25 bytes. But Ethernet minimum is 64 bytes → must send at least 64 bytes.
8. Subnetting Problems
Example (May 2024): ISP has
190.100.0.0/16(65,536 addresses).
- Group 1: 64 customers × 256 addresses = 16,384 addresses → Need /20 blocks ($$\displaystyle 2^{16-4}=2^{12}=4096 $$? Wait: 256 hosts → need 8 host bits → /24 per customer. 64 × 256 = 16,384 addresses = 64 /24 blocks. Starting from
190.100.0.0/24to190.100.63.0/24.
- Group 2: 128 customers × 128 addresses → /25 per customer (128 hosts). 128 × 128 = 16,384 addresses = 128 /25 blocks. Next available:
190.100.64.0/25to190.100.127.127/25(128 blocks).
- Group 3: 128 customers × 64 addresses → /26 per customer (64 hosts). 128 × 64 = 8,192 addresses = 128 /26 blocks. Next:
190.100.128.0/26to190.100.191.255/26(128 blocks).
- Used: 16,384 + 16,384 + 8,192 = 40,960 addresses.
- Remaining: 65,536 - 40,960 = 24,576 addresses (
190.100.192.0/18? Actually used up to190.100.191.255, so remaining:190.100.192.0-190.100.255.255= 16,384 addresses? Let's recalc: /16 has 256 /24 blocks. Used: 64 (group1) + 128 (group2) + 128 (group3) = 320 /24 blocks? No, group2 uses /25 (half of /24), group3 uses /26 (quarter). Better to allocate in contiguous blocks. After group1 (64 /24s), used0.0to63.255. Group2: 128 /25s = 64 /24s (since 2 /25s = 1 /24). So uses64.0to127.255. Group3: 128 /26s = 32 /24s (4 /26s = 1 /24). Uses128.0to159.255. Total used /24 blocks: 64+64+32=160. Remaining /24 blocks: 256-160=96 → 96 × 256 = 24,576 addresses. Yes.
END OF UNIT 2 NOTES