L3 protocols
Layer 3 (L3) protocols operate at the Network Layer of the OSI model. These protocols are primarily responsible for logical addressing, packet forwarding/routing, and managing inter-network communication. Below is a list of some commonly used L3 protocols:
1. IP (Internet Protocol)
IPv4: Internet Protocol version 4; uses 32-bit addresses.
IPv6: Internet Protocol version 6; uses 128-bit addresses for a larger address space.
2. ICMP (Internet Control Message Protocol)
Used for error reporting, diagnostics, and network troubleshooting.
Common tools like ping and traceroute use ICMP messages.
3. ARP (Address Resolution Protocol)
Resolves an IP address (Layer 3) to a MAC address (Layer 2).
Works within the same broadcast domain.
4. RARP (Reverse ARP)
Reverse ARP maps a MAC address to an IP address (opposite of ARP).
Mainly used in legacy systems.
5. OSPF (Open Shortest Path First)
A link-state routing protocol used in IP networks.
Calculates the shortest path using the Dijkstra algorithm.
6. BGP (Border Gateway Protocol)
A path-vector protocol used for routing between autonomous systems (AS) on the internet.
It is the backbone of the global internet routing system.
7. EIGRP (Enhanced Interior Gateway Routing Protocol)
- A Cisco proprietary routing protocol that uses distance-vector routing principles.
8. RIP (Routing Information Protocol)
A simple distance-vector routing protocol that uses hop count as a metric.
RIP v1 (classful) and RIP v2 (classless).
9. IS-IS (Intermediate System to Intermediate System)
A link-state routing protocol often used in large networks or service provider environments.
Works with both IPv4 and IPv6.
10. GRE (Generic Routing Encapsulation)
A tunneling protocol that encapsulates L3 packets for transport over other networks.
Often used to create VPN tunnels.
11. VRRP (Virtual Router Redundancy Protocol)
Allows multiple routers to act as a single virtual router to provide redundancy.
Ensures high availability for gateway redundancy.
12. MPLS (Multiprotocol Label Switching)
Although MPLS operates between L2 and L3, it is considered a Layer 3 protocol.
It uses labels instead of IP addresses to forward packets efficiently.
13. PIM (Protocol Independent Multicast)
A multicast routing protocol used to manage multicast traffic in an IP network.
Types: PIM-SM (Sparse Mode), PIM-DM (Dense Mode).
14. IPsec (Internet Protocol Security)
Provides security at the network layer using encryption and authentication for IP packets.
15. NAT (Network Address Translation)
Maps private IP addresses to public IP addresses to enable communication across the internet.
16. NHRP (Next Hop Resolution Protocol)
- Used in DMVPN networks to resolve the next-hop IP address dynamically.
17. LISP (Locator/ID Separation Protocol)
- A protocol designed to improve routing scalability by separating identity from location.
18. PPP (Point-to-Point Protocol)
- A Layer 3 protocol used for establishing direct connections between two nodes, often over serial links.
19. DHCP (Dynamic Host Configuration Protocol)
- Assigns dynamic IP addresses, subnet masks, and other network configuration parameters to hosts.
20. IGMP (Internet Group Management Protocol)
- Used for managing multicast group memberships in IPv4 networks
What is OSPF?
OSPF is a Link-State Routing Protocol used for IP routing within a single Autonomous System (AS).
It dynamically determines the best path to a destination using the Shortest Path First (SPF) algorithm, also known as the Dijkstra Algorithm.
OSPF is an Interior Gateway Protocol (IGP) and works at Layer 3 of the OSI model.
Why Use OSPF?
Scalability: Handles large networks better than simpler protocols like RIP.
Convergence: OSPF converges (updates routing tables) much faster when changes occur.
Cost-Based Metric: OSPF uses a cost metric (based on bandwidth) to determine the best route.
No Hop Limit: Unlike RIP, which is limited to 15 hops, OSPF has no hop-count restriction.
Classless Routing: Supports VLSM (Variable Length Subnet Masking) and CIDR.
Key Concepts in OSPF
1. OSPF Areas
Areas break large networks into smaller, manageable pieces.
Every OSPF network has at least one Backbone Area (Area 0).
Other areas connect to Area 0 to form a hierarchical structure.
Why Areas?
Reduce the size of routing tables.
Minimize SPF recalculations during topology changes.
Example:
Area 0 (Backbone)
Area 1
Area 2
All areas must connect to Area 0.
2. OSPF Routers
Router Types:
Internal Router (IR): Belongs entirely to one area.
Backbone Router: Part of Area 0.
Area Border Router (ABR): Connects multiple areas.
Autonomous System Boundary Router (ASBR): Connects OSPF to other routing protocols or external networks.
3. OSPF Metric
OSPF uses cost as its metric.
Cost is inversely proportional to bandwidth:
Cost = Reference Bandwidth / Link Bandwidth
Default Reference Bandwidth = 100 Mbps.
Examples:
| Link Bandwidth | Cost |
|----------------|--------|
| 100 Mbps | 1 |
| 10 Mbps | 10 |
| 1 Gbps | 1 (adjust ref bandwidth) |
4. Link-State Database (LSDB)
OSPF routers maintain a Link-State Database containing all network topology information for their area.
The LSDB is synchronized across all routers in the area.
How OSPF Works (Step-by-Step)
Router Initialization
- When an OSPF router boots up, it initializes and checks its interfaces configured for OSPF.
Establishing Adjacencies
OSPF routers form adjacencies (relationships) with neighbor routers to exchange information.
Hello Packets are sent on all OSPF-enabled interfaces to discover neighbors.
Hello Packet Fields:
Field | Purpose |
Router ID | Unique ID of the router (32-bit). |
Area ID | Area to which the router belongs. |
Hello Interval | Time interval for Hello packets. |
Dead Interval | Time to declare neighbor dead. |
Network Mask | Subnet mask of the interface. |
Neighbor Router IDs | List of routers the sender sees. |
OSPF neighbors become adjacent when these parameters match:
Hello Interval
Dead Interval
Area ID
Authentication settings
States in Adjacency Formation:
Down State: No Hello received.
Init State: Received Hello but not two-way yet.
2-Way State: Two-way communication established.
ExStart State: Start exchanging database description packets.
Exchange State: Routers exchange LSAs (Link-State Advertisements).
Loading State: Routers request and send LSA updates.
Full State: Adjacency is fully formed, and LSDBs are synchronized.
Exchanging Routing Information
Routers exchange LSAs (Link-State Advertisements) to describe network topology.
Types of LSAs:
Type 1: Router LSA (sent within an area).
Type 2: Network LSA (sent by DR in multi-access networks).
Type 3: Summary LSA (sent by ABRs).
Type 4: ASBR Summary LSA.
Type 5: External LSA (routes redistributed into OSPF).
Building the Link-State Database (LSDB)
- Each router stores LSAs in its LSDB and synchronizes with neighbors.
Running the SPF Algorithm
The SPF algorithm (Dijkstra) is run on the LSDB to calculate the Shortest Path Tree (SPT).
The router's own interfaces are the root of the tree.
Updating the Routing Table
- The best routes determined by SPF are installed in the router's routing table.
How OSPF Handles Failures
If a link or router fails:
Neighbor routers detect the failure (no Hello packets received within the Dead Interval).
An updated LSA is flooded to all routers in the area.
The affected routers rerun the SPF algorithm to calculate new routes.
The routing tables are updated.
Key OSPF Packet Types
Hello Packet: Discovers and maintains neighbors.
Database Description (DBD): Summarizes LSDB content during sync.
Link-State Request (LSR): Requests missing LSAs.
Link-State Update (LSU): Carries LSAs to neighbors.
Link-State Acknowledgment (LSAck): Acknowledges receipt of LSAs.
Summary
OSPF is a link-state protocol that uses the SPF (Dijkstra) algorithm to find the best routes.
Routers form adjacencies with neighbors using Hello Packets.
They exchange LSAs to build a Link-State Database (LSDB).
The SPF algorithm runs on the LSDB to calculate the shortest paths, which are installed in the routing table.
OSPF handles failures quickly by detecting changes and flooding updated LSAs