Skip to content
CY-403 · Computer Networks/Quick Revision Short Notes

Computer Networks (CY-403) - Unit 3 Short Notes

UNIT 3: COMPUTER NETWORKS


I. INTRODUCTION TO COMPUTER NETWORKS

Definition: A computer network is an interconnected collection of autonomous computers that communicate and share resources.

Key Components:

  • Hosts/End Systems: Sources/destinations of data (computers, servers).

  • Routers: Forward packets between networks (Network layer).

  • Links/Communication Channels: Guided (cables) or unguided (wireless) media.

  • Protocols: Rules governing data exchange (e.g., TCP, IP, HTTP).

Network Types (by scale):

Type Range Example
PAN ~10 m Bluetooth, Zigbee
LAN ~1-5 km Ethernet, Wi-Fi (single building/campus)
MAN ~5-50 km City-wide cable/DSL network
WAN >100 km Internet,跨-country fiber links
Internetwork Global The Internet (interconnected WANs)

Network Criteria:

  • Performance: Throughput, delay, jitter, bandwidth.

  • Reliability: Delivery accuracy, fault tolerance (redundant paths).

  • Security: Confidentiality, integrity, access control.

[!TIP] Exam Focus: Be ready to differentiate network types by geographical scope and typical technologies. Performance metrics often appear in numerical problems (delay, throughput).


II. REFERENCE MODELS

A. OSI REFERENCE MODEL (7 LAYERS)

Peer-to-Peer Communication: Each layer at source communicates with its peer at destination using protocol data units (PDUs).

Layer Functions:

  1. Physical: Bits over medium (voltage, timing). Devices: repeaters, hubs.

  2. Data Link: Frames, error control (CRC), flow control. MAC addresses. Devices: switches, bridges.

  3. Network: Packets, routing, logical addressing (IP). Device: router.

  4. Transport: Segments, end-to-end reliability, flow control. Ports. Protocols: TCP, UDP.

  5. Session: Dialog control (synchronization), checkpointing.

  6. Presentation: Syntax/semantics (encryption, compression, MIME).

  7. Application: User services (HTTP, FTP, SMTP).

Service Primitives (between adjacent layers):

  • REQUEST (upper → lower)

  • INDICATION (lower → upper, event notification)

  • RESPONSE (upper → lower, after indication)

  • CONFIRM (lower → upper, after request)

Critique/Limitations:

  • Complexity: Too many layers, some redundant.

  • Implementation: Protocol stack overhead; some layers (Session, Presentation) merged in practice.

  • Timing: Designed before Internet boom; not optimized for modern needs.

OSI vs TCP/IP Comparison:

Feature OSI Model TCP/IP Model
Layers 7 (Physical to Application) 4 (Link, Internet, Transport, Application)
Approach Theoretical, general Practical, protocol-centric
Network Layer Connection-oriented (virtual circuits) Connectionless (datagram, IP)
Transport Layer Both (TP4 connection-oriented, TP0-3 connectionless) Both (TCP connection-oriented, UDP connectionless)
Session/Presentation Separate layers Merged into Application layer
Standardization ISO (theoretical) IETF (RFCs, practical)
Protocols Not tied to specific protocols TCP, IP, UDP, HTTP, etc. built-in

[!TIP] Exam Focus: Know all 7 OSI layers in order (mnemonic: "All People Seem To Need Data Processing"). Contrast OSI's theoretical separation with TCP/IP's pragmatic merging. TCP/IP's Internet layer = OSI's Network layer.


B. TCP/IP REFERENCE MODEL

Layers & Protocols:

  1. Link Layer (Network Interface): Ethernet (802.3), Wi-Fi (802.11), PPP, ARP.

  2. Internet Layer: IP (IPv4/IPv6), ICMP, IGMP. Core: packet routing.

  3. Transport Layer: TCP (reliable), UDP (unreliable).

  4. Application Layer: HTTP, FTP, SMTP, DNS, SNMP (merges OSI's Session/Presentation/Application).

Advantages:

  • Practical: Protocols are defined alongside model.

  • Scalable: Connectionless IP simplifies routing.

  • Interoperable: Open standards (RFCs) ensure multi-vendor compatibility.

  • Robust: Best-effort delivery; reliability added at endpoints (TCP).

Disadvantages:

  • Model-Layer Mismatch: Doesn't clearly separate concerns (e.g., no clear Session layer).

  • Security: Not designed with security in mind (add-ons like TLS/SSL).

  • Complexity: Many protocols at Application layer; no strict layering enforcement.

Standardization Process:

  • RFCs (Request for Comments): Primary documents (e.g., RFC 791 for IPv4).

  • IETF (Internet Engineering Task Force): Develops and promotes Internet standards.

  • IESG (Internet Engineering Steering Group): Approves RFCs as standards.

  • STD series: Track of approved standards (e.g., STD 5 for TCP).

[!TIP] Exam Focus: Memorize the 4 TCP/IP layers and key protocols per layer. Understand why TCP/IP succeeded over OSI (pragmatism, timing, open standards). RFCs/IETF role is often asked.


III. PHYSICAL LAYER

A. TRANSMISSION MEDIA

Guided Media (signals confined to a physical path):

Media Type Characteristics Use Case
Twisted Pair UTP (Unshielded), STP (Shielded) 100 m max, cheap, EMI susceptible Ethernet (Cat5e/6), telephone
Coaxial Cable Thick/Thin 500 m, better shielding than UTP Legacy Ethernet (10BASE2/5), cable TV
Fiber Optic Single-mode (SMF), Multi-mode (MMF) 100+ km, very high BW, immune to EMI, expensive Backbones, FTTH, long-haul

Unguided Media (wireless propagation):

  • Radio Waves: Omnidirectional, penetrate walls (Wi-Fi, Bluetooth, cellular).

  • Microwaves: Directional, line-of-sight, high BW (satellite, point-to-point links).

  • Infrared: Short range, line-of-sight, secure (remote controls, IrDA).

  • Satellite: Geostationary (36,000 km, ~0.5s delay) vs LEO (low delay).

Broadband Technologies:

  • DSL (Digital Subscriber Line): Uses existing phone lines; ADSL (asymmetric), VDSL (higher speed, shorter distance).

  • Cable Modem: Shared coaxial cable; DOCSIS standards; contention-based.

  • FTTH (Fiber to the Home): Direct fiber; highest speed (GPON, EPON).

B. DATA RATE AND CAPACITY

Nyquist Formula (noiseless channel):

$$ \text{Max bit rate} = 2B \log_2 M \text{ bps} $$

  • $B$ = bandwidth (Hz)

  • $M$ = number of signal levels (discrete)

Example: $$\displaystyle B=3 $$ kHz, $$\displaystyle M=4 $$ (2 bits/signal) → $$\displaystyle 2 \times 3000 \times \log_2 4 = 12,000 $$ bps.

Shannon's Theorem (noisy channel):

$$ C = B \log_2 (1 + \text{SNR}) \text{ bps} $$

  • $C$ = channel capacity (max error-free data rate)

  • $B$ = bandwidth (Hz)

  • $\text{SNR}$ = signal-to-noise ratio (linear, not dB)

Note: SNR in dB → linear: $$\displaystyle \text{SNR}_{\text{linear}} = 10^{\text{SNR}_{\text{dB}}/10} $$

[!TIP] Exam Focus: Nyquist assumes no noise; Shannon gives theoretical max for noisy channels. Know how to convert SNR from dB. Questions often ask: "If signal levels double, how does Nyquist rate change?" (Answer: increases by $$\displaystyle \log_2 2 = 1 $$ bit/signal).

C. MULTIPLEXING

Frequency Division Multiplexing (FDM):

  • Each signal modulated to different frequency bands.

  • Guard bands prevent interference.

  • Used in radio/TV broadcasting, DSL (separate voice/data bands).

Time Division Multiplexing (TDM):

  • Synchronous TDM: Fixed time slots; if a source has no data, slot is empty (wasted).

  • Statistical TDM: Slots allocated dynamically; more efficient.

  • Frame Size Calculation:

    • For $n$ sources, each with $k$ bits per slot, plus overhead $h$ bits/frame:

$$ \text{Frame size} = n \times k + h \text{ bits} $$

  • Data rate = frame size / frame time.

Example: 3 sources (100, 200, 150 bits/slot), 1 framing bit → frame size = $$\displaystyle 3 \times 200 + 1 = 601 $$ bits (max slot size = 200). If frame time = 125 µs → data rate = $$\displaystyle 601 / 125 \times 10^{-6} = 4.808 $$ Mbps.

D. LINE CODING

Manchester Encoding:

  • Transition in middle of bit period: low→high for '1', high→low for '0' (or vice versa, convention varies).

  • Self-clocking (synchronization built-in).

  • Example: 010 → ↓↑↑↓ (if 1=low→high, 0=high→low).

Differential Manchester:

  • Transition at start of bit period always present.

  • Meaning: Presence/absence of mid-bit transition encodes bit.

    • '0': transition at start and middle.

    • '1': transition only at start.

  • More immune to noise (inversion doesn't change meaning).

[!TIP] Exam Focus: Draw waveforms for given binary strings. Manchester has a transition every half-bit; Differential Manchester has a transition at every bit boundary plus mid-bit for '0'.


IV. DATA LINK LAYER

A. FUNCTIONS AND SERVICES

  • Framing: Delineate frame boundaries (bit/byte stuffing).

  • Physical Addressing: MAC addresses.

  • Error Control: Detection (CRC), correction (Hamming, FEC).

  • Flow Control: Prevent fast sender overwhelming slow receiver.

  • Link Management: Establish, maintain, release links.

  • Access Control: Multiple access on shared media (MAC protocols).

B. ERROR DETECTION AND CORRECTION

Parity Check:

  • Vertical: Parity bit per data unit (byte/word).

  • Horizontal: Parity across multiple units (detects burst errors).

  • Limitation: Only detects odd number of bit errors; cannot correct.

CRC (Cyclic Redundancy Check):

  • Generator Polynomial $C(x)$: Divisor (e.g., $10011$ for CRC-4).

  • Codeword Generation:

    1. Append $r$ zeros to data $D(x)$ ($$\displaystyle r = \deg C(x) $$).

    2. Divide $$\displaystyle D(x) \cdot x^r $$ by $C(x)$ (modulo-2 division).

    3. Remainder $R(x)$ is CRC checksum.

    4. Transmit $$\displaystyle D(x) \cdot x^r + R(x) $$.

  • Error Detection: Receiver divides by same $C(x)$; non-zero remainder → error.

Example: Data 1101011011, $$\displaystyle C(x)=10011 $$ (CRC-4).

  • Append 4 zeros: 11010110110000.
  • Divide by 10011 (XOR division).
  • Remainder = 1100 → transmitted codeword = 11010110111100.

Hamming Code (single-bit error correction):

  • $k$ data bits, $r$ parity bits where $$\displaystyle 2^r \ge k + r + 1 $$.

  • Parity bits at positions $$\displaystyle 2^i $$ (1,2,4,8,...).

  • Each parity bit covers specific data bits (based on binary index).

  • Receiver: syndrome calculation → error position.

Hybrid ARQ:

  • Combines ARQ (retransmission on error) + FEC (forward error correction).

  • Types:

    • Type I: Send FEC code; correct errors without retransmission if possible.

    • Type II: Incremental redundancy; send parity bits only if NACK received.

C. DATA LINK PROTOCOLS

HDLC (High-Level Data Link Control):

  • Frame Format:

    
    Flag (01111110) | Address | Control | Info | FCS | Flag
    
    
  • Operational Modes:

    • NRM (Normal Response Mode): Primary (master) initiates, secondary responds.

    • ABM (Asynchronous Balanced Mode): Both stations equal (peer-to-peer); used in PPP.

    • ARM (Asynchronous Response Mode): Secondary can transmit without permission.

PPP (Point-to-Point Protocol):

  • Phases: Link establishment (LCP), authentication (PAP/CHAP), network layer (NCP), termination.

  • Frame Format:

    
    Flag (7E) | Address (FF) | Control (03) | Protocol | Payload | FCS | Flag
    
    
    • Protocol field: 0x0021 (IP), 0xC021 (LCP), etc.
  • Comparison with SLIP:

    | Feature | SLIP | PPP | |---------|------|-----| | Multi-protocol | No (only IP) | Yes (IP, IPX, AppleTalk) | | Error detection | No | Yes (FCS) | | Authentication | No | Yes (PAP/CHAP) | | Dynamic IP assignment | No | Yes (via IPCP) | | Link configuration | No | Yes (LCP) |

SLIP Limitations: No error detection, no multi-protocol, no dynamic IP, no compression.

Frame Relay (brief):

  • Architecture: Virtual circuits (PVCs/SVCs), no error correction (only error detection), high-speed packet switching.

  • Functions: Frame delimiting, congestion notification (FECN/BECN bits), minimal processing.

D. FRAMING AND STUFFING

Bit Stuffing (HDLC-like):

  • Flag = 01111110.

  • Sender: Insert '0' after five consecutive '1's in data to avoid flag mimicry.

  • Receiver: Remove '0' after five '1's.

Example: Data 01111110 → stuffed 011111010 (insert 0 after five 1s).

Byte Stuffing (character-oriented, e.g., PPP in byte mode):

  • Escape character (e.g., 0x7D) used.

  • If data byte = flag (0x7E) or escape (0x7D), send 0x7D followed by XOR'd byte.

Example: Data 0x7E → transmit 0x7D 0x5E (since 0x7E XOR 0x20 = 0x5E).

E. FLOW AND ERROR CONTROL

Stop-and-Wait Protocol:

  • 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}} $$.

  • Buffer Management: Sender needs 1 buffer; receiver needs 1 buffer (or discards duplicate ACKs).

  • Limitation: Low utilization for long propagation delays (high $a$).

Sliding Window Protocol:

  • Go-Back-N (GBN):

    • Sender window size $$\displaystyle W_s $$, receiver window $$\displaystyle W_r = 1 $$.

    • Cumulative ACKs: ACK for $N$ means all frames $\le N$ received correctly.

    • On timeout or duplicate ACK, retransmit all unacknowledged frames from $N+1$ onward.

    • Utilization $$\displaystyle U = \frac{W_s}{1+2a} $$ (if $$\displaystyle W_s \le 2a+1 $$); else $U \approx 1$.

  • Selective Repeat (SR):

    • Both windows size $$\displaystyle W_s = W_r \le 2^{k-1} $$ ($k$ = seq bits).

    • Individual ACKs; retransmit only missing frames.

    • Receiver buffers out-of-order frames.

    • More efficient than GBN but complex (requires buffering).

Piggybacking:

  • Attaching ACK to data frames going in reverse direction (instead of separate ACK frames).

  • Improves efficiency in bidirectional communication (e.g., in full-duplex links).

F. MULTIPLE ACCESS PROTOCOLS (MAC)

Static vs Dynamic Channel Allocation:

  • Static: Fixed assignment (FDMA, TDMA). Wastes bandwidth if inactive.

  • Dynamic: On-demand (ALOHA, CSMA). Better for bursty traffic.

Random Access Protocols:

  • Pure ALOHA:

    • Transmit anytime; collisions possible.

    • Vulnerable period = $$\displaystyle 2 \times T_{\text{frame}} $$ (any overlap).

    • Throughput $$\displaystyle S = G e^{-2G} $$ ($G$ = offered load).

    • Max throughput = $1/(2e) \approx 0.184$ at $$\displaystyle G=0.5 $$.

  • Slotted ALOHA:

    • Time slots = frame time; transmit only at slot start.

    • Vulnerable period = $$\displaystyle T_{\text{frame}} $$.

    • Throughput $$\displaystyle S = G e^{-G} $$.

    • Max throughput = $1/e \approx 0.368$ at $$\displaystyle G=1 $$.

Carrier Sense Multiple Access (CSMA):

  • Sense channel before transmitting.

  • 1-persistent: If idle, transmit immediately; if busy, wait until idle then transmit (high collision probability).

  • Non-persistent: If busy, wait random time, then sense again (reduces collisions, increases delay).

  • p-persistent (for slotted): If idle, transmit with probability $p$, else defer to next slot.

  • Binary Exponential Backoff (BEB) (Ethernet):

    • After $i$-th collision, wait random $$\displaystyle k \times T_{\text{slot}} $$, $$\displaystyle k \in [0, 2^i-1] $$.

    • Example: After 3 collisions, $k \in [0,7]$.

CSMA/CD (Collision Detection):

  • Used in wired Ethernet (bus/star).

  • Jam signal on collision; abort transmission.

  • Minimum Frame Size to ensure collision detection:

$$ \text{Min frame size} \ge 2 \times \text{propagation delay} \times \text{bandwidth} $$

  • Must transmit for $2 \times \text{round-trip propagation time}$ to detect collision.

Example: 2 km cable, signal speed $$\displaystyle 2 \times 10^8 $$ m/s → propagation delay = $$\displaystyle 2 \times 10^3 / 2 \times 10^8 = 10 \mu s $$. Round-trip = $20 \mu s$. Bandwidth 10 Mbps → min frame = $$\displaystyle 20 \times 10^{-6} \times 10 \times 10^6 = 200 $$ bits = 25 bytes.

CSMA/CA (Collision Avoidance):

  • Used in wireless (Wi-Fi 802.11).

  • RTS/CTS (optional): Request-to-send / Clear-to-send handshake to avoid hidden terminal problem.

  • DIFS/SIFS: Inter-frame spaces; higher priority for short frames (ACK).

G. LAN STANDARDS (IEEE 802)

Standard Access Method Topology Frame Format Highlights Performance Notes
802.3 Ethernet CSMA/CD Bus (logical), Star (physical) Preamble, Dest/Src MAC, Type/Length, Data, FCS High speed (10 Mbps → 400 Gbps); switches dominate now
802.4 Token Bus Token passing Logical bus, physical star Token, priority, data fields Deterministic; used in manufacturing (declining)
802.5 Token Ring Token passing Ring (logical & physical) Start/end delimiters, address, data, FCS 4/16 Mbps; monitor station handles token recovery; beaconing on failure
802.11 Wi-Fi CSMA/CA (DCF), PCF (optional) BSS (single AP), ESS (multiple APs) Frame control, duration, addr1-4, seq, data, FCS Infrastructure/ad-hoc; rates up to 10 Gbps (Wi-Fi 6/6E)
FDDI Token passing Dual ring (primary/secondary) Similar to Token Ring but faster (100 Mbps) Fault-tolerant (secondary ring for backup)

MAC Addressing (48-bit, IEEE 802):

  • Format: AA:BB:CC:DD:EE:FF (hex).

    • OUI (first 3 bytes): Assigned to manufacturer.

    • NIC specific (last 3 bytes): Manufacturer-assigned.

  • Types:

    • Unicast: Specific station (LSB of first byte = 0).

    • Multicast: Group of stations (LSB = 1, e.g., 01:00:5E for IPv4 multicast).

    • Broadcast: FF:FF:FF:FF:FF:FF (all stations on LAN).

[!TIP] Exam Focus: Compare Ethernet vs Token Ring vs Wi-Fi access methods. Know CSMA/CD minimum frame calculation. MAC address types: unicast (individual), multicast (group), broadcast (all). OUI concept.


V. NETWORK LAYER

A. FUNCTIONS AND DESIGN ISSUES

  • Routing: Path selection (source, intermediate routers).

  • Forwarding: Move packet from input to output link (per-hop).

  • Logical Addressing: IP addresses (hierarchical).

  • Fragmentation/Reassembly: MTU differences.

  • Congestion Control: Avoid gridlock (cooperation with Transport layer).

  • Inter-networking: Connect heterogeneous networks (via routers).

B. ROUTING ALGORITHMS

Distance Vector Routing (DVR):

  • Bellman-Ford Equation:

$$ D_x(y) = \min_{v \in \text{neighbors}} \left\{ c(x,v) + D_v(y) \right\} $$

  • $$\displaystyle D_x(y) $$ = cost from $x$ to $y$ as known by $x$.

  • $c(x,v)$ = cost of link $(x,v)$.

  • RIP (Routing Information Protocol):

    • Metric = hop count (max 15 hops).

    • Updates every 30 sec (or triggered).

    • Count-to-infinity problem: Slow convergence; solutions: split horizon, poison reverse.

  • Example: Given neighbor vectors, compute new distance vector.

Link State Routing (LSR):

  • Dijkstra's Algorithm (Shortest Path First):

    1. Initialize: $$\displaystyle L(1)=0 $$, $$\displaystyle L(v)=\infty $$ for others; $$\displaystyle N' = \{1\} $$.

    2. Find $w \notin N'$ with smallest $L(w)$; add to $N'$.

    3. Update $L(v)$ for $v \in N - N'$: $$\displaystyle L(v) = \min(L(v), L(w) + c(w,v)) $$.

    4. Repeat until all nodes in $N'$.

  • LSP Flooding: Each router broadcasts its link state to all others (reliable flooding).

  • Database Synchronization: Each router has identical link-state database (LSDB).

  • OSPF (Open Shortest Path First) uses LSR.

Comparison:

Aspect Distance Vector Link State
Information exchanged Entire distance vector (periodic) Link state packets (on change)
Convergence Slow (count-to-infinity) Fast (event-driven)
Overhead High periodic traffic High initial flood, then low
Scalability Poor (large tables) Better (hierarchical OSPF areas)
Complexity Simple (Bellman-Ford) Complex (Dijkstra, LSDB maintenance)
Example RIP, IGRP OSPF, IS-IS

C. CONGESTION CONTROL

Causes: Buffer overflow, slow processors, low bandwidth. Principles:

  • Open-loop: Prevent congestion before it happens (traffic shaping, admission control).

  • Closed-loop: Detect and recover (feedback-based).

Techniques:

  • Traffic Shaping:

    • Leaky Bucket: Fixed output rate; bursty input smoothed; may discard excess.

    • Token Bucket: Tokens arrive at rate $r$; burst up to $b$ tokens allowed; more flexible.

      • Throughput: Up to $b + r \times T$ in time $T$.
  • Load Shedding: Discard packets when overloaded.

    • RED (Random Early Detection): Probabilistically drop packets before queue full to avoid global sync.
  • QoS (Quality of Service):

    • IntServ (Integrated Services): Resource reservation (RSVP) per flow; fine-grained but not scalable.

    • DiffServ (Differentiated Services): Per-hop behavior (PHB) based on DS field (6 bits); scalable (EF, AF, BE classes).

D. IP ADDRESSING (IPv4)

Classful Addressing (legacy):

Class First Bit Range (first octet) Default Mask Networks Hosts/Net
A 0 1–126 255.0.0.0 (/8) 126 16,777,214
B 10 128–191 255.255.0.0 (/16) 16,384 65,534
C 110 192–223 255.255.255.0 (/24) 2,097,152 254
D 1110 224–239 – (multicast) – –
E 1111 240–255 – (experimental) – –

Limitations:

  • Address depletion: Class A/B waste addresses; Class C too small.

  • Routing table explosion: Every classful network in global table.

  • No flexibility: Cannot subnet within class without extra mask.

CIDR (Classless Inter-Domain Routing):

  • Notation: a.b.c.d/n (e.g., 192.168.1.0/24).

  • Address Aggregation (Supernetting): Combine contiguous prefixes into larger block (reduce routing table).

  • Subnetting:

    • Given network N with mask M, create k subnets → need $n$ bits where $$\displaystyle 2^n \ge k $$.

    • New subnet mask = old mask + $n$ bits.

    • Subnet address: Network address incremented by block size = $$\displaystyle 2^{32-n} $$.

    • Range: First usable = subnet + 1; last usable = subnet + block size - 2; broadcast = subnet + block size - 1.

Example: 192.168.10.0/24 → 4 subnets → need 2 bits → new mask /26 (255.255.255.192). Block size = $$\displaystyle 2^{32-26}=64 $$.

  • Subnet 0: 192.168.10.0/26 → range 192.168.10.1 – 192.168.10.62, broadcast 192.168.10.63.
  • Subnet 1: 192.168.10.64/26 → range 65–126, broadcast 127.
  • Subnet 2: 192.168.10.128/26 → range 129–190, broadcast 191.
  • Subnet 3: 192.168.10.192/26 → range 193–254, broadcast 255.

Special Addresses:

  • Network address: All host bits 0 (not assignable).

  • Broadcast address: All host bits 1 (not assignable).

  • Private Addresses (RFC 1918):

    • 10.0.0.0/8

    • 172.16.0.0/12 (172.16.0.0 – 172.31.255.255)

    • 192.168.0.0/16

  • Loopback: 127.0.0.0/8 (e.g., 127.0.0.1).

E. IPv6

Motivations:

  • Address space: 128-bit ($$\displaystyle 3.4 \times 10^{38} $$ addresses).

  • Simplified header: Fixed 40-byte header; no checksum, options minimal.

  • Extension headers: Optional, after base header (routing, fragmentation, security).

  • Autoconfiguration: SLAAC (Stateless Address Autoconfiguration).

  • Built-in security: IPsec mandatory (but not always used).

Header Format (40 bytes):


Version (4) | Traffic Class (8) | Flow Label (20)

Payload Length (16) | Next Header (8) | Hop Limit (8)

Source Address (128)

Destination Address (128)

  • Next Header: Indicates extension header or upper layer (TCP=6, UDP=17).

  • Hop Limit: Like TTL.

  • Flow Label: For QoS (identify packet flow).

Address Representation:

  • Hexadecimal, colon-separated: 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

  • Zero compression: Consecutive zeros → :: (once only).

    • Example: 2001:db8::1 (compresses middle zeros).
  • IPv4-mapped IPv6: ::ffff:192.0.2.128.

Transition Mechanisms:

  • Dual Stack: Host runs both IPv4 & IPv6.

  • Tunneling: Encapsulate IPv6 in IPv4 (6to4, Teredo).

  • Translation: NAT-PT (deprecated), NAT64/DNS64.

IPv4 vs IPv6 Comparison:

Feature IPv4 IPv6
Address size 32-bit 128-bit
Header Variable (20–60 bytes) Fixed 40 bytes
Checksum Header checksum None (reliability at upper layers)
Fragmentation By router & host Only by source
Options Variable header Extension headers
Address notation Dotted decimal Hexadecimal colons
Broadcast Yes (limited broadcast, directed broadcast) No (multicast instead)
Security Optional (IPsec) Integrated (IPsec mandatory)

F. NETWORK LAYER PROTOCOLS

ARP (Address Resolution Protocol):

  • Purpose: Map IP address → MAC address (on same LAN).

  • Operation:

    1. Host checks ARP cache; if miss, broadcasts ARP request: "Who has IP X? Tell Y (MAC_y)."

    2. Owner responds with ARP reply (unicast): "IP X is at MAC_x."

    3. Both update ARP caches.

  • Proxy ARP: Router answers ARP for another host (makes remote host appear local).

  • Cache: Entries timeout (typically 60 sec).

RARP (Reverse ARP):

  • Purpose: Diskless workstation gets its IP from server (MAC → IP).

  • Operation: Station broadcasts RARP request with its MAC; RARP server replies with IP.

  • Replaced by: BOOTP, then DHCP (more features).

ICMP (Internet Control Message Protocol):

  • Role: Network diagnostics, error reporting (not for user data).

  • Message Types:

    • Destination Unreachable (Type 3): No route, port unreachable, etc.

    • Time Exceeded (Type 11): TTL expired (used by traceroute).

    • Echo Request/Reply (Type 8/0): Used by ping.

    • Redirect (Type 5): Suggest better next-hop.

    • Source Quench (deprecated): Congestion control.

  • Encapsulation: Inside IP datagram (Next Header = 1).

G. FRAGMENTATION AND REASSEMBLY

Need: Different networks have different MTU (Maximum Transmission Unit). IP must handle packets larger than next link's MTU.

Fields in IPv4 Header:

  • Identification: Same for all fragments of a packet.

  • Flags:

    • DF (Don't Fragment): If set and packet too large → drop + ICMP error.

    • MF (More Fragments): Set on all but last fragment.

  • Fragment Offset: 13-bit; offset in 8-byte units from start of original packet.

    • All fragments except last have MF=1; offset = (byte position)/8.

Reassembly: Done only at destination host (routers do not reassemble). If fragments missing within timeout (typically 60 sec), entire packet discarded.

Example: Original 4000-byte packet (20-byte header), MTU 1500 bytes.

  • Max data per fragment = 1480 bytes (multiple of 8).
  • Fragment 1: offset 0, MF=1, data 0–1479.
  • Fragment 2: offset 185 (1480/8), MF=1, data 1480–2959.
  • Fragment 3: offset 370 (2960/8), MF=0, data 2960–3959 (last fragment, 1040 bytes).

H. ROUTING TYPES

  • Unicast Routing: One-to-one; standard routing tables.

  • Broadcast Routing:

    • Flooding: Send to all neighbors (duplicates, infinite loops); use sequence numbers or spanning tree to control.

    • Multi-destination routing: Each router copies packet to multiple outputs.

    • Reverse Path Forwarding (RPF): Forward only if incoming interface is on shortest path back to source.

  • Multicast Routing:

    • Source-specific tree vs Group-shared tree.

    • Protocols: DVMRP (Distance Vector Multicast Routing Protocol), PIM (Protocol Independent Multicast) in sparse/dense modes.

    • IGMP (Internet Group Management Protocol): Hosts join/leave multicast groups on LAN.


VI. TRANSPORT LAYER

A. SERVICES

Service Connection-Oriented (TCP) Connectionless (UDP)
Reliability Yes (ACK, retransmit) No
Ordering Yes (seq numbers) No
Congestion Control Yes (windowing, algorithms) No
Flow Control Yes (sliding window) No
Multiplexing Yes (port numbers) Yes (port numbers)
Header Size 20–60 bytes 8 bytes
Applications Web (HTTP), email (SMTP), file transfer (FTP) DNS, VoIP, streaming, DHCP

Multiplexing/Demultiplexing:

  • Sender: Host assigns port number (16-bit) to identify application process.

  • Receiver: Transport layer uses (dest port, source port) + IP addresses to demultiplex to correct socket.

B. USER DATAGRAM PROTOCOL (UDP)

Header Format (8 bytes):


Source Port (16) | Dest Port (16)

Length (16)      | Checksum (16)

  • Length: Header + data (min 8 bytes).

  • Checksum: Optional in IPv4; mandatory in IPv6. Covers pseudo-header (src IP, dst IP, protocol, UDP length).

  • Applications: DNS (port 53), VoIP, streaming, DHCP (68/67), SNMP (161).

C. TRANSMISSION CONTROL PROTOCOL (TCP)

Header Format (20–60 bytes):


Source Port (16) | Dest Port (16)

Sequence Number (32)

Acknowledgment Number (32)

Data Offset (4) | Reserved (6) | Flags (6) | Window (16)

Checksum (16) | Urgent Pointer (16)

[Options (variable)] | Padding

  • Flags:

    • URG: Urgent pointer valid.

    • ACK: Acknowledgment number valid (set after SYN).

    • PSH: Push function (deliver immediately).

    • RST: Reset connection.

    • SYN: Synchronize sequence numbers (connection setup).

    • FIN: Terminate connection.

  • Window: Receiver's advertised window size (rwnd) for flow control.

  • Urgent Pointer: Offset to urgent data (if URG set).

TCP Header Analysis from Hex Dump (example from past paper):

05320017 00000001 00000000 500207FF 00000000

  • Source port: 0532 (hex) = 1330 (dec).

  • Dest port: 0017 = 23 (dec) → Telnet.

  • Seq number: 00000001 = 1.

  • Ack number: 00000000 = 0 (no ACK yet, likely SYN).

  • Header length: 5 (first 4 bits) → 5 × 4 = 20 bytes (no options).

  • Flags: 02 (SYN) + 07FF? Actually flags in 13th–14th bytes: 02 (binary 000010) → SYN set.

  • Window: 07FF = 2047.

Connection Establishment (Three-Way Handshake):

  1. Client → Server: SYN=1, seq=x.

  2. Server → Client: SYN=1, ACK=1, seq=y, ack=x+1.

  3. Client → Server: ACK=1, seq=x+1, ack=y+1.

  • State diagram: CLOSED → SYN_SENT → ESTABLISHED (client); LISTEN → SYN_RCVD → ESTABLISHED (server).

Connection Termination (Four-Way Handshake):

  • Either side can close:

    1. Fin sender: FIN=1, seq=u → FIN_WAIT_1.

    2. Other: ACK=1, ack=u+1 → CLOSE_WAIT; sends its own FIN=1, seq=v → FIN_WAIT_2.

    3. First side: ACK=1, ack=v+1 → TIME_WAIT (2×MSL wait).

    4. Other: ACK=1, ack=v+1 → CLOSED.

  • TIME_WAIT (2×MSL = 2×Maximum Segment Lifetime):

    • Ensures last ACK received (retransmit if lost).

    • Allows old duplicate segments to expire (prevents confusion with new connection).

  • Graceful release: Important to avoid data loss; both sides close independently.

Flow Control:

  • Sliding window: Receiver advertises rwnd in header (window field).

  • Sender must not send more than $\min(\text{cwnd}, \text{rwnd})$ bytes.

  • rwnd updated by receiver based on buffer availability.

Congestion Control (avoid congestion collapse):

  • Variables:

    • cwnd (congestion window): Sender's limit based on network congestion.

    • ssthresh (slow start threshold): Threshold to switch from slow start to congestion avoidance.

  • Algorithms:

    1. Slow Start: Initially cwnd = 1 MSS; double per RTT until ssthresh or loss.

    2. Congestion Avoidance: After ssthresh, increase cwnd by 1 MSS per RTT (additive increase).

    3. Fast Retransmit: On 3 duplicate ACKs, retransmit missing segment immediately (no wait for timeout).

    4. Fast Recovery: After fast retransmit, set ssthresh = cwnd/2, cwnd = ssthresh + 3, then increase by 1 per duplicate ACK; on new ACK, set cwnd = ssthresh (exit recovery).

  • Timeout: cwnd = 1; ssthresh = cwnd/2.

[!TIP] Exam Focus: Draw TCP state diagram (CLOSED, LISTEN, SYN_SENT, SYN_RCVD, ESTABLISHED, FIN_WAIT_1/2, TIME_WAIT, CLOSE_WAIT, LAST_ACK, CLOSING). Know cwnd/ssthresh evolution in congestion control (graph). Explain why TIME_WAIT is necessary (2MSL rule).

D. TCP vs UDP COMPARISON

Feature TCP UDP
Connection Connection-oriented (handshake) Connectionless
Reliability Guaranteed (ACK, retransmit) Not guaranteed
Ordering Guaranteed (seq numbers) Not guaranteed
Congestion Control Yes (cwnd, algorithms) No
Flow Control Yes (rwnd) No
Header Size 20–60 bytes 8 bytes
Overhead High (handshake, ACKs, state) Low
Ordering In-order delivery No ordering
Use Cases Web, email, file transfer DNS, VoIP, video streaming, DHCP
Ports Yes (same as UDP) Yes (same as TCP)

VII. APPLICATION LAYER

A. DOMAIN NAME SYSTEM (DNS)

Purpose: Translate human-readable domain names (e.g., www.rgpv.ac.in) to IP addresses.

Hierarchical Structure:


Root servers (.) → TLD servers (.com, .org, .in) → Authoritative servers (rgpv.ac.in) → Local/Recursive resolvers

  • Root: 13 logical servers (anycast), know TLD servers.

  • TLD: Manage domains under them (.com managed by Verisign).

  • Authoritative: Host-specific records for a domain.

  • Local DNS Server: ISP-provided; caches answers; recursive/iterative queries.

Resolution Process:

  1. Recursive query (client → local DNS): Local DNS handles entire lookup.

  2. Iterative queries (local DNS → others):

    • Local DNS asks root → root returns TLD server for .com.

    • Local DNS asks TLD → returns authoritative for example.com.

    • Local DNS asks authoritative → returns IP.

  3. Caching: Each server caches records with TTL (Time to Live); reduces latency and traffic.

Resource Records (RR):

  • A: IPv4 address (example.com → 93.184.216.34).

  • AAAA: IPv6 address.

  • MX: Mail exchange (priority, hostname).

  • CNAME: Canonical name (alias).

  • NS: Name server for domain.

  • PTR: Pointer (reverse DNS, IP → name).

Example: nslookup www.google.com → queries local DNS, which may cache or perform iterative lookup.

B. ELECTRONIC MAIL

Architecture:

  • MUA (Mail User Agent): Outlook, Thunderbird (compose/read).

  • MTA (Mail Transfer Agent): Sendmail, Postfix (transfer between servers).

  • MDA (Mail Delivery Agent): Procmail, deliver to mailbox (mbox, Maildir).

SMTP (Simple Mail Transfer Protocol) (port 25):

  • Operation (client → server):

    
    HELO client.example.com
    
    MAIL FROM:<[email protected]>
    
    RCPT TO:<[email protected]>
    
    DATA
    
    Subject: Test
    
    ...
    
    .
    
    QUIT
    
    
  • ESMTP (Extended SMTP): EHLO command; extensions (SIZE, STARTTLS, 8BITMIME).

  • STARTTLS: Upgrade to TLS for encryption.

Message Format (RFC 5322):


Header:

From: [email protected]

To: [email protected]

Subject: Hello

Date: ...

MIME-Version: 1.0

Content-Type: multipart/mixed; boundary="----=_Part_0_123"

Body:
------=_Part_0_123

Content-Type: text/plain

Hello Bob.
------=_Part_0_123

Content-Type: image/jpeg

Content-Transfer-Encoding: base64

... (base64 data) ...
------=_Part_0_123--

Retrieval Protocols:

  • POP3 (Post Office Protocol v3) (port 110/995 TLS):

    • Download-and-delete (or keep) model; simple; no server-side folders.
  • IMAP (Internet Message Access Protocol) (port 143/993 TLS):

    • Manipulate messages on server; folders; partial fetch; better for multiple clients.

C. WORLD WIDE WEB (WWW)

Components:

  • URL (Uniform Resource Locator): scheme://host:port/path?query#fragment (e.g., https://www.example.com:443/index.html?q=test#section1).

  • HTML (HyperText Markup Language): Markup language for documents.

  • HTTP (HyperText Transfer Protocol): Application layer protocol.

  • Browser: Client (Chrome, Firefox).

  • Web Server: Apache, Nginx.

HTTP:

  • Request/Response Model: Stateless (each request independent).

  • Methods:

    • GET: Retrieve data.

    • POST: Submit data (form, upload).

    • PUT, DELETE, HEAD, OPTIONS (RESTful).

  • Versions:

    • HTTP/1.0: New TCP connection per request (inefficient).

    • HTTP/1.1: Persistent connections (keep-alive), pipelining, chunked encoding.

    • HTTP/2: Multiplexing over single TCP, header compression (HPACK), server push.

    • HTTP/3: Over QUIC (UDP-based), reduced latency.

  • Cookies: Set-Cookie header; stateful sessions (shopping cart, login).

D. FILE TRANSFER PROTOCOL (FTP)

Connections:

  • Control connection: Port 21, persistent, commands/responses (ASCII).

  • Data connection: Port 20 (active mode) or dynamic (passive mode), binary, per file transfer.

Active Mode:

  • Client opens port 20 → server connects from port 20 to client's specified port.

  • Issue: Firewalls often block incoming connections.

Passive Mode:

  • Client sends PASV; server opens random port and tells client; client connects to that port.

  • Firewall-friendly.

Common Commands:

  • USER, PASS, LIST, RETR (retrieve), STOR (store), QUIT.

E. SIMPLE NETWORK MANAGEMENT PROTOCOL (SNMP)

Components:

  • Manager: Central monitoring system (e.g., SolarWinds, Nagios).

  • Agent: Software on managed device (router, switch) collecting data.

  • MIB (Management Information Base): Database of managed objects (OIDs, hierarchical tree).

Operations:

  • GET: Retrieve value.

  • SET: Modify value.

  • GETNEXT/GETBULK: Traverse MIB.

  • TRAP/INFORM: Asynchronous notifications (agent → manager). INFORM requires ACK; TRAP does not.

Versions:

  • SNMPv1: Community-based security (plaintext "community string"); limited.

  • SNMPv2c: Community-based; GETBULK, INFORM; still insecure.

  • SNMPv3: User-based security (USM): authentication (MD5/SHA), encryption (DES/AES); access control (VACM).


VIII. NETWORK DEVICES AND INTERCONNECTION

Device Layer Function Forwarding Basis
Repeater Physical Regenerate signal (amplify/clean) None (bit-by-bit)
Hub Physical Multiport repeater; broadcast to all ports None (shared medium)
Bridge Data Link Connect LAN segments; filter traffic MAC address (learning)
Switch Data Link Multiport bridge; full-duplex per port MAC address (table lookup)
Router Network Connect networks; route packets IP address (routing table)
Gateway Application Protocol conversion (e.g., SMTP ↔ X.400) Application data

Bridges and Switches:

  • Transparent Bridging:

    1. Learning: Record (MAC, port) from source address of incoming frames.

    2. Forwarding: If dest MAC in table → forward to that port; else flood (except incoming).

    3. Filtering: If source and dest on same port → discard.

  • Switching Methods:

    • Store-and-Forward: Entire frame received, check FCS, then forward (reliable, latency).

    • Cut-Through: Forward as soon as dest address read (low latency, no error check).

    • Fragment-Free: Wait for first 64 bytes (collision window in Ethernet) → hybrid.

  • VLANs (Virtual LANs):

    • Purpose: Segmentation (security, broadcast control) without physical separation.

    • 802.1Q Tagging: Insert 4-byte VLAN tag in Ethernet frame (TPID=0x8100, VLAN ID 12 bits, priority 3 bits).

    • Trunk ports: Carry multiple VLANs (tagged); access ports: single VLAN (untagged).

Routers:

  • Functions:

    • Routing: Compute best path (routing protocols).

    • Forwarding: Lookup destination IP in routing table → next-hop/interface.

    • NAT (Network Address Translation): Map private IPs to public IP (conserves IPv4 addresses).

  • Routing Table: Destination network, next-hop, interface, metric.

Remote Bridging:

  • Concept: Connect two LANs over a WAN link (e.g., two Ethernet segments connected via serial link).

  • Challenges in Large LANs:

    • Latency: Long propagation delays over WAN break CSMA/CD (min frame size may exceed MTU).

    • Scalability: Broadcast storms across remote links; spanning tree may block links.

    • Solutions: Use routers instead (break broadcast domains), tunneling (e.g., GRE), or VLANs over trunk.

[!TIP] Exam Focus: Switch vs hub vs router differences (layer, forwarding basis). VLAN tagging (802.1Q) format. Remote bridging issues: CSMA/CD fails over long WAN due to propagation delay exceeding min frame time.


IX. SWITCHING TECHNIQUES

Technique Path Resources Phases Example
Circuit Switching Dedicated physical path Reserved (bandwidth, buffers) Setup → Data → Teardown Telephone network
Packet Switching (Datagram) Per-packet routing Shared (no reservation) None (each packet independent) IP network
Packet Switching (Virtual Circuit) Predefined path (VC ID) Per-VC resources (buffers) Setup → Data → Teardown Frame Relay, ATM
Message Switching Store-and-forward entire message Shared None Email store-and-forward

Comparison:

  • Circuit vs Packet:

    • Circuit: Guaranteed bandwidth, low delay, inefficient for bursty traffic.

    • Packet: Efficient sharing, variable delay, congestion possible.

  • Datagram vs VC:

    • Datagram: No setup, each packet routed independently (robust to failures, out-of-order).

    • VC: Setup overhead, in-order delivery, easier QoS.


X. NETWORK TOPOLOGIES

Topology Description Advantages Disadvantages
Bus Single cable, taps Simple, cheap, easy to extend Single point of failure (cable break), performance degrades with nodes, collision domain
Star Central hub/switch Easy to install/manage, single link failure isolated, central monitoring Hub/switch failure brings down network, cable cost high
Ring Closed loop, token passing Deterministic access, no collisions (token), fair Single node failure breaks ring (unless dual ring), complex token management
Mesh Every node connected to every other High reliability (multiple paths), fault-tolerant Expensive (cables), complex, overkill for most LANs
Tree (Hierarchical) Star of stars (root, branches) Scalable, easy to manage, fault isolation Root/upper-level switch failure affects subtree, cable length

Full vs Partial Mesh:

  • Full Mesh: $n(n-1)/2$ links (every node connected to every other).

  • Partial Mesh: Only critical nodes fully connected; others have redundant paths.

[!TIP] Exam Focus: Compare topologies by cost, reliability, scalability, fault tolerance. Star most common in Ethernet; ring in Token Ring/FDDI; mesh in WANs/backbones.


XI. SECURITY AND MANAGEMENT (BRIEF)

Cryptography Basics:

  • Symmetric (AES, DES): Same key for encrypt/decrypt; fast; key distribution problem.

  • Asymmetric (RSA, ECC): Public/private key; slow; used for key exchange, digital signatures.

  • Hashing (SHA-256, MD5): One-way; integrity check.

  • Digital Signatures: Hash + encrypt with private key → authenticity, non-repudiation.

SNMP (covered in Application Layer): Use SNMPv3 for security (authentication, encryption).


END OF UNIT 3 NOTES

Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in