6.
OSPF Basics
1. Dynamic Routing Protocols Classification
Dynamic routing protocols are categorized based on how they operate, and
they can be broadly classified into three categories:
1. Distance-Vector Routing Protocols (e.g., RIP, EIGRP)
2. Link-State Routing Protocols (e.g., OSPF, IS-IS)
3. Path-Vector Routing Protocols (e.g., BGP)
1.1 Distance-Vector Routing Protocols
Operation:
Routers periodically share information (routing tables) with their directly
connected neighbours.
The information typically includes the destination network and the cost
(usually measured in hops or another metric) to reach it.
Routers only know the direction (vector) and distance (cost) to a
destination, not the entire network topology.
Drawbacks:
Convergence (the time it takes for routers to update their routing tables)
can be slow.
Prone to routing loops; protocols like RIP use techniques such as split
horizon and count to infinity to mitigate these problems.
1.2 Link-State Routing Protocols
Operation:
Instead of broadcasting the entire routing table, routers running link-
state protocols (e.g., OSPF and IS-IS) send information about the status
of their directly connected links and interfaces, known as Link-State
Advertisements (LSAs).
Each router generates its LSAs, which include details such as:
6. OSPF Basics 1
The cost associated with the interface.
Neighbor relationships.
These LSAs are flooded throughout the network, ensuring that every
router in the network has the same view of the network topology.
1.3 Path-Vector Routing Protocols (e.g., BGP)
Operation:
BGP uses a modified form of distance-vector known as the path-vector
algorithm.
Instead of just sharing distance information, BGP also includes the path
(i.e., the sequence of AS hops) to reach a destination network.
This information helps prevent routing loops in large, diverse networks
like the internet.
2. Link-State Routing Protocol Process:
1. Neighbor Establishment:
Routers first establish neighbor relationships with directly connected
routers. This allows them to exchange and synchronize link-state
information.
2. LSA Flooding:
Routers exchange LSAs with their neighbours to build a consistent view
of the network.
All routers maintain a database called the Link-State Database (LSDB),
which stores these LSAs and describes the entire network topology.
3. Shortest Path First (SPF) Calculation:
Routers use the LSDB to calculate the shortest paths to each
destination. The algorithm used for this is Dijkstra's Shortest Path First
(SPF) algorithm.
The SPF algorithm calculates a loop-free tree with the router itself as
the root, ensuring the most efficient routes are identified.
4. Routing Table Generation:
6. OSPF Basics 2
Based on the SPF calculation, each router generates and updates its
routing table, installing the best routes to all networks within the
topology.
Advantages:
Fast convergence: Because routers have a complete view of the
network topology, they can quickly react to changes.
Scalability: Link-state protocols are more efficient and scalable in larger
networks.
3. Introduction to OSPF (Open Shortest Path First)
OSPF is a widely used link-state routing protocol and a standard Interior
Gateway Protocol (IGP) in the industry.
It exists in two main versions:
OSPFv2 (RFC 2328) for IPv4
OSPFv3 (RFC 2740) for IPv6
OSPF routers exchange link status information rather than routes, which is
crucial for building the network topology and calculating optimal paths.
3.1 Key Concepts of OSPF:
1. Link Status Information:
OSPF routers collect and store link status information in the Link-State
Database (LSDB).
Routers use this information to understand the topology of their area
and calculate loop-free paths using the SPF (Shortest Path First)
algorithm.
2. Areas:
An area is a logical grouping of networks and routers, identified by an
Area ID.
OSPF areas help divide a large network into smaller, manageable
segments.
OSPF supports a multi-area design, allowing for scalability and efficient
routing in larger networks.
6. OSPF Basics 3
3. Router ID:
The Router ID uniquely identifies a router within an OSPF area. It can be
manually configured or automatically assigned based on the IP address
of a router’s interface, typically a Loopback interface.
It's important to ensure that each OSPF router within an area has a
unique Router ID.
4. Cost Values:
OSPF uses cost as a metric to determine the best route. The cost is
calculated based on the interface bandwidth:
DefaultCost = (100Mbit/s)/(InterfaceBandwidth)
The reference value of 100 Mbps is configurable. Each OSPF-enabled
interface calculates its cost based on the bandwidth.
3.2 OSPF Packet Types
OSPF uses five different packet types for interaction between routers:
1. Hello: Periodically sent to discover and maintain neighbor relationships.
2. Database Description (DD): Provides a summary of the router's local
LSDB, used to synchronize LSDBs between neighbours.
3. Link State Request (LSR): Requests specific LSAs from a neighbor after
DD packets have been exchanged.
4. Link State Update (LSU): Sends requested LSAs to a neighbor.
5. Link State Acknowledgment (LSAck): Acknowledges the receipt of
LSAs.
3.3 OSPF Tables
OSPF maintains three key tables:
1. OSPF Neighbor Table:
This table stores information about OSPF neighbor relationships
established using Hello packets.
You can view the neighbor table using the display ospf peer command,
which shows router IDs and interface addresses of neighbours.
6. OSPF Basics 4
2. Link-State Database (LSDB):
The LSDB contains LSAs generated by the router itself and received
from neighbours.
It provides detailed information about the network’s topology, including
LSA types and the router that advertised each LSA.
The command display ospf lsdb allows you to query the LSDB and view
these details.
3. OSPF Routing Table:
This table is separate from the overall router's routing table and
contains OSPF-specific routes.
It includes details like the destination IP address, cost, and next-hop IP
address for routing decisions.
The command display ospf routing displays the OSPF routing table,
showing routes learned through OSPF.
3.4 OSPF Multi-Area Design
OSPF’s multi-area design divides a large network into smaller, more
manageable segments, known as areas.
This enhances scalability and reduces the amount of routing information
exchanged between routers.
Routers within the same area maintain a consistent view of the topology,
while routers in different areas communicate through Area Border Routers
(ABRs).
4. OSPF Working
4.1 OSPF Router Relationships
OSPF routers form two key types of relationships:
1. Neighbor Relationship:
Established when two OSPF-enabled routers on the same network
exchange Hello packets.
6. OSPF Basics 5
This is the initial step where routers recognize each other’s
presence and form a neighbor relationship.
2. Adjacency:
Adjacency goes beyond a simple neighbor relationship. Routers
exchange additional packet types (DD, LSR, LSU, and LSAck) and
synchronize their LSDBs (Link-State Databases).
Once synchronization is complete, and routers calculate routes
independently, an adjacency is established.
4.2 OSPF Adjacency Establishment Process
The process involves four main steps:
1. Neighbor Establishment:
When a router receives a Hello packet from another, it transitions
from the Down state to the Init state.
If the Hello packet lists the router's ID, it moves to the 2-way state,
indicating that bidirectional communication is established.
2. Master/Slave Negotiation:
The state changes from 2-way to Exstart, where the routers
determine their roles (master or slave) based on their router IDs (the
one with the higher ID becomes the master).
They exchange Database Description (DD) packets to describe the
LSDB.
3. LSDB Exchange:
Routers continue exchanging DD packets containing LSDB
descriptions until they agree on the content.
The slave acknowledges each packet sent by the master, ensuring
synchronization.
4. LSA Exchange:
Routers send Link State Requests (LSRs) to request any missing
LSAs.
Link State Updates (LSUs) containing the LSAs are sent in
response, followed by Link State Acknowledgments (LSAcks).
6. OSPF Basics 6
Once both routers have identical LSDBs, the state changes to Full,
completing the adjacency establishment.
4.3 Reviewing the OSPF Neighbor Table
The display ospf peer command provides key information about neighbor
relationships:
OSPF Process ID and Router ID
Area ID of the neighboring router
Neighbor Interface Address
Neighbor State (e.g., Init, 2-way, Full)
DR and BDR Roles
MTU, Priority, and other information like the retransmission interval and
authentication sequence.
4.4 OSPF Network Types
OSPF supports four network types:
1. Point-to-Point (P2P):
Only two devices are connected (e.g., PPP links). Default for
interfaces using PPP encapsulation.
2. Broadcast Multiple Access (BMA):
Supports multiple devices and broadcast (e.g., Ethernet networks).
Default for Ethernet interfaces.
3. Non-Broadcast Multiple Access (NBMA):
Allows multiple devices but does not support broadcast (e.g., Frame
Relay networks).
4. Point-to-Multipoint (P2MP):
Bundles multiple P2P links. Must be manually configured.
5. Designated Router (DR) and Backup Designated
Router (BDR) Roles
6. OSPF Basics 7
In multi-access (MA) networks, such as Ethernet, the number of OSPF
adjacencies can become excessive if each router forms an adjacency with
every other router. This can increase LSA flooding and overload devices.
To manage this, OSPF elects a Designated Router (DR) and a Backup
Designated Router (BDR):
Only the DR and BDR form adjacencies with all routers in the network
segment.
Other routers (DRothers) maintain a 2-way state with each other but do
not form full adjacencies.
The BDR monitors the DR and takes over if the DR fails.
Election rules:
The router with the highest priority becomes the DR.
If priorities are equal, the router with the higher router ID is elected.
The election is non-preemptive (once elected, DR/BDR do not
change unless they fail).
6. OSPF Domain and Area Design
1. OSPF Domain:
An OSPF domain consists of routers that use OSPF to exchange
information and apply the same policies.
Within an area, routers flood LSAs to ensure consistent topology
understanding.
2. Single-Area OSPF:
Suitable for small networks. All routers reside in the same area, meaning
LSDB synchronization occurs network wide.
Issues with a single-area design include:
Larger LSDBs and routing tables as the network grows.
More router resources are consumed, affecting performance.
3. Multi-Area OSPF:
Divides the OSPF domain into multiple areas to optimize performance
and scalability.
6. OSPF Basics 8
The backbone area (Area 0) connects all other areas, preventing inter-
area loops.
Advantages:
Reduces LSA flooding scope and simplifies route calculation.
Supports route summarization at Area Border Routers (ABRs) to
reduce routing table size.
7. Types of OSPF Routers
OSPF routers are classified based on their roles and locations:
1. Internal Router: All interfaces belong to a single area.
2. Area Border Router (ABR): Interfaces span multiple areas, with at least
one interface in the backbone area.
3. Backbone Router: Has at least one interface in the backbone area (Area
0).
4. AS Boundary Router (ASBR): Connects OSPF to other Autonomous
Systems (ASs) and exchanges routes with external networks.
OSPF Area Types
Backbone Area (Area 0): The central area to which all other areas connect.
Non-Backbone Areas: All other areas that must connect to the backbone
area.
Single-Area vs. Multi-Area Deployment
Single-Area Deployment: Suitable for small networks where all routers and
devices can be managed within the same area.
Multi-Area Deployment: Recommended for larger, hierarchical networks,
enhancing scalability and reducing LSA flooding impact.
6. OSPF Basics 9