UNIT 3: Computer Networks - Comprehensive Short Notes
I. Network Models and Architecture
A. ISO-OSI Reference Model
A 7-layer architectural framework for network communication, promoting interoperability through standardized layer functions.
| Layer | Function | Device/Protocol Example |
|---|---|---|
| 7. Application | User interface; provides network services to apps. | HTTP, SMTP, DNS |
| 6. Presentation | Data translation, encryption, compression. | SSL/TLS, JPEG, MPEG |
| 5. Session | Manages dialogues (sessions) between apps. | NetBIOS, RPC |
| 4. Transport | End-to-end reliability, flow control, segmentation. | TCP, UDP |
| 3. Network | Logical addressing, routing, path determination. | IP, ICMP, routers |
| 2. Data Link | Framing, physical addressing, error control. | Ethernet, PPP, switches |
| 1. Physical | Bit transmission over medium; electrical/optical specs. | RJ45, fiber, hubs |
Service Primitives: Four operations a layer provides to the layer above it:
-
REQUEST: Upper layer requests a service.
-
INDICATION: Lower layer notifies upper layer of an event (e.g., incoming data).
-
RESPONSE: Upper layer replies to an indication.
-
CONFIRM: Lower layer confirms completion of a requested service.
Peer-to-Peer Communication: Each layer on the source machine communicates with its peer layer on the destination machine using a Protocol Data Unit (PDU). The PDU name changes per layer (Data → Segment → Packet → Frame → Bit).
[!TIP] Exam Focus: OSI layers, their primary functions, and associated devices are frequently asked. Remember: Switches operate at Layer 2, Routers at Layer 3.
B. TCP/IP Reference Model
A practical, 4-layer model that underpins the modern Internet.
| Layer | Function | Protocol Suite |
|---|---|---|
| Application | Combines OSI's App, Pres, Sess layers. | HTTP, FTP, SMTP, DNS |
| Transport | Same as OSI Transport layer. | TCP (reliable), UDP (unreliable) |
| Internet | Same as OSI Network layer. | IP, ICMP, ARP |
| Network Interface | Combines OSI's Data Link & Physical. | Ethernet, Wi-Fi (802.11), PPP |
Comparison: OSI vs. TCP/IP
| Feature | OSI Model | TCP/IP Model |
|---|---|---|
| Layers | 7 (Theoretical, strict) | 4 (Practical, flexible) |
| Protocols | Protocol-independent model | Protocol-specific suite |
| Approach | Top-down design | Bottom-up implementation |
| Communication | Layer-to-layer (within host) | End-to-end (between peers) |
| Usage | Reference, teaching | Real-world Internet |
Advantages of TCP/IP:
-
Interoperability: De facto global standard.
-
Scalability: Proven in massive networks (Internet).
-
Flexibility: Can run over any physical network.
Disadvantages:
-
Lacks Generality: Tied to specific protocols.
-
Layered Boundaries: Blurred (e.g., HTTP uses TCP/IP directly).
-
No Strong encapsulation: Original model didn't strictly enforce layer independence.
C. Connection-Oriented vs. Connectionless Services
| Feature | Connection-Oriented | Connectionless |
|---|---|---|
| Path | Dedicated logical path (Virtual Circuit) established before data transfer. | No pre-established path; each packet (datagram) routed independently. |
| Ordering | Guaranteed in-order delivery. | No guarantee; packets may arrive out-of-order. |
| Reliability | High (acknowledgments, retransmission). | Best-effort; no inherent reliability. |
| Overhead | Higher (setup/teardown, state maintenance). | Lower (no connection state). |
| Example | TCP (Transport), Virtual Circuit (Network) | UDP (Transport), Datagram (Network) |
D. Network Types and Topologies
Network Types (by Scale):
-
PAN (Personal Area Network): < 10m (e.g., Bluetooth, USB).
-
LAN (Local Area Network): Single building/campus (e.g., Ethernet).
-
WAN (Wide Area Network): Country/continent (e.g., Internet backbone).
-
Internetwork: Interconnection of multiple networks (e.g., the Internet).
Physical vs. Logical Topology:
-
Physical: Actual wire/cable layout.
-
Logical: Path of signal flow (may differ from physical).
| Topology | Description | Advantages | Disadvantages |
|---|---|---|---|
| Bus | Single central cable (backbone). | Simple, cheap, easy to extend. | Single point of failure, performance degrades with load, difficult to isolate faults. |
| Star | All nodes connect to a central hub/switch. | Easy to install/configure, single node failure doesn't affect others. | Central device is single point of failure, cable cost high. |
| Ring | Nodes connected in a closed loop. | Deterministic access (Token Ring), orderly. | Single node failure can break ring, difficult to add nodes. |
| Mesh | Every node connected to every other node. | High redundancy, fault tolerance. | Very expensive, complex, high cabling. |
| Tree | Hierarchical bus/star. | Scalable, easy to manage. | Root node failure affects entire network. |
| Hybrid | Combination of two or more topologies. | Flexible, balances pros/cons. | Complex design and management. |
E. Network Devices
| Device | OSI Layer | Function | Key Feature |
|---|---|---|---|
| Hub | Physical (1) | Repeats signal to all ports. | Broadcasts; no intelligence; single collision domain. |
| Bridge | Data Link (2) | Connects two LAN segments; filters traffic based on MAC addresses. | Learns MACs, forwards/ filters frames; splits collision domains. |
| Switch | Data Link (2) | Multi-port bridge. Forwards frames based on MAC address table. | Microsegmentation; one collision domain per port; full-duplex. |
| Router | Network (3) | Connects different networks; forwards packets based on IP addresses. | Uses routing tables; performs path determination; breaks broadcast domains. |
| Gateway | Application (7) | Protocol converter between dissimilar networks (e.g., email gateway). | Translates between different architectures (e.g., SMS ↔ Email). |
[!TIP] Common Pitfall: Hubs are repeaters (Layer 1), not "dumb switches." Switches build MAC tables dynamically.
II. Physical and Data Link Layer
A. Transmission Media
Guided Media (Wired):
-
Twisted Pair (UTP/STP): 8 wires in pairs; categories (Cat5e, Cat6). Used in Ethernet, telephone.
-
Coaxial Cable: Central conductor, insulator, shield, jacket. Used in cable TV, older Ethernet.
-
Fiber Optic: Glass/plastic fibers; light pulses. Single-mode (long distance), Multi-mode (short distance). High bandwidth, immune to EMI.
Unguided Media (Wireless):
-
Radio: Omnidirectional; used in Wi-Fi, Bluetooth.
-
Microwave: Directional; terrestrial & satellite.
-
Infrared: Line-of-sight; short range (remote controls).
-
Satellite: Broad coverage, high latency.
B. Physical Layer Concepts
1. Channel Capacity Theorems:
- Nyquist Theorem (Noiseless): Maximum data rate for a noiseless channel of bandwidth
BHz usingMsignal levels:
$$ \text{Max Bit Rate} = 2B \log_2 M \ \text{bps} $$
*Example:* For B=3kHz, M=4 (2 bits/signal), Max Rate = 2*3000*log₂(4) = **12,000 bps**.
- Shannon Theorem (Noisy): Maximum data rate for a channel of bandwidth
BHz with SNR:
$$ C = B \log_2 (1 + \text{SNR}) \ \text{bps} $$
where SNR is linear (not dB). **This is the absolute theoretical limit.**
2. Line Coding (Mapping bits to signals):
-
NRZ (Non-Return to Zero): High=1, Low=0. DC component issue.
-
Manchester: Mid-bit transition. Clock recovery. Used in Ethernet (10BASE-T).
-
Differential Manchester: Transition at start of bit period; 0=transition, 1=no transition. More robust.
-
4B/5B: 4 data bits encoded as 5-bit code (only 16 of 32 codes used). Ensures enough transitions for clocking. Used in Fast Ethernet (100BASE-TX).
3. Multiplexing:
-
FDM (Frequency Division): Each signal gets a frequency band. Used in radio, TV, DSL.
-
TDM (Time Division): Each signal gets a time slot (time slot = sample of all channels). Synchronous TDM: Fixed slots, even if channel idle. Statistical TDM: Dynamic slot allocation based on demand.
-
WDM (Wavelength Division): Fiber version of FDM; multiple light wavelengths on same fiber.
C. Data Link Layer Functions & Design Issues
1. Framing: Delimiting data units (frames).
-
Character-Oriented: Use special characters (e.g., STX/ETX in BISYNC).
-
Bit-Oriented: Use bit patterns (e.g.,
01111110flag in HDLC).
2. Error Detection & Correction:
-
Parity Bits: Single bit for odd/even parity. Detects single-bit errors only.
-
CRC (Cyclic Redundancy Check):
-
Polynomial Representation: Data
D(x)and GeneratorG(x)(e.g.,10011for CRC-CCITT). -
Computation:
-
Append
rzeros toD(x), wherer = degree(G(x)). -
Divide augmented
D(x)byG(x)using modulo-2 division (XOR, no carries). -
Remainder
R(x)is the CRC checksum. -
Transmit:
D(x) * x^r + R(x). -
Check: Receiver divides received polynomial by
G(x). Remainder 0 = no error.
-
-
Example: Given in past papers (e.g.,
1101011011and10011).
-
-
Hamming Codes (Error Correction): Adds
kparity bits tomdata bits to correct single-bit errors. Distanced_min = 3. Positions1,2,4,...are parity bits.
3. Bit/Byte Stuffing:
-
Bit Stuffing (Bit-Oriented): In HDLC, after 5 consecutive
1s in data, insert a0. Receiver removes it after detecting01111110. -
Byte Stuffing (Byte-Oriented): In PPP, if flag byte
0x7Eor escape byte0x7Dappears in data, insert escape byte before it and XOR the data byte.
D. Flow Control
1. Stop-and-Wait:
-
Sender sends 1 frame, waits for ACK before next.
-
Efficiency (U): $$\displaystyle U = \frac{1}{1 + 2a} $$ where $$\displaystyle a = \frac{\text{Propagation Delay}}{\text{Frame Transmission Time}} $$
-
For U ≥ 50%: $ 1 + 2a \leq 2 \Rightarrow a \leq 0.5 $. So, Propagation Delay ≤ Frame Transmission Time.
2. Sliding Window:
-
Go-Back-N (GBN):
-
Sender window size =
N, Receiver window size =1. -
If ACK not received: Sender re-transmits frame
nand all subsequent frames (n+1, n+2...). -
Link Utilization: $$\displaystyle \approx \frac{N}{1+2a} $$ (for large N).
-
-
Selective Repeat (SR):
-
Sender & Receiver window size =
N(max sequence number =2N). -
If ACK not received: Sender re-transmits only frame
n. -
Requires individual ACKs and buffering out-of-order frames at receiver.
-
More efficient than GBN on lossy links, but more complex.
-
Piggybacking: Putting ACK on outgoing data frames instead of sending separate ACK frames. Improves efficiency in full-duplex links.
E. Multiple Access Protocols (MAC Sublayer)
1. Channel Allocation:
-
Static: FDM, TDM, WDMA. Fixed assignment; inefficient for bursty traffic.
-
Dynamic: Random access, reservation, polling, token passing.
2. Random Access (Contention-Based):
-
Pure ALOHA: Transmit anytime. Max Efficiency = 18.4%. Throughput
S = G * e^{-2G}. -
Slotted ALOHA: Time synchronized; transmit only at slot start. Max Efficiency = 36.8%. Throughput
S = G * e^{-G}. -
CSMA (Carrier Sense Multiple Access):
-
1-Persistent: Sense channel; if idle, transmit immediately; if busy, sense continuously.
-
Non-Persistent: If busy, wait random time, then sense again.
-
p-Persistent (Slotted): If idle, transmit with probability
p, else defer to next slot.
-
-
CSMA/CD (Collision Detection - Ethernet):
-
Procedure: Sense → Transmit → Detect collision? → If yes, jam signal → Binary Exponential Backoff → Retransmit.
-
Minimum Frame Time: Must be ≥
2 * Max Propagation Delay(for collision detection).
-
-
CSMA/CA (Collision Avoidance - Wi-Fi 802.11):
-
DCF (Distributed Coordination Function): Uses RTS/CTS (optional) to avoid hidden terminal problem. Inter-frame spaces (SIFS, DIFS) for priority.
-
PCF (Point Coordination Function): Centralized, contention-free (optional).
-
3. Binary Exponential Backoff (BEB):
After k-th collision (k ≤ 10), choose random slot from 0 to (2^k - 1). After 10 collisions, k frozen at 10. Reduces collision probability after repeated failures.
F. LAN Standards (IEEE 802)
| Standard | Name | Access Method | Topology | Key Feature |
|---|---|---|---|---|
| 802.3 | Ethernet | CSMA/CD | Bus (logical), Star (physical) | Dominant LAN tech; frame has preamble, MAC addresses, type/length, CRC. |
| 802.4 | Token Bus | Token passing on virtual ring | Bus (physical), Ring (logical) | Deterministic; used in manufacturing. |
| 802.5 | Token Ring | Token passing | Ring | Single token circulates; 4-byte frame; active monitor handles ring maintenance. |
| 802.11 | Wi-Fi | CSMA/CA (DCF/PCF) | Star (infrastructure), Ad-hoc | Infrastructure mode: Via Access Point (AP). Frames: Control, Data, Management. |
| FDDI | Fiber Distributed Data Interface | Token passing on dual counter-rotating rings | Dual ring | High-speed (100 Mbps), long distance; uses dual ring for fault tolerance. |
| VLAN (Virtual LAN) | - | - | Logical segmentation over single physical switch | Benefits: Security (broadcast isolation), flexibility, reduced broadcast traffic. Implemented via switch port configuration or 802.1Q tagging (adds VLAN ID to Ethernet frame). |
G. Switching Techniques
| Technique | Principle | Path | Delay | Use Case |
|---|---|---|---|---|
| Circuit Switching | Dedicated path established before transfer. | Fixed, dedicated. | Low, constant after setup. | Traditional telephony. |
| Packet Switching | Data split into packets; each routed independently. | Variable, per-packet. | Variable (queuing delay). | Internet (IP). |
| Message Switching | Store entire message, then forward. | Variable, per-message. | High (store-and-forward). | Email, telegraph. |
| Store-and-Forward Switching | Entire frame received, checked for errors, then forwarded. | - | Higher, but error-free. | Used in bridges, routers. |
| Cut-Through Switching | Forward frame as soon as destination MAC is read. | - | Lower latency, but errors propagated. | High-performance backbones. |
H. Bridges and Switching
1. Transparent Bridging (Local Bridge - Ethernet):
-
Learning: Builds MAC address table by recording source MAC & incoming port.
-
Forwarding: If destination MAC in table → forward to that port; else flood to all except incoming.
-
Filtering: If source & destination on same port → discard frame.
-
Loop Prevention: Uses Spanning Tree Protocol (STP) to block redundant paths.
2. Remote Bridges:
Connect LANs over WAN links. Challenges:
-
Latency: Long propagation delays break CSMA/CD assumptions.
-
Scalability: STP may block needed paths.
-
Loop Prevention: More complex over WAN.
3. Switches (Multiport Bridges):
-
MAC Table Building: Same learning process as bridges.
-
Switching Methods:
-
Store-and-Forward: Error-checked; default for most switches.
-
Cut-Through: Low latency; used in high-frequency trading.
-
I. Data Link Layer Protocols
1. HDLC (High-Level Data Link Control):
-
Frame Format:
[Flag: 01111110] [Address] [Control] [Info] [FCS] [Flag: 01111110] -
Control Field: Defines frame type:
-
I-Frame (Info):
00(seq #, ack #) – data transfer. -
S-Frame (Supervisory):
10(seq #, ack #) – flow control (RR, RNR, REJ). -
U-Frame (Unnumbered):
11(modifier) – link management (SNRM, DISC, UA).
-
-
Modes: NRM (Normal Response), ABM (Asynchronous Balanced), ARM (Asynchronous Response).
2. PPP (Point-to-Point Protocol):
-
Frame Format:
[Flag: 0x7E] [Address: 0xFF] [Control: 0x03] [Protocol] [Data] [FCS] [Flag: 0x7E] -
Phases:
-
Link Establishment (LCP): Configure link parameters.
-
Authentication (Optional): PAP (plaintext) or CHAP (challenge-handshake).
-
Network Layer Protocol (NCP): Enable network protocols (e.g., IPCP for IP).
-
Link Termination.
-
-
Applications: Dial-up, DSL, direct router-to-router links.
3. SLIP (Serial Line IP):
- Limitations: No error detection, no authentication, no protocol type field (only IP), no compression. Obsolete, replaced by PPP.
4. Frame Relay:
-
Architecture: DTE (user device) ↔ DCE (Frame Relay switch).
-
Frame Format: No MAC addresses; uses DLCI (Data Link Connection Identifier) to identify virtual circuit.
-
Virtual Circuits: PVC (Permanent) pre-configured; SVC (Switched) dynamic.
-
Congestion Management: DE (Discard Eligibility) bit; FECN/BECN bits to signal congestion to sender/receiver.
III. Network Layer
A. Routing Algorithms
1. Distance Vector Routing (DVR - Bellman-Ford):
-
Principle: Each router knows distance (cost) to destination and next-hop. Shares its entire table with neighbors periodically.
-
Equation: $$\displaystyle D_x(y) = \min_v \{ c(x,v) + D_v(y) \} $$ where
xis current router,vis neighbor,yis destination. -
Example: Given a graph with costs, each router iteratively updates its table based on neighbor's vectors.
-
Problems: Count-to-infinity, slow convergence, routing loops.
-
RIP (Routing Information Protocol): Uses DVR, hop count metric (max 15 hops). Solutions: Split horizon (don't advertise route back to source), Poison reverse (advertise infinite metric back).
2. Link State Routing (LSR - Dijkstra's SPF):
-
Principle: Each router has complete map of network (link state database). Runs Dijkstra's algorithm to compute shortest path tree.
-
Steps:
-
Flooding: LSAs (Link State Advertisements) flooded to all routers.
-
Database Sync: All routers have identical LSDB.
-
SPF Computation: Dijkstra's on LSDB from self as root.
-
-
Example: Given graph with link costs, compute shortest path tree.
-
Advantages: Fast convergence, no count-to-infinity, supports complex metrics.
-
Disadvantages: High memory/CPU overhead on large networks.
DVR vs LSR Comparison:
| Feature | DVR | LSR |
|---|---|---|
| Info Shared | Entire distance vector | Link state of own links |
| Convergence | Slow, "bad news travels slow" | Fast |
| Overhead | Periodic full table updates | Event-driven LSA flooding |
| Robustness | Poor (loops, count-to-infinity) | Good |
| Example | RIP, IGRP | OSPF, IS-IS |
B. Routing Metrics & Path Determination
-
Metrics: Hop count, bandwidth, delay, cost, reliability, load.
-
Best Path: Based on metric (e.g., shortest path = min sum of costs).
-
Multi-Path Routing: ECMP (Equal-Cost Multi-Path) uses multiple equal-cost paths.
C. Special Routing
-
Broadcast Routing: Send packet to all nodes.
-
Flooding: Forward on all interfaces except incoming (needs TTL, sequence # to prevent loops).
-
Reverse Path Forwarding (RPF): Forward only if incoming interface is on shortest path back to source.
-
-
Multicast Routing: Send packet to group of interested nodes.
-
Tree-Based: Source-specific tree or shared tree (e.g., PIM - Protocol Independent Multicast).
-
DVMRP (Distance Vector Multicast Routing Protocol): Uses reverse path, tunnels for non-multicast routers.
-
D. IP Addressing
1. Classful Addressing (Legacy):
| Class | First Bit | Network ID | Host ID | Default Mask | Range |
|---|---|---|---|---|---|
| A | 0 |
8 bits | 24 bits | 255.0.0.0 |
1.0.0.0 – 126.255.255.255 |
| B | 10 |
16 bits | 16 bits | 255.255.0.0 |
128.0.0.0 – 191.255.255.255 |
| C | 110 |
24 bits | 8 bits | 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 |
- Limitations: Waste of addresses (e.g., Class B too big for many orgs), rapid routing table growth.
2. CIDR (Classless Inter-Domain Routing):
-
Notation:
a.b.c.d / nwheren= network prefix length. -
Aggregation (Supernetting): Combine multiple 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.0.0/22.
3. Subnetting:
-
Concept: Divide a larger network (
/n) into smaller subnets by borrowing bits from host ID. -
Subnet Mask:
255.255.255.0=/24. Network ID = IP AND Mask. -
VLSM (Variable Length Subnet Mask): Allocate subnets of different sizes based on need (e.g., /26, /27).
-
Calculation Example (from past papers):
-
Given:
192.168.10.0/24→ Divide into 4 subnets. -
Borrow 2 bits (2²=4). New mask:
/26=255.255.255.192. -
Subnets:
-
192.168.10.0/26→ Range:192.168.10.1–192.168.10.62, BC:192.168.10.63 -
192.168.10.64/26→ Range:192.168.10.65–192.168.10.126, BC:192.168.10.127 -
192.168.10.128/26→ Range:192.168.10.129–192.168.10.190, BC:192.168.10.191 -
192.168.10.192/26→ Range:192.168.10.193–192.168.10.254, BC:192.168.10.255
-
-
4. IPv4 vs IPv6:
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Length | 32 bits | 128 bits |
| Notation | Dotted decimal (192.168.1.1) |
Hexadecimal (2001:0db8:85a3::8a2e:0370:7334) |
| Header Size | 20-60 bytes (variable) | Fixed 40 bytes (no options) |
| Extension Headers | No | Yes (Hop-by-Hop, Routing, Fragment, etc.) |
| Fragmentation | By routers & source | Only by source |
| Addressing | Classful (legacy) / CIDR | Hierarchical, no classes |
| Autoconfig | Manual/DHCP | Stateless Address Autoconfig (SLAAC) |
| Security | Optional (IPsec) | Mandatory IPsec support |
| Checksum | Header checksum | No header checksum |
E. Network Layer Protocols
1. ARP (Address Resolution Protocol):
-
Function: Map IP address → MAC address on local network.
-
Operation: Broadcast ARP request: "Who has IP X? Tell Y (MAC)." Owner replies with ARP reply (unicast).
-
ARP Cache: Table of IP-MAC mappings, timeout-based.
-
Proxy ARP: Router answers ARP for another host, making remote host appear local.
2. RARP (Reverse ARP):
-
Function: Map MAC address → IP address (diskless workstations booting).
-
Operation: RARP request broadcast with MAC; RARP server replies with IP.
-
Replaced by: BOOTP and DHCP.
3. ICMP (Internet Control Message Protocol):
-
Role: Error reporting & diagnostics for IP (which is connectionless).
-
Common Messages:
-
Echo Request/Reply: Used by
ping. -
Destination Unreachable: (Port unreachable, host unreachable).
-
Time Exceeded: Used by
traceroute(TTL=0). -
Source Quench: Deprecated (congestion signal).
-
Redirect: Suggest better next-hop.
-
-
Tools:
ping(ICMP Echo),traceroute(ICMP Time Exceeded).
F. Congestion Control in Network Layer
Causes: Buffer overflow, slow processors, low bandwidth. QoS Parameters: Throughput, delay, jitter, loss.
Techniques:
-
Load Shedding: Drop packets when overloaded.
- Policies: Random, priority-based, round-robin.
-
Traffic Shaping: Regulate data rate.
-
Leaky Bucket: Fixed output rate; bursty input smoothed. Packets can be lost if bucket full.
-
Token Bucket: Tokens accumulate at rate
r; burst up tobtokens allowed. No loss if tokens available.
-
-
Congestion Avoidance:
- RED (Random Early Detection): Probabilistically drop packets before queue full, to signal senders to slow down. Prevents global sync.
G. Network Layer Services
| Feature | Virtual Circuit Subnet | Datagram Subnet |
|---|---|---|
| Connection | Connection-oriented (setup phase). | Connectionless (no setup). |
| Routing | Route determined at setup; all packets follow same path. | Route determined per-packet; may differ. |
| State | Router maintains VC state (VC #). | No state; each packet independent. |
| Reliability | Can provide reliable delivery (e.g., Frame Relay with FECN/BECN). | Best-effort (like IP). |
| Example | Frame Relay, ATM, X.25 | IP (Internet) |
H. Router and Gateway Functions
Router Operations:
-
Forwarding: Move packet from input to output port (performed by forwarding plane; fast, hardware-based).
-
Routing: Compute best path (performed by control plane; runs routing protocols).
-
Queuing: Manage multiple packets for same output (FIFO, priority, WFQ).
-
Switching: Internal fabric moves packet from input to output queue.
Gateway: Device that operates at Application Layer (7) to connect dissimilar networks (e.g., email gateway converts SMTP ↔ X.400, protocol translator).
IV. Transport Layer
A. Transport Services
-
Connection-Oriented (TCP): Reliable, in-order, congestion-controlled, flow-controlled.
-
Connectionless (UDP): Unreliable, unordered, no congestion control.
-
Multiplexing/Demultiplexing: Uses port numbers to deliver data to correct process.
-
Flow Control: Receiver-driven (receiver advertises window size).
-
Congestion Control: Network-aware (sender adjusts rate based on network congestion signals).
B. Transmission Control Protocol (TCP)
1. TCP Header Format (20 bytes min):
[Source Port (16)] [Dest Port (16)] [Sequence # (32)] [Ack # (32)]
[Data Offset (4)] [Reserved (6)] [Flags (6)] [Window (16)]
[Checksum (16)] [Urgent Pointer (16)] [Options (variable)]
-
Flags: URG, ACK, PSH, RST, SYN, FIN.
-
Data Offset: Header length in 32-bit words.
-
Window: Receiver's available buffer size (flow control).
2. Connection Management:
-
Three-Way Handshake (Establishment):
-
Client → Server:
SYN=1, seq=x -
Server → Client:
SYN=1, ACK=1, seq=y, ack=x+1 -
Client → Server:
ACK=1, seq=x+1, ack=y+1
-
-
Four-Way Handshake (Termination - Graceful):
-
Client → Server:
FIN=1, seq=u -
Server → Client:
ACK=1, ack=u+1(may still send data) -
Server → Client:
FIN=1, ACK=1, seq=v, ack=u+1 -
Client → Server:
ACK=1, seq=u+1, ack=v+1
-
-
Why Graceful Termination? Ensures all data delivered, resources released properly.
TIME_WAIT(2MSL) ensures last ACK received & old duplicate packets expire.
3. Reliable Data Transfer:
-
Sequence Numbers: Byte-oriented, not packet-oriented.
-
Acknowledgment: Cumulative ACK (acknowledges all bytes up to
ack#). Selective ACK (SACK) option for out-of-order. -
Retransmission: RTO (Retransmission Timeout) estimated from RTT (Round-Trip Time) samples.
-
Flow Control: Receiver advertises rwnd (receiver window) in header. Sender's effective window =
min(cwnd, rwnd).
4. Congestion Control (TCP Reno):
-
Variables:
cwnd(congestion window),ssthresh(slow start threshold). -
Phases:
-
Slow Start:
cwndstarts at 1 MSS, doubles each RTT (exponential) untilcwnd ≥ ssthreshor loss. -
Congestion Avoidance:
cwndincreases by 1 MSS per RTT (additive increase). -
Fast Retransmit: 3 duplicate ACKs → retransmit missing segment without waiting for RTO.
-
Fast Recovery: On 3 dupACKs, set
ssthresh = cwnd/2,cwnd = ssthresh + 3, then additive increase.
-
-
AIMD (Additive Increase Multiplicative Decrease): Core principle: increase slowly, cut in half on loss.
C. User Datagram Protocol (UDP)
-
Header Format (8 bytes):
[Source Port (16)] [Dest Port (16)] [Length (16)] [Checksum (16)] -
Characteristics: Connectionless, unreliable, no congestion control, no flow control, no ordering. Low overhead, low latency.
-
Applications: DNS, VoIP, streaming, DHCP, SNMP.
-
Comparison with TCP:
| Feature | TCP | UDP | | :--- | :--- | :--- | | Connection | Connection-oriented | Connectionless | | Reliability | Yes (ACK, retransmit) | No | | Ordering | Yes | No | | Congestion Control | Yes | No | | Overhead | High (20+ bytes) | Low (8 bytes) | | Use Case | File transfer, web, email | Real-time, query-response |
[!TIP] Exam Focus: TCP 3-way/4-way handshake, congestion control phases (slow start → congestion avoidance), UDP header fields.
V. Application Layer
A. Domain Name System (DNS)
-
Need: Human-readable names → IP addresses.
-
Hierarchy: Root servers → TLD (
.com,.org,.in) → Authoritative servers → Local/recursive resolvers. -
Resolution:
-
Iterative Query: Server returns referral to next server if not authoritative.
-
Recursive Query: Server does full lookup on behalf of client (typical for resolvers).
-
-
Caching: Each server caches results with TTL (Time to Live). Reduces latency and traffic.
-
Common Records:
A(IPv4),AAAA(IPv6),MX(mail exchange),CNAME(canonical name),NS(name server).
B. Electronic Mail
-
Architecture:
-
User Agent (UA): Email client (Outlook, Thunderbird).
-
MTA (Mail Transfer Agent): Server that transfers mail (SMTP).
-
MDA (Mail Delivery Agent): Delivers to mailbox.
-
-
SMTP (Simple Mail Transfer Protocol):
-
Operation: TCP port 25. Push protocol (sender to receiver's MTA).
-
Commands:
HELO,MAIL FROM,RCPT TO,DATA,QUIT. -
ESMTP (Extended SMTP): Supports MIME (multimedia), authentication, TLS.
-
-
Retrieval: POP3 (download & delete), IMAP (keep on server, manipulate folders).
C. World Wide Web and HTTP
-
HTTP (Hypertext Transfer Protocol):
-
Request-Response Model: Client (browser) sends request, server sends response.
-
Methods:
GET(fetch),POST(submit data),HEAD,PUT,DELETE. -
Stateless: Server doesn't retain session info between requests. Cookies used for state.
-
Versions:
-
HTTP/1.0: New TCP connection per request (non-persistent).
-
HTTP/1.1: Persistent connections (keep-alive), pipelining, chunked encoding.
-
HTTP/2: Multiplexing over single TCP, header compression, server push.
-
HTTPS: HTTP over TLS/SSL (port 443). Provides encryption, server authentication.
-
-
D. Network Management (SNMP)
-
SNMP (Simple Network Management Protocol):
-
Architecture:
-
Manager: Central monitoring system.
-
Agent: Software on managed device (router, switch).
-
MIB (Management Information Base): Database of manageable objects (variables).
-
-
Operations:
-
GET: Manager reads variable. -
SET: Manager changes variable. -
TRAP: Agent sends unsolicited alert (e.g., link down).
-
-
E. File Transfer (FTP)
-
FTP (File Transfer Protocol):
-
Two Connections:
-
Control Connection (TCP port 21): Commands/responses (persistent).
-
Data Connection (TCP port 20 or dynamic): Actual file data (opened/closed per transfer).
-
-
Active Mode: Server opens data connection to client (client specifies port via
PORT). -
Passive Mode: Client opens data connection to server (server specifies port via
PASV). Firewall-friendly.
-
F. Other Application Layer Protocols (Brief)
-
Telnet: Remote login (unencrypted, port 23). Replaced by SSH.
-
SSH (Secure Shell): Encrypted remote login (port 22).
-
DHCP (Dynamic Host Configuration Protocol): Dynamically assign IP, mask, gateway, DNS to clients. DORA process: Discover, Offer, Request, Acknowledgment.
VI. Additional and Cross-Cutting Topics
A. Network Topologies & Design (Recap)
See Section I.D for detailed table. Design Considerations: Cost, scalability, fault tolerance, performance, ease of installation.
B. Network Devices Deep Dive (Recap)
See Section I.E. Key Decision Point: Layer 2 (MAC) vs Layer 3 (IP) forwarding:
-
Switch/Bridge: Uses MAC address table; forwards within same network.
-
Router: Uses routing table; forwards between different networks.
C. Multiplexing Techniques (Recap)
See Section II.B.3. FDM (frequency bands), TDM (time slots), WDM (wavelengths on fiber).
D. Cryptography and Security (Basics)
-
Symmetric Encryption: Same key for encrypt/decrypt (AES, DES). Fast, key distribution problem.
-
Asymmetric Encryption: Public/private key pair (RSA). Slower, solves key distribution.
-
Digital Signature: Hash of message encrypted with sender's private key. Provides authentication, non-repudiation.
-
Digital Certificate: Binds public key to entity, signed by CA (Certificate Authority).
-
Firewalls:
-
Packet Filtering: Stateless; examines packet headers.
-
Stateful Inspection: Tracks connection state.
-
Application-Level Gateway (Proxy): Deep packet inspection at App layer.
-
E. Service Primitives (OSI Model - Recap)
See Section I.A. Example in Transport Layer (TCP):
-
Transport Layer (4) requests from Application (5):
TRANSPORT_CONNECT.request(dest_port) -
Transport Layer (4) indicates to Application (5):
TRANSPORT_DATA.indication(data) -
Application (5) responds:
TRANSPORT_DATA.response(ack) -
Transport Layer (4) confirms:
TRANSPORT_CONNECT.confirm()
F. Quality of Service (QoS) in Depth
-
Parameters:
-
Throughput: Data delivered per unit time.
-
Delay: Time from send to receive.
-
Jitter: Variation in delay (critical for real-time).
-
Loss: Packet loss rate.
-
-
Mechanisms:
-
Priority Queuing: Classes with priorities.
-
Weighted Fair Queuing (WFQ): Each flow gets weighted share.
-
IntServ (Integrated Services): Per-flow resource reservation (RSVP). Not scalable.
-
DiffServ (Differentiated Services): Per-hop behavior (PHB) based on DSCP bits in IP header. Scalable.
-
G. Performance Evaluation
-
Throughput: Actual achieved data rate.
-
Efficiency: Throughput / Channel capacity.
-
Delay Components:
$$ \text{Total Delay} = \text{Transmission Delay} + \text{Propagation Delay} + \text{Queuing Delay} + \text{Processing Delay} $$
* **Transmission Delay:** $$\displaystyle \frac{\text{Frame Size (bits)}}{\text{Bandwidth (bps)}} $$
* **Propagation Delay:** $$\displaystyle \frac{\text{Distance (m)}}{\text{Propagation Speed (m/s)}} $$
- Example (Stop-and-Wait Efficiency): As in Section II.D.1: $$\displaystyle U = \frac{1}{1 + 2a} $$ where $$\displaystyle a = \frac{T_{prop}}{T_{trans}} $$.
END OF UNIT 3 NOTES