0% found this document useful (0 votes)
3 views41 pages

? Chapter 4

The document discusses the Transport Layer, focusing on its role in converting host-to-host delivery to process-to-process delivery using port numbers for program identification. It covers the functions of the Transport Layer, including multiplexing, demultiplexing, and the differences between connection-oriented (TCP) and connectionless (UDP) services. Additionally, it explains the features, header formats, and use cases of both TCP and UDP, emphasizing the importance of reliability in TCP and speed in UDP.

Uploaded by

Sankalp Gupta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views41 pages

? Chapter 4

The document discusses the Transport Layer, focusing on its role in converting host-to-host delivery to process-to-process delivery using port numbers for program identification. It covers the functions of the Transport Layer, including multiplexing, demultiplexing, and the differences between connection-oriented (TCP) and connectionless (UDP) services. Additionally, it explains the features, header formats, and use cases of both TCP and UDP, emphasizing the importance of reliability in TCP and speed in UDP.

Uploaded by

Sankalp Gupta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 2 – Transport Layer Basics

Introduction

Transport Layer ka kaam hai host-to-host delivery ko process-to-process delivery me convert karna.
Ye ensure karta hai ki ek host ka correct program dusre host ke correct program se connect ho.

Functions:

• Addressing (Port Numbers)

• Multiplexing & Demultiplexing

• Service Types (TCP/UDP)

1. Port Numbers (Why we need them?)

• Host-level tak to IP address se pahunch gaye

• Lekin ek host pe bahut saare programs chal rahe hote hain (browser, WhatsApp, Zoom, etc.)

• To kaunsa program data lega? Ye identify karne ke liye port numbers use hote hain.

IP Address = host ko dhoondhne ke liye


Port Number = us host ke andar correct program ko dhoondhne ke liye

2. Port Number Basics

• Port Number = 16-bit integer (0–65535)

• Is range ko 3 categories me divide kiya gaya hai:

(a) Well-Known Ports (0–1023)

• Ye common protocols ke liye reserved hote hain.

• System/OS control karta hai.

Examples:

• HTTP → 80

• HTTPS → 443

• FTP → 21

• SMTP (mail) → 25

• DNS → 53
Matlab agar tu browser me [Link] likhega → system automatically port 443 use karega.

(b) Registered Ports (1024–49151)

• Ye application-specific hote hain.

• Matlab software vendors apne application ke liye IANA (Internet Assigned Numbers Authority) se register
karva lete hain.

Examples:

• MySQL → 3306

• Oracle DB → 1521

• MS SQL → 1433

• Apache Tomcat → 8080

Matlab agar tu MySQL DB use karega → wo by default port 3306 pe chalega.

(c) Dynamic / Ephemeral Ports (49152–65535)

• Inhe clients use karte hain jab wo server se connection banate hain.

• Ye temporary hote hain → connection close hote hi release ho jaate hain.

• OS automatically assign karta hai.

Example:

• Client: ([Link], 50500)

• Server: ([Link], 80)

Jab response aata hai → OS dekhta hai ki kaunsa temporary port use hua tha, aur usi application ko data forward kar
deta hai.

3. Socket Address

• Socket Address = (IP Address + Port Number)

• Ye ek unique identifier hai jo ek specific process ko identify karta hai.

Example:

• Client → ([Link], 50500)

• Server → ([Link], 80)

Analogy:
Building (IP address) + Room Number (Port) = Specific insaan ko parcel deliver karna.
4. Multiplexing & Demultiplexing

• Multiplexing:
Multiple processes → single transport layer → network layer.

• Demultiplexing:
Network layer → transport layer → correct process.

Analogy:

• Courier service me alag-alag parcels ek truck me jaate hain (Multiplexing)

• Destination pe alag-alag logon ko milte hain (Demultiplexing)

5. Service Types

• Connectionless (UDP):
Fast, no setup, unreliable, unordered.
Example: Video streaming, DNS queries.

• Connection-Oriented (TCP):
Reliable, ordered, error-checked.
Example: Web browsing (HTTP/HTTPS), Email, File transfer.

Conclusion

• Transport Layer ka main role hai process-to-process communication.

• Port Numbers se identify hota hai ki data kis program ko bhejna hai.

• 3 categories of ports: Well-Known, Registered, Dynamic/Ephemeral.

• Socket Address (IP + Port) ek process ka full address hota hai.

• Multiplexing/Demultiplexing ensure karta hai ki sahi data sahi process tak pahunche.

• Service types: Connectionless (UDP) & Connection-Oriented (TCP).


Chapter 3 – UDP (User Datagram Protocol)
Introduction:
UDP ek lightweight, connectionless transport protocol hai jo speed ke liye reliability sacrifice karta hai. Features:
Connectionless: No handshake before sending. Unreliable: No ACK, no retransmission, no ordering. Minimal overhead:
Fixed 8-byte header. Error detection only: Checksum. Header Format (8 bytes) Source Port (16 bits) Destination Port (16
bits) Length (16 bits) — header + data Checksum (16 bits) — error detection Working: Har UDP datagram independent
hota hai. Order change ho sakta hai, packet loss ho sakta hai, koi recovery nahi hoti. Multicast & broadcast supported.
Real-Life Example: Video streaming — thoda frame loss chalega, delay nahi chahiye. Use Cases: VoIP Online gaming NTP
(time sync) DHCP (IP address allocation) Conclusion: UDP = speed > reliability situations ke liye best

Chapter 3 – UDP (User Datagram Protocol)

1. Introduction

• UDP ek lightweight, connectionless transport protocol hai.

• Yahaan speed zyada important hai, reliability kam.

• Matlab data turant bhej diya jaata hai bina check kiye ki saamne pahucha ya nahi.

Real-life analogy:

• Soch SMS bhejna. Tu message bhej diya, ab woh gaya ya nahi, deliver hua ya nahi, tujhe confirm nahi milega.

2. Features of UDP (with Examples)

(a) Connectionless

• No handshake hota hai (TCP me jaise 3-way handshake hota hai).

• Direct packet bhej do.

Example: Online game me shooting ka button dabaya → “fire” command bina delay ke bhejna hai.

(b) Unreliable

• Koi ACK (Acknowledgment) nahi milta.

• Agar packet loss ho gaya to resend nahi hota.

• Agar packets order change karke pahunch gaye to bhi UDP koi ordering nahi karega.

Example: Video streaming me ek frame miss ho gaya to chalega, but wait karna nahi chahiye.
(c) Minimal Overhead (8-byte header only)

• UDP header sirf 8 bytes ka hota hai (TCP header kam se kam 20 bytes hota hai).

• Matlab zyada space data ke liye available hai.

Isliye high-speed apps prefer karti hain.

(d) Error Detection only (Checksum)

• UDP sirf error detect karta hai, correct nahi.

• Agar galti milti hai to packet discard kar diya jata hai.

Example: Agar packet ke andar kuch bits flip ho gaye transmission me, checksum mismatch aayega aur receiver us
packet ko ignore kar dega.

(e) Multicast & Broadcast Supported

• UDP ek saath multiple receivers ko data bhej sakta hai (multicast).

• TCP me aisa nahi hota.

Example: Live IPL match ka stream ek hi baar broadcast kar diya jaata hai aur lakhon users usse receive kar lete hain.

3. UDP Header Format (8 Bytes)

| Source Port (16 bits) | Destination Port (16 bits) |

| Length (16 bits) | Checksum (16 bits) |

(a) Source Port (16 bits)

• Jo process/client data bhej raha hai uska port number.

• Example: ([Link], 50500) me 50500 = source port.

(b) Destination Port (16 bits)

• Jis application/program ko data bhejna hai uska port number.

• Example: Video streaming server ke liye port 1935 (RTMP) ho sakta hai.

(c) Length (16 bits)

• Total datagram size (header + data).

• Min = 8 bytes (agar koi data nahi hai, sirf header).

Example: Agar 20-byte data bhejna hai to total length = 8 (header) + 20 (data) = 28 bytes.

(d) Checksum (16 bits)


• Error detection ke liye.

• Agar transmission ke dauraan bits corrupt ho gaye to checksum se detect ho jaata hai.

• UDP error correct nahi karta, bas packet ko drop kar deta hai.

Example: Agar tu “10110110” bhejta hai aur channel me ek bit flip hokar “10111110” ban gaya, to checksum mismatch
hoga → packet discard.

4. Working of UDP

1. Application layer data ko transport layer deta hai.

2. UDP uske upar 8-byte header jod kar ek datagram banata hai.

3. Datagram network layer (IP) ko bhej diya jaata hai.

4. IP usse receiver ke IP tak deliver karta hai.

5. Receiver side pe UDP destination port dekh kar correct process ko data forward karta hai.

6. Agar packet corrupt/miss ho gaya → koi resend nahi hota.

Key Point: Har UDP datagram independent hota hai.

5. Real-Life Use Cases

• VoIP (Voice over IP) – phone call apps (Jio Call, WhatsApp Call)

• Online Gaming – fast reaction, thoda data loss chalta hai

• NTP (Network Time Protocol) – time sync karne ke liye

• DHCP – IP address allocation

Conclusion

• UDP = Speed > Reliability

• Features: connectionless, unreliable, 8-byte header, error detection only.

• Header me 4 fields hote hain: Source Port, Destination Port, Length, Checksum.

• UDP un applications ke liye best hai jahan thoda sa data loss tolerate kiya ja sakta hai lekin delay bilkul tolerate
nahi hota.
Chapter 4 – Transport layer
Transmission Control Protocol (TCP) & User
datagram protocol (UDP)

1. Why TCP?

• UDP → speed hai par reliability nahi. Packets drop ho jaate hain, order change ho jaata hai.

• TCP → slow hai par reliable.

TCP ensure karta hai:

1. Data lossless, ordered, duplicate-free deliver ho.

2. Correct process tak data jaye (Port + IP).

3. Receiver overload na ho (Flow Control).

4. Network overload na ho (Congestion Control).

5. Communication connection-oriented aur full-duplex ho.

2. TCP Features

1. Connection-Oriented – 3-way handshake before data.

2. Reliable – ACK + Sequence numbers + Retransmission.

3. Ordered Delivery – Out-of-order data ko reorder karta hai.

4. Full Duplex – Dono taraf ek saath data (Zoom call).

5. Flow Control (rwnd) – Receiver ke buffer ke hisaab se bhejna.

6. Error Control – Checksum + retransmission.

7. Congestion Control – Algorithms prevent network collapse.

3. TCP Header (Main Fields)

• Source/Destination Port – identify processes.

• Sequence Number – first byte number in segment.

• Acknowledgment Number – next byte expected.

• Flags – SYN, ACK, FIN, PSH, URG, RST.


• Window Size – flow control (rwnd).

• Checksum – error detection.

4. TCP Handshaking

(a) 1-Way Handshake

• Sirf client SYN bhejta hai aur data bhejna start kar deta hai.

• Problem: Duplicate SYN accept ho sakta hai. Unsafe.

(b) 2-Way Handshake

1. Client → SYN (SEQ=x)

2. Server → SYN+ACK (SEQ=y, ACK=x+1)

• Problem: Agar purana SYN aaya to bhi connection ban jaata hai.

(c) 3-Way Handshake (Standard)

1. Client → SYN (SEQ=x)

2. Server → SYN+ACK (SEQ=y, ACK=x+1)

3. Client → ACK (ACK=y+1)

✔ Isse dono confirm kar lete hain ki fresh connection ban raha hai.

(d) 4-Way Termination

1. Client → FIN

2. Server → ACK

3. Server → FIN

4. Client → ACK

Safe close (dono taraf se).

5. Data Transfer Concepts

(a) Piggybacking

• Normally ACK alag bhejna padta hai.

• Agar ussi waqt data bhi bhejna hai → ACK + Data ek hi segment me bhej dete hain.
✔ Bandwidth bachaata hai.

(b) PSH Flag

• Default: Data buffer hota hai, fir bheja jaata hai.


• PSH flag lagane ka matlab → “Is data ko turant Application layer ko deliver karo.”
Example: Chat messages (delay nahi chalega).

6. Flow Control (rwnd Example)

• Receiver advertise karta hai ki uske buffer me kitni space hai (rwnd).

• Sender ussi ke hisaab se bhejta hai.

Example:

• rwnd = 3000B, MSS = 1000B

• Sender ek time par 3 segments bhejega.

• ACK ke baad space clear hoti hai, fir naya data bhejega.

Prevents flooding of receiver.

7. Error Control

1. Checksum – Corruption detect karta hai.

2. Timeout Retransmission – Agar ACK missing hai → resend.

3. Duplicate ACKs (3 ACK Rule) – Agar receiver baar-baar same ACK bhej raha hai → Fast Retransmit hota hai.

8. TCP Congestion Control (Detailed)

(a) Slow Start (SS)

• cwnd start = 1 MSS

• Har RTT me cwnd double hota hai (1,2,4,8…)

• Jab tak ssthresh cross na ho.

(b) Congestion Avoidance (CA)

• Jab cwnd ≥ ssthresh, growth linear ho jaati hai.

(c) Fast Retransmit (FR)

• Agar 3 duplicate ACKs milte hain → lost packet immediately resend.

(d) Fast Recovery (FRec)

• Reno onwards.

• Loss par cwnd = cwnd/2 (ssthresh = half)

• Fir linear growth resume.


9. TCP Variants

TCP Tahoe

• Mechanisms: Slow Start + Congestion Avoidance + Fast Retransmit.

• Loss hone par cwnd = 1 MSS reset.


Recovery slow.

TCP Reno

• Tahoe + Fast Recovery.

• Loss hone par cwnd = cwnd/2 (restart nahi hota).


✔ Better throughput.
Multiple loss ek window me handle nahi karta.

TCP New Reno

• Multiple packet loss bhi handle karta hai.

• Fast Recovery me tab tak rahta hai jab tak sab lost packets recover na ho.

TCP Vegas

• Delay-based (RTT se congestion guess karta hai).

• Congestion hone se pehle hi slow ho jaata hai.


✔ Smooth throughput, less loss.

10. Advanced TCP Features

• Nagle’s Algorithm → Chhote packets ko combine karta hai.

• Delayed ACK → ACK bhejne me delay for piggyback chance.

• TIME_WAIT → 2×MSL wait after close, taaki purane packets naye connection me mix na ho.

• Silly Window Syndrome → Avoided by Nagle + Clark’s Algorithm.

• Port Numbers (4-tuple) → TCP connection uniquely identify hota hai by:
(Src IP, Src Port, Dst IP, Dst Port).
11. SCTP vs TCP vs UDP (from your PPT)

UDP

• Message-oriented, unreliable, no flow control, no congestion control.

• Fast, but unsafe.

TCP

• Byte-oriented, reliable, ordered delivery.

• Connection-oriented, flow control + congestion control.

• Weakness: Message boundaries preserve nahi karta.

SCTP

• Message-oriented + Reliable.

• Extra features:

o Multi-homing (ek host ke multiple IPs use ho sakte hain).

o Multi-streaming (ek hi connection me multiple independent streams without head-of-line blocking).

• Better than TCP for modern apps like VoIP, Media Gateway, ISDN over IP.

12. Real-Life Applications

• TCP → HTTP/HTTPS (web), FTP (file transfer), SMTP (emails), DB connections.

• UDP → VoIP, Gaming, Streaming.

• SCTP → VoIP signaling, telephony, reliable message transfer.

Final Conclusion

• TCP = Reliability ke liye best.

• 3-Way handshake se connection establish hota hai, 4-way se close.

• Data transfer me Piggybacking + PSH flag efficiency aur low-latency ke liye.

• Error detection (checksum) + Flow control (rwnd) + Congestion control (cwnd).

• Congestion control evolve hua: Tahoe → Reno → NewReno → Vegas.

• Advanced features jaise Nagle, Delayed ACK, TIME_WAIT ise practical banate hain.

• SCTP modern upgrade hai jo TCP+UDP ke best features ko combine karta hai.
SCTP – Stream Control Transmission Protocol

1. Introduction

• SCTP ek transport layer protocol hai jo 2000s me IETF ne design kiya.

• Iska maksad tha: TCP aur UDP dono ke drawbacks ko fix karna.

• Mainly design hua tha telephony signaling (SS7 over IP) ke liye, lekin ab multimedia, VoIP, real-time
communication me bhi use hota hai.

SCTP = Hybrid of TCP + UDP

• Reliable jaise TCP

• Message-oriented jaise UDP

• Extra features: multi-homing & multi-streaming

2. Features of SCTP

(a) Message-Oriented

• UDP ki tarah “datagrams” preserve karta hai (ek message = ek packet).

• TCP ke tarah stream of bytes nahi hai.


Matlab agar tumne 3 messages bheje, toh receiver ko bhi 3 hi messages milenge (merge/split nahi honge).

(b) Reliable Transmission

• TCP ki tarah acknowledgments, retransmission, checksums.

• Loss, corruption, duplication sab handle karta hai.

(c) Multi-Homing Support

• Ek host ke paas ek se zyada IP addresses ho sakte hain.

• Agar ek network path fail ho jaaye, toh SCTP automatic backup path pe switch kar leta hai.
Reliability for real-time apps.
Example: Agar ek server ke paas 2 NICs hain (Wi-Fi + Ethernet), SCTP un dono ka use kar sakta hai.
(d) Multi-Streaming

• TCP me ek hi stream hoti hai. Agar ek packet delay/loss ho gaya toh poora stream ruk jaata hai (Head-of-Line
Blocking).

• SCTP me ek connection (association) me multiple independent streams hoti hain.

• Agar ek stream me packet delay ho gaya toh doosri streams continue karti hain.
Smooth performance in multimedia calls (voice & video alag-alag streams).

(e) 4-Way Handshake (Connection Establishment)

• TCP me 3-way handshake hai.

• SCTP me 4-way handshake hota hai jo cookie mechanism use karta hai (SYN flooding attack avoid karne ke liye).

Steps:

1. Client → INIT

2. Server → INIT-ACK (with Cookie)

3. Client → COOKIE-ECHO

4. Server → COOKIE-ACK

✔ Isse ensure hota hai ki server bina resources allocate kiye client ki authenticity verify kare.

(f) Security Features

• SCTP ke handshake me cookie mechanism hota hai → SYN flooding attacks avoid.

• TCP me aisa mechanism nahi tha.

(g) Checksum

• TCP ka 16-bit checksum weak tha.

• SCTP uses 32-bit CRC checksum → stronger error detection.

3. SCTP Header Structure

SCTP ka header TCP/UDP se different hai:

• Source Port (16 bits)

• Destination Port (16 bits)

• Verification Tag (32 bits) → Association identify karne ke liye.

• Checksum (32 bits) → Strong error detection.


After this → multiple chunks hote hain (control chunks, data chunks).

4. SCTP vs TCP vs UDP

Feature TCP UDP SCTP

Orientation Byte-oriented (stream) Message-oriented Message-oriented + reliable

Reliability Yes No Yes

Connection Connection-oriented Connectionless Connection-oriented (Association)

Handshake 3-way None 4-way (cookie-based)

Multi-streaming

Multi-homing

Error Detection 16-bit checksum (weak) 16-bit checksum 32-bit CRC

Security Basic (vulnerable to SYN flood) None Built-in protection (cookie)

Use cases HTTP, FTP, Email DNS, VoIP, Streaming VoIP signaling, Media gateway, ISDN over IP, 5G

5. Real-Life Use Cases of SCTP

• VoIP Signaling (SIP over SCTP)

• Media Gateway Control (MGCP, H.248)

• Telecommunication (SS7 over IP)

• 5G Core Networks (SCTP is mandatory in 5G NGAP & Xn interfaces)

• Mission-critical applications (Banking, Defense).

6. Advantages of SCTP over TCP/UDP

1. Message boundaries preserve karta hai (TCP ka weakness fix).

2. Multi-streaming se head-of-line blocking nahi hota.

3. Multi-homing se path failure pe bhi communication continue.

4. Strong error detection (32-bit CRC).

5. SYN flood resistance (cookie handshake).


Final Summary (for Exam/Research Style)

• SCTP ek modern transport protocol hai jo TCP + UDP ki best qualities ko


combine karta hai.

• TCP ke reliability aur flow/congestion control ke saath UDP ki message-


orientation, plus extra: multi-homing, multi-streaming, stronger checksum,
secure 4-way handshake.

• Aaj ke advanced networks (specially 4G/5G, VoIP) me SCTP ko prefer kiya jaata
hai.

Chapter – Network Layer (Detailed)

1. Why Network Layer? (Role & Services)

Need

Transport Layer sirf process-to-process communication karta hai (ports use karke),
lekin packet ko network ke ek end host se dusre host tak pohchana kiska kaam hai?
Network Layer ka.

Responsibilities

1. Logical Addressing (IP) → Har host ko globally unique address.

2. Routing → Best path choose karna source → destination tak.

3. Forwarding → Router incoming packet ko correct output interface se bhejta hai.

4. Fragmentation/Reassembly → Agar packet size > MTU, toh todna + jodna.

5. Error/Diagnostics → ICMP messages (ping, traceroute).

2. Logical Addressing (IPv4 vs IPv6)


Why?

MAC address hardware-specific hota hai (local network me hi kaam karega).


Global delivery ke liye logical address (IP) chahiye.

IPv4

• 32-bit address (4 bytes).

• Format: dotted decimal (e.g., [Link]).

• CIDR notation: /24 → [Link] mask.

• Address classes (legacy): A (0–127), B (128–191), C (192–223), D (multicast), E (experimental).

Subnetting Example
Network: [Link]/24 → split into 4 subnets.

• Need 2 extra bits → new prefix /26.

• Each subnet = 64 addresses.

• Usable hosts = 62 (64 − 2 reserved).

Subnets:

• [Link]–63

• [Link]–127

• [Link]–191

• [Link]–255

IPv6

• 128-bit address, written in hex (2001:db8::1).

• Huge space (no NAT required).

• Shortening rules:

o Leading zeros remove.

o Consecutive zeros → "::" (only once).

• Special addresses:

o Loopback: ::1

o Link-local: fe80::/10

o Anycast: "nearest server"

IPv4 vs IPv6 (Comparison Table)


Feature IPv4 IPv6

Size 32-bit 128-bit

Address space 4.3B 3.4×10^38

Header Complex, 20–60B Simplified, 40B

NAT Needed Not needed

Broadcast Yes No (replaced by multicast/anycast)

3. IP Packet Header

IPv4 Header Fields

• Version = 4

• IHL (Header length)

• Type of Service / DSCP → QoS bits

• Total Length

• Identification, Flags, Fragment Offset → fragmentation

• TTL (Time to Live) → decremented at each router (avoid loops)

• Protocol → next layer (TCP=6, UDP=17)

• Header Checksum

• Source IP, Dest IP

Example: Packet TTL=5 → after 5 hops, TTL=0 → router drops + ICMP "Time Exceeded".

IPv6 Header (Simpler)

• Version=6

• Traffic Class (like DSCP)

• Flow Label → flow-based routing

• Payload Length

• Next Header → extension header / transport protocol

• Hop Limit (like TTL)

• Source, Destination IP

No checksum (error check already in Transport/Data Link).


4. Fragmentation & Reassembly

Why?

Network MTU (e.g., 1500B) < IP packet size (e.g., 4000B).

IPv4 Example

4000B data + 20B header = 4020B.


MTU = 1500 → payload = 1480B (divisible by 8).

• Fragment 1: Offset=0, MF=1, data=1480

• Fragment 2: Offset=185, MF=1, data=1480

• Fragment 3: Offset=370, MF=0, data=1040

Receiver reassembles using Identification + Offset.

IPv6

Routers don’t fragment.


Source must do Path MTU Discovery (using ICMPv6 "Packet too Big").

5. Routing

Why?

Select best path among many.

Routing Types

• Static → Admin sets manually.

• Dynamic → Routers exchange info.

Algorithms

1. Distance Vector (RIP)

o Each router shares table with neighbors.

o Metric = hop count. Max=15.

o Uses Bellman-Ford.
Problem: slow convergence, count-to-infinity.

2. Link State (OSPF, IS-IS)

o Each router floods Link State Advertisement (LSA).

o Each builds complete map, runs Dijkstra.

o Fast, scalable, area-based.

3. Path Vector (BGP)


o Inter-AS routing.

o Uses AS_PATH attribute.

o Policy-based selection, not only shortest path.

o Internet backbone uses BGP.

Dijkstra Example
Graph: A-B=2, A-C=4, B-C=1, B-D=7, C-D=3.
From A: shortest to D = A-B-C-D = cost 6.

6. Address Resolution

ARP (IPv4)

• Broadcast: "Who has [Link]?"

• Reply: "[Link] is at MAC aa:bb:cc:dd."

• Stored in ARP cache.

RARP

• Old → IP from MAC. Replaced by DHCP.

NDP (IPv6)

• Uses ICMPv6 messages:

o NS (Neighbor Solicitation)

o NA (Neighbor Advertisement)

o RS (Router Solicitation)

o RA (Router Advertisement)

7. ICMP & IGMP

ICMP

• Error messages (Destination Unreachable, Time Exceeded).

• Diagnostic (Ping, Traceroute).

IGMP

• Multicast membership.

• Host joins group → router forwards multicast.

8. QoS (Quality of Service)


Need

Video calls, VoIP, gaming ≠ same as FTP/file transfer.

Approaches

• IntServ (RSVP per-flow) → guaranteed, but not scalable.

• DiffServ (DSCP marking in IP header) → scalable, per-class service.

Traffic Shaping

• Leaky bucket → smooth out burst.

• Token bucket → allows burst but enforces average.

Example: Token rate=1KB/s, bucket size=4KB → can send 4KB burst, then avg 1KB/s.

9. NAT, DHCP, VPN, MPLS

• NAT: Translate private ↔ public IP.


Example: [Link]:5000 → [Link]:62000

• DHCP: Auto IP assignment.


Discover → Offer → Request → Ack.

• VPN/IPsec: Secure tunneling (AH=auth, ESP=encrypt).

• MPLS: Label-based forwarding → faster than IP lookup.

10. Mobile IP

• Permanent home address (HA).

• Temporary Care-of Address (CoA).

• HA tunnels traffic to CoA.

• Problem: triangle routing. Solution → Route optimization.

11. Multicast & Anycast

• Multicast: One → many. (e.g., IPTV).

• Anycast: One → nearest server (e.g., DNS root).

12. Security at Network Layer

• IPsec AH/ESP, transport vs tunnel.

• Firewalls (stateless, stateful, app).


• DDoS mitigation (rate limiting, blackholing).

13. Congestion Handling

• RED: drop randomly before full queue.

• CoDel: keep queueing delay under target.

• ECN: routers mark instead of drop → sender reduces speed.

14. Modern Topics

• SDN (controller + switches).

• Segment Routing (encoded path).

• Overlays (VXLAN, GRE).

• QUIC (UDP-based, TLS built-in, multiplexing).

• ICN (name-based networking).

• LISP (ID/Locator separation).

Deep-Dive (with Solved Examples)


0) Quick Primer: IP Address, Mask & Notation

• IP Address: Logical address for a device (host).

o IPv4 = 32-bit

o IPv6 = 128-bit

• Subnet Mask / Prefix: Batata hai kaunse bits network ke hain aur kaunse host ke.

o Dotted mask: e.g., [Link]

o CIDR prefix: e.g., /24 (means first 24 bits = network)

• Network ID: All host-bits = 0

• Broadcast (IPv4): All host-bits = 1 (IPv6 me broadcast nahi hota)


• Block size trick (IPv4):

o BlockSize = 256 - (last mask octet)

o Ranges step with this block size

1) Network Layer Overview (OSI Layer-3)

• Host-to-host delivery across multiple networks

Responsibilities

• Logical Addressing → IPv4/IPv6 addresses assign

• Routing → Best path choose (via routing table & protocols)

• Forwarding → Next-hop interface par packet bhejna

• Fragmentation/Reassembly → MTU se bada packet ho to split; destination pe join

• Error/Diagnostics → ICMP/ICMPv6 (ping, traceroute, errors)

Layer flow: Application → Transport → Network → Data Link → Physical

2) IPv4 — Addressing & Classes (WHY + HOW)

2.1 WHY Classes (historic)

• 1980s/early-1990s me Classful Addressing use hoti thi: fixed-size network blocks dene ke liye

• Motivation: Different network sizes (bahut bade ISPs, medium orgs, small LANs)

• Limitation:

o Rigid & wastage (agar Class A mil gaya par hosts kam, to bohot IP waste)

• Aaj CIDR (Classless) standard hai, but Classes exam me zaroor puchte hain

2.2 Classes (A–E)

Class First Octet Range Default Mask Network Bits Host Bits Hosts/Network (approx) Use

A 0–127 [Link] (/8) 8 24 ~16 Million Very large org/ISPs

B 128–191 [Link] (/16) 16 16 ~65k Medium orgs


Class First Octet Range Default Mask Network Bits Host Bits Hosts/Network (approx) Use

C 192–223 [Link] (/24) 24 8 254 Small LANs

D 224–239 — — — — Multicast groups

E 240–255 — — — — Experimental/Reserved

Private IPv4 ranges (RFC1918):

• Class A: [Link]/8

• Class B: [Link]/12 ([Link]–[Link])

• Class C: [Link]/16 (e.g., [Link]/24)

Examples (class identify):

• [Link] → First octet 14 → Class A; default mask /8

• [Link] → 172 (16–31 private range) → Class B private; default /16

• [Link] → 192 → Class C private; default /24

• 224.x.x.x → Class D (multicast)

Note: Today, routers use CIDR & longest prefix match; fixed classes are not used for routing on the Internet, but basics
help.

3) IPv4 Subnetting (Deep but Easy)

Why subnet?

• Address wastage avoid

• Broadcast domains chhote

• Security & performance better

• Logical departments/segments alag

3.1 Core formulas

• Total addresses = 2^(host bits)

• Usable hosts/subnet = 2^(host bits) - 2 (network + broadcast)

• #Subnets (from borrowing) = 2^(borrowed bits)

• Block size (in affected octet) = 256 - last mask octet

3.2 Fast method (block-size trick)

• Example: Mask = /26 → dotted mask [Link] → last octet 192


• Block size = 256 - 192 = 64 → ranges: 0, 64, 128, 192 …

• Each block has 64 addresses → usable 62

3.3 Example-1: Split /24 into 4 subnets

• Network: [Link]/24 → Borrow 2 bits → /26

• Ranges (size 64):

o [Link]–63 → usable .1–.62, broadcast .63

o [Link]–127 → usable .65–.126, broadcast .127

o [Link]–191 → usable .129–.190, broadcast .191

o [Link]–255 → usable .193–.254, broadcast .255

3.4 Example-2: Find network/broadcast/host range (CIDR given)

• IP = [Link]/27

• /27 → dotted mask [Link] → block size = 256-224=32

• Blocks: 0–31, 32–63, 64–95 …

• 33 ∈ 32–63 block ⇒

o Network ID = [Link]

o Broadcast = [Link]

o Usable = .33–.62

3.5 Example-3: VLSM design (different host needs)

• Base = [Link]/24

• Need: Dept-A=50 hosts, Dept-B=25, Dept-C=10

• Sort by size: 50, 25, 10

• Dept-A (50 hosts): 6 host bits ⇒ /26 → [Link]/26 (usable .1–.62)

• Dept-B (25 hosts): 5 host bits ⇒ /27 → [Link]/27 (usable .65–.94)

• Dept-C (10 hosts): 4 host bits ⇒ /28 → [Link]/28 (usable .97–.110)

• Remaining space continues from .112 onward

3.6 Example-4: Supernetting (CIDR aggregation)


• Aggregate [Link]/24 and [Link]/24

• Common prefix = /23 ⇒ supernet = [Link]/23 (covers [Link]–[Link])

Exam tip:

• Given host count H → find minimum host bits h such that 2^h - 2 ≥ H

• Then prefix = 32 - h

4) IPv4 Packet Structure (Header Deep-Dive)

• Fixed base header: 20 bytes (+ options up to 40) ⇒ total 20–60 bytes.

Key fields:

• Version (4 bits): Always 4 for IPv4

• IHL: Header length (in 32-bit words)

• DSCP/ECN: QoS & Explicit Congestion Notification

• Total Length: Header + Payload size

• Identification/DF/MF/Offset: Fragmentation control

o DF = Don’t Fragment

o MF = More Fragments

o Offset = units of 8 bytes

• TTL: Hop count; each router decrements by 1; if 0 ⇒ drop + ICMP Time Exceeded

• Protocol: Next layer (TCP=6, UDP=17, ICMP=1)

• Header Checksum: Only header; recomputed each hop


• Options (rare): Record Route, Timestamp, Security, etc.

5) Fragmentation & Reassembly (with Numericals)

When fragmentation occurs?

• Packet size > outgoing interface MTU

Rules (IPv4)

• All fragments except last → data length must be multiple of 8 bytes

• All fragments carry same Identification value

• MF=1 on all but last; last has MF=0

• Destination reassembles using (Src, Dst, ID, Protocol)

Worked Example-1

• Datagram Total Length = 3000 bytes, Header = 20 bytes

• Data = 2980 bytes, MTU = 800 bytes

• Max data/fragment = 800-20 = 780 bytes, but must be multiple of 8 ⇒ 776 bytes

• Split:

o F1: 776 data, Offset=0, TL=796, MF=1

o F2: 776 data, Offset=97, TL=796, MF=1

o F3: 776 data, Offset=194, TL=796, MF=1

o F4: 652 data, Offset=291, TL=672, MF=0

Worked Example-2 (DF=1)

• TL=1500, Header=20, Data=1480

• MTU=576, DF=1

• Router drops packet + sends ICMP Type 3 Code 4 (Fragmentation Needed) with MTU info ⇒ sender adjusts size
(PMTUD).

IPv6 Difference

• Routers never fragment

• Only sender adds Fragment Extension Header

• PMTUD via ICMPv6 Packet Too Big (Type 2)

6) ICMP (Error & Diagnostics) — IPv4 vs IPv6

6.1 ICMPv4 (Protocol=1)


• Error messages (selected):

o Destination Unreachable (Type 3) → network, host, protocol, port unreachable; fragmentation needed
(Code 4)

o Time Exceeded (Type 11) → TTL expired (Traceroute use)

o Redirect (Type 5) → Better gateway (rare now)

o Parameter Problem (Type 12) → Header invalid

• Query/diagnostic:

o Echo Request/Reply (Type 8/0) → Ping

6.2 ICMPv6 (Next Header=58)

• Combines error + neighbor functions (ARP replace)

• Errors:

o Packet Too Big (Type 2) → PMTUD

o Time Exceeded (Type 3)

o Parameter Problem (Type 4)

• Diagnostics:

o Echo Request/Reply (128/129)

• Neighbor Discovery (NDP):

o Router Solicitation (133), Router Advertisement (134)

o Neighbor Solicitation (135), Neighbor Advertisement (136)

o Redirect (137)

6.3 Traceroute — Working

• Sender sends probe with TTL=1 → first router drops & sends ICMP Time Exceeded

• Next probe TTL=2 → second router reply

• Last hop reply → ICMP Port Unreachable (UDP method) or Echo Reply (ICMP method)

• Linux/Unix: UDP to ports 33434+

• Windows: ICMP Echo


• Output: Each hop shows ~3 probes (RTT stats)

7) IPv6 — Addressing, Header & Ecosystem (Deep)

7.1 Address Types

• Global Unicast: Public Internet (2000::/3)

• Unique Local (ULA): fc00::/7 (private-like, usually fdxx::)

• Link-Local: fe80::/10 (must exist on every IPv6 interface, not routed)

• Multicast: ff00::/8 (replaces broadcast)

• Anycast: Same address on multiple nodes; nearest gets packet

7.2 Notation & Shortening

• 8 groups of 16-bit hex (xxxx:xxxx:...:xxxx)

• Leading zeros removed: 03af → 3af

• Zero-compression (::): longest run of 0-groups can be replaced with :: (only once)

Practice:

• Expand 2001:db8::1 → 2001:0db8:0000:0000:0000:0000:0000:0001

Addressing & Routers (Detailed Notes)

1. Classful Addressing

What is it?

• The original method of assigning IP addresses (till early 1990s).

• IP space divided into fixed classes (A, B, C, D, E) based on the leading bits of the IP address.

Why was it introduced?

• In the beginning, the Internet was small → they needed a simple system.

• Organizations were assigned blocks based on their size (large companies got Class A, smaller got Class B/C).

How does it work?

• Each IP address = Network ID + Host ID.


• The division depends on the class:

Class Leading Bits Range Default Mask Hosts Available

A 0 [Link] – [Link] [Link] (/8) ~16M hosts

B 10 [Link] – [Link] [Link] (/16) ~65K hosts

C 110 [Link] – 223.255.255 [Link] (/24) 254 hosts

D 1110 [Link] – 239.255.255 (Multicast) Not for hosts

E 1111 [Link] – 255.255.255 (Experimental) Not for hosts

Example:

• [Link] → Class A (Network: [Link], Host: remaining 24 bits).

• [Link] → Class B (Network: [Link], Host: remaining 16 bits).

• [Link] → Class C (Network: [Link], Host: remaining 8 bits).

Problem:

• Wastage of addresses:

o A company needing 500 hosts could not fit in Class C (254 hosts) → had to take Class B (65,536 hosts).

• The system was inflexible.

2. Classless Addressing (CIDR – Classless Inter-Domain Routing)

Why CIDR?

• To remove wastage of IP addresses.

• To allow variable-size blocks instead of rigid classes.

How does it work?

• Address written as: IP / Prefix length

• Prefix length = number of bits in the network part.

• Remaining bits = hosts part.

Example:

• [Link]/24 → First 24 bits network, last 8 bits hosts (254 usable hosts).

• [Link]/22 → First 22 bits network, last 10 bits hosts (1022 usable hosts).

• CIDR can merge multiple networks:

o Instead of 4 × /24 → [Link]/22 (covers .0.0 – .3.255).

Benefits:
• Efficient IP usage.

• Supports route aggregation (summarization).

• Backbone of modern Internet routing.

3. Early Routers – IMP (Interface Message Processor)

What is IMP?

• The first generation router used in ARPANET (1969).

• Built by BBN Technologies.

How did it work?

• IMP was a separate mini-computer that connected a host computer to the ARPANET.

• It did packet switching: received data, divided it into packets, and sent it to the next IMP.

Historic Example:

• 29 October 1969:
First message sent from UCLA → Stanford using IMPs.
Message was "LOGIN", but only "LO" was delivered before crash → still marks the birth of the Internet.

4. Birth of Routers (1980s)

• After ARPANET, real dedicated routers were created.

• Companies like Xerox, DEC, IBM developed early routers.

• 1984: Cisco founded → brought commercial routers.

• 1986: Cisco’s AGS Router became very popular.

5. Growth of Routers (1990s–Present)

• 1990s:

o Internet boom → routers became faster.

o Added security (firewalls).

o Supported multiple protocols.

• 2000s onward:

o Home routers: Wi-Fi, NAT, Firewall.

o Enterprise routers: Advanced routing protocols, VPN.

o ISP & backbone routers: Handle terabits of traffic.


6. Router Operating Systems

Routers don’t use Windows/Linux → they run special OS optimized for networking.

Examples:

• Cisco IOS: Industry standard, CLI based.

• Juniper JunOS: Modular, FreeBSD-based.

• MikroTik RouterOS: GUI + CLI, supports wireless.

• VyOS: Open-source, Linux-based.

• pfSense: Firewall + routing, FreeBSD-based.

• OpenWRT/DD-WRT: Custom firmware for home routers.

7. Information Stored in Routers

Routers maintain multiple tables:

1. Routing Table – destination networks + next hop.

2. ARP Table – IP ↔ MAC mapping.

3. FIB (Forwarding Information Base): optimized routing table for fast lookups.

4. Interface Info: IP address, subnet, status.

5. Neighbor Info: learned via protocols like OSPF, BGP.

6. QoS/Policy Info: prioritization of traffic.

7. Security Info: ACLs, firewall rules, VPN keys.

8. Routing Table – Key Fields

Field Meaning Example

Destination Network Where the packet wants to go [Link]/24

Subnet Mask/Prefix How many bits are network /24 = [Link]

Next Hop IP of next router [Link]

Outgoing Interface Which port to use GigabitEthernet0/1

Metric Quality of path (cost, delay, hops) RIP hop=3

Route Source How learned (Static, OSPF, RIP, BGP) O (OSPF)


Field Meaning Example

Administrative Distance (AD) Trustworthiness Static=1, OSPF=110

9. Types of Routers

By Function:

• Core Router: ISP backbone.

• Edge Router: Connect ISP to customer.

• Distribution Router: Between core and access.

• Access Router: Homes, offices.

By Routing Method:

• Static Router: Manual config.

• Dynamic Router: Uses protocols (RIP, OSPF, BGP, EIGRP).

By Technology:

• Wired, Wireless, Virtual routers.

1) What is Routing — definition & purpose


Definition: Routing is the process of choosing a path that network packets should follow from a source to a destination
across one or more networks.
Layer: Network Layer (OSI L3).
Router: A device that holds a routing table and runs routing protocols to make forwarding decisions (next-hop).

Why needed: LAN switching (MAC) works inside a segment. For multi-network communication (Internet) we need
hierarchical addressing (IP) + decision logic (routing) to:

• ensure correctness (reach right IP),

• achieve efficiency (shortest/cheapest path),

• support adaptability (failures/congestion),

• scale to Internet size.

2) High-level classification of routing

A. Non-Adaptive (Static / Simple) — path decisions do not react to network changes (Flooding, Fixed, Random).
B. Adaptive (Dynamic) — decisions adapt to topology/metrics; split into:

• Interior Gateway Protocols (IGP) — inside an AS (Distance Vector: RIP/IGRP/EIGRP; Link State: OSPF/IS-IS).

• Exterior Gateway Protocols (EGP) — between ASes (BGP — Path Vector).


3) Non-Adaptive Routing (deep)

Flooding

• What: Forward each incoming packet on all outgoing interfaces except the one it arrived on.

• Why: Early networks lacked routing logic; flooding guaranteed if any path exists the packet will arrive.

• How: Without control, exponential duplicate growth occurs. Controls: TTL (hop-limit), sequence numbers to drop
duplicates, selective flooding.

• Math: If each node degree ≈ k, number of copies ≈ O(k^h) at hop h → explosive.

• Example: Diamond topology A→{B,C}→D → D receives multiple copies via A-B-D, A-C-D, A-B-C-D, etc.

• Pros: Reliable delivery under failures.

• Cons: Wastes bandwidth; processing overhead; not scalable.

• Use today: Broadcasts (ARP), some P2P discovery, special military/emergency systems.

Fixed (Static) Routing

• What: Administrator configures specific routes in routing table(s); they stay until manually changed.

• Why: Simplicity when topology is small and stable.

• How: Router looks up destination network → next hop is fixed entry.

• Example: Home router default route to ISP gateway.

• Pros: Simple, predictable, no protocol overhead.

• Cons: No fault tolerance, manual maintenance, not scalable.

Random Routing

• What: At each hop randomly choose one outgoing link.

• Why: Reduce duplicates vs flooding; used in theory/experiments.

• How: Probabilistic forwarding — no guarantees.

• Example/Math: Probability of reaching destination decreases exponentially with path length if choices are
random.

• Pros: Low overhead, simple.

• Cons: Unreliable, can wander, not used in production except in DTNs or very specialized research.

4) Adaptive Routing — core concepts & why adaptive needed

Why adaptive: Real networks change (link failures, congestion). Adaptive protocols exchange information so routers can
recompute good paths. Goals: fast convergence, loop avoidance, scalability, policy control.

Two broad algorithmic families:


• Distance-Vector (DV) — routers know distance to destinations via neighbors and exchange vectors (Bellman-Ford
style).

• Link-State (LS) — routers learn complete network topology (LSAs/LSPs), each runs Dijkstra locally.

Also Path-Vector (BGP) used inter-domain where policy and AS paths matter.

5) Distance-Vector (DV): Bellman-Ford family — details

Principle

Each router maintains a table: for each destination, best known distance (metric) and next hop. Periodically (or on
change) send routing updates to immediate neighbors. Router x updates distances with:

Dx(y)=min⁡v∈N(x){c(x,v)+Dv(y)}D_x(y) = \min_{v \in N(x)} \{ c(x,v) + D_v(y) \}Dx(y)=v∈N(x)min{c(x,v)+Dv(y)}

where c(x,v) = cost from x to neighbor v.

Protocol examples

RIP (Routing Information Protocol)

• Metric: hop count (max 15 → infinity = 16).

• v1: classful; v2: classless + authentication + multicast updates.

• Issues: slow convergence, count-to-infinity.

IGRP / EIGRP (Cisco)

• IGRP used composite metric (bandwidth, delay, reliability); proprietary.

• EIGRP (Enhanced IGRP) uses DUAL (Diffusing Update Algorithm) — hybrid: faster convergence, uses feasibility
condition to avoid loops, supports multiple metrics and partial topology knowledge. (EIGRP details are Cisco
proprietary historically.)

Problems & fixes

• Count-to-infinity: When a link goes down, metric increases gradually (can take long). Remedies:

o Split horizon: Do not advertise a route back on the interface from which it was learned.

o Poison reverse: Advertise the route back with infinite metric to explicitly tell neighbor it’s unreachable.

o Hold-down timers: Freeze route changes for a period to settle.

Worked numerical example (Bellman-Ford / DV)

Graph:

• A—1—B

• B—2—C

• A—5—C

Initial knowledge: each node knows neighbors cost.


We iterate updates (assume synchronous rounds):

• Round0: D_A(B)=1 via B; D_A(C)=5 via C (direct).

• After hearing from B (who knows B→C=2), A computes via B: 1 + 2 = 3 → update D_A(C)=3.
Continue until no changes → convergence. (This is the core Bellman-Ford idea.)

RIP uses periodic 30s updates; slow in large networks.

6) Link-State (LS): Dijkstra family — deep

Principle

Every router:

1. Discovers neighbors (HELLO),

2. Measures local link costs,

3. Forms a Link State Packet (LSP/LSA) describing its adjacency and link metrics,

4. Floods LSPs reliably to all routers in area so every router builds a Link State Database (LSDB) (complete topology),

5. Runs Dijkstra’s SPF algorithm on the LSDB to compute shortest paths from itself to all destinations → fills routing
table with next hops.

OSPF (Open Shortest Path First) — key facts

• Open standard (IETF). Areas, hierarchical: Area 0 (backbone) interconnects other areas.

• LSA types: Router LSA (type1), Network LSA (type2), Summary LSA (type3/4), External LSA (type5), NSSA LSAs, etc.

• Timers: frequent LSAs on change; flooding optimized by sequence numbers & aging.

• OSPF metric = cost (often inverse of bandwidth).

• Fast convergence, scalable with area design.

IS-IS (Intermediate System → Intermediate System)

• Link-state protocol developed for ISO CLNP, adapted to IP.

• Uses LSPs, similar to OSPF; hierarchical levels: Level-1 (intra-area), Level-2 (inter-area).

• Popular in ISP backbones (simplicity, extensibility).

Dijkstra’s SPF — worked example (step-by-step)

Graph (weights shown):

/\

1/ \4

B-----C
\2 /3

\/

Weights: A-B=1, A-C=4, B-C=2, C-D=3, B-D=7 maybe. (We’ll produce table.)

Compute shortest from A:

• Start: dist(A)=0, others = ∞.

• Tentative after neighbors: B=1 (via A), C=4 (via A), D=∞.

• Pick smallest tentative → B (1). Mark B permanent.

• From B update: C = min(4, 1+2=3) → update C=3 via B; D = ∞→1+7=8 if B-D=7.

• Pick next smallest → C (3). Mark C permanent.

• From C update: D = min(8, 3+3=6) → update D=6.

• Mark D (6). Done.


Result: A→B=1, A→C=3 (via B), A→D=6 (via C).

Advantages/Disadvantages

• Advantages: fast convergence, loop-free, precise control of metrics.

• Disadvantages: LSDB storage, CPU for SPF, flooding overhead on changes.

7) BGP (Border Gateway Protocol) — full depth (history, messages, attributes, selection)

History & Why BGP

• EGP (1982) existed but didn’t scale/allow policy. BGP introduced (1989) by Rekhter & Lougheed as a Path-Vector
inter-domain protocol to scale Internet routing and allow policy control.

• BGP is the de facto protocol for inter-AS (Internet) routing.

Concepts

• AS (Autonomous System): A network under a single administrative control with an ASN (Autonomous System
Number).

• Path Vector: Routes are advertised along with the AS path (sequence of ASNs) they traverse — prevents loops and
enables policy decisions.

BGP Message Types & Header

• Header (19 bytes): Marker (16 bytes), Length (2), Type (1).

• Message types: OPEN, UPDATE, NOTIFICATION, KEEPALIVE (and ROUTE-REFRESH in extensions).

o OPEN: establish session (AS number, hold time, BGP identifier).

o UPDATE: advertise or withdraw routes (NLRI + path attributes).


o KEEPALIVE: heartbeat to keep session healthy.

o NOTIFICATION: error message and close.

BGP Sessions

• eBGP: between routers in different ASes (direct neighbors usually).

• iBGP: between routers inside same AS (requires full mesh or route-reflector to avoid split horizon issues).

BGP Path Attributes (important ones)

When comparing candidate routes, BGP looks at attributes in order (simplified commonly used tie-break):

1. Highest LOCAL_PREF (local policy, configured, only inside AS)

2. Shortest AS_PATH (fewer AS hops)

3. Lowest ORIGIN (IGP < EGP < Incomplete)

4. Lowest MED (Multi-Exit Discriminator – suggests preferred entry from neighboring AS; non-mandatory)

5. Prefer eBGP over iBGP (prefer external learned via eBGP)

6. Lowest IGP cost to NEXT_HOP (tie-breaker)

7. Further tiebreakers: oldest route, router ID, etc.

Key attributes: AS_PATH, NEXT_HOP, LOCAL_PREF, MED, COMMUNITY, ORIGIN.

Route advertisement & loop prevention

• When AS X advertises a route it appends its ASN to AS_PATH. If a router sees its own ASN in a received AS_PATH,
it rejects to prevent loops.

iBGP full mesh & route reflectors

• iBGP requires that full BGP route advertisements learned from one iBGP peer should not be forwarded to another
iBGP peer unless route is learned via eBGP or route-reflector is used. To avoid full mesh, route reflectors (RR) and
confederations are used.

BGP policy & filtering

• Operators use route filters, prefix-lists, communities, local_pref to implement business policies (prefer customer
routes, avoid certain transit, blackhole untrusted prefixes).

BGP example (path to google)

You (AS12345) → ISP (AS65001) → Transit (AS64500) → Google (AS15169).


BGP advertisements show prefix with AS_PATH [AS15169 AS64500 AS65001] (direction reversed in updates). Router
chooses best path via comparison (local pref, AS_PATH length, etc.).

Advantages/Disadvantages

• Advantages: Scales to global Internet, policy control, loop prevention via AS_PATH, supports route aggregation.

• Disadvantages: Convergence can be slow across many ASes; complex to configure; susceptible to
misconfiguration (prefix leaks) causing large outages.
8) Important algorithmic & operational issues (loops, convergence, scaling)

Routing loops & avoidance

• DV suffers loops; fixes: split horizon, poison reverse, hold-down.

• LS avoids loops by computing SPF on full topology.

• BGP prevents AS loops via AS_PATH.

Convergence

• LS converges quicker (local recomputation).

• DV convergence slower; slow notifications propagate.

• BGP convergence can be slow across domains due to policy, path exploration.

Scaling techniques

• Hierarchy/areas: OSPF areas reduce LSDB size and SPF computation.

• Route aggregation / summarization: reduce routing table size (CIDR summarization).

• Route reflectors/confederations: reduce iBGP full mesh requirement.

9) Worked algorithms — full worked examples (step-by-step)

A) Dijkstra’s Algorithm (detailed table)

Graph (weighted):

Nodes: A, B, C, D, E

Edges:

A-B: 2

A-C: 5

B-C: 1

B-D: 2

C-D: 3

D-E: 1
C-E: 5

Goal: shortest paths from A.

Initialize:

• Permanent set P = { } ; Distances d = {A:0, B:∞, C:∞, D:∞, E:∞}

• Insert neighbors of A: B=2 (via A), C=5 (via A)

Iteration table:

1. Choose smallest tentative (B=2). P={A,B}. Update via B:

o C = min(5, 2+1=3) → C=3 (via B)

o D = min(∞, 2+2=4) → D=4 (via B)

2. Choose next smallest (C=3). P={A,B,C}. Update via C:

o D = min(4, 3+3=6) → D stays 4

o E = min(∞, 3+5=8) → E=8

3. Choose next smallest (D=4). P={A,B,C,D}. Update via D:

o E = min(8, 4+1=5) → E=5 (via D)

4. Choose E=5. P={A,B,C,D,E}. Done.

Results: A→B(2), A→C(3 via B), A→D(4 via B), A→E(5 via D).

B) Bellman-Ford (Distance-vector) — detailed iterations

Use simpler graph:


A—1—B—2—C and A—5—C

Initial tables (distance to each neighbor):

• A: to A=0, B=1, C=5

• B: to B=0, A=1, C=2

• C: to C=0, B=2, A=5

Iteration rounds (updates to neighbors):

• Round1: A receives from B: A learns A→C via B = 1+2=3 → update from 5 to 3.

• B receives from A and C; C receives from B.

• Round2: No further improvements; stabilization reached.

This example shows how routing costs propagate neighbor-to-neighbor.

10) Protocol cheat-sheet (key features concise)

• RIP: DV, hop-count, max 15, periodic updates, slow convergence.


• RIP v2: classless, auth, multicast updates.

• IGRP/EIGRP: Cisco; composite metrics; EIGRP uses DUAL (fast, loop-free convergence).

• OSPF: LS, areas, cost metric, fast convergence, LSAs, RFC-compliant.

• IS-IS: LS, levels 1/2, used in ISP backbones.

• BGP: Path Vector, AS_PATH, policies, eBGP/iBGP, RFC 4271.

11) Advanced / Modern routing topics

QoS Routing

• Routes chosen to satisfy constraints (bandwidth, delay, jitter) — used for VoIP/video. Techniques include
constraint-based routing and MPLS TE.

SDN (Software-Defined Networking)

• Separation of control plane from data plane. Centralized controller (global view) programs forwarding devices
(OpenFlow). Enables global optimization, traffic engineering, and simpler policy control.

AI/ML in routing

• Reinforcement Learning / optimization used experimentally to predict congestion and proactively route; still
research/experimental for production.

12) Full comparison table (final)

Aspect Distance-Vector (RIP) Link-State (OSPF/IS-IS) Path-Vector (BGP)

Knowledge neighbor distances full topology AS path + attributes

Algorithm Bellman-Ford Dijkstra (SPF) Path-vector selection rules

Updates periodic, neighbors event-driven, flooded LSAs route adverts between ASes

Convergence slow fast slow and policy-dependent

Loop avoidance split horizon, poison inherent (SPF) AS_PATH checks

Scalability small nets enterprise/areas global Internet

Examples RIP, (IGRP) OSPF, IS-IS BGP

13) Exam-style summary & answers (bullet points to copy in exam)

• Routing: process to choose path for packet forwarding (L3).

• Non-adaptive: flooding (broadcast), fixed (static), random (probabilistic).


• Adaptive: change with topology: distance-vector (RIP: Bellman-Ford), link-state (OSPF/IS-IS: Dijkstra), path-vector
(BGP: AS path & policy).

• RIP vs OSPF: RIP uses hop count, small scale; OSPF uses link costs, areas, suitable for large enterprise.

• BGP: inter-AS protocol using AS_PATH to prevent loops; attributes LOCAL_PREF, AS_PATH, MED used in selection;
eBGP vs iBGP differences.

• Key algorithms: Bellman-Ford (iterative neighbor updates), Dijkstra (SPF on full topology).

• Defenses: split horizon/poison reverse for DV; LS flooding with seq & aging for LS; AS_PATH loop prevention for
BGP.

14) Practical tips & memory mnemonics

• DV = think “tell my neighbors what I know” (RIP).

• LS = think “I have the map, I compute the roads” (OSPF/IS-IS).

• BGP = think “postal route across countries — here is the AS path and my policies”.

You might also like