Network Layer
Routing algorithms, IP addressing, and packet forwarding
Key Concepts
Shortest path algorithms, IP subnetting, routing protocols
Applications
Internet routing, network design, address management
Exam Focus
Dijkstra algorithm, IP calculations, routing table analysis
Network Layer Topics
Routing Algorithm Concepts
Distance Vector Algorithm
Each router maintains a table of distances to all destinations
Algorithm Formula:
D_x(y) = min_v{c(x,v) + D_v(y)}Properties:
- • Distributed and iterative
- • Uses Bellman-Ford equation
- • Count-to-infinity problem
- • Poisoned reverse solution
Protocols:
Link State Algorithm
Each router has complete network topology information
Algorithm Formula:
Dijkstra's algorithm with network topologyProperties:
- • Global information required
- • Faster convergence
- • No count-to-infinity problem
- • Higher memory requirements
Protocols:
Path Vector Algorithm
Each router maintains the actual path to destinations
Algorithm Formula:
Path advertisement with loop detectionProperties:
- • Loop prevention by path inspection
- • Policy-based routing support
- • Slower convergence
- • Used in inter-domain routing
Protocols:
IP Addressing Concepts
Classful Addressing
| Class | IP Range | Default Mask | Max Hosts |
|---|---|---|---|
| A | 0.0.0.0 - 127.255.255.255 | /8 | 16,777,214 |
| B | 128.0.0.0 - 191.255.255.255 | /16 | 65,534 |
| C | 192.0.0.0 - 223.255.255.255 | /24 | 254 |
| D | 224.0.0.0 - 239.255.255.255 | Multicast | N/A |
| E | 240.0.0.0 - 255.255.255.255 | Reserved | N/A |
CIDR (Classless Inter-Domain Routing)
Network address/prefix length (e.g., 192.168.1.0/24)
Benefits:
- • Reduces routing table size
- • Eliminates class boundaries
- • Allows route aggregation
- • More efficient address allocation
CIDR Examples:
Sample Problems & Solutions
Dijkstra Algorithm Problem
Problem: Find shortest path from vertex 0 to all vertices in given graph.
Given: Graph with 5 vertices, edge weights: (0→1:4), (0→2:2), (1→2:1), (1→3:5), (2→3:8), (2→4:10), (3→4:2)
Solution: Apply Dijkstra's algorithm step by step
IP Subnetting Problem
Problem: Subnet 192.168.1.0/24 into 4 equal subnets.
Solution: