Open Shortest Path First (OSPF) Protocol Explained [Basic Concepts]
Contents
What is OSPF:
OSPF is a standards-based link-state IP routing protocol described in RFC 2328.
Open Shortest Path First (OSPF) is a routing protocol for Internet Protocol (IP) networks. It uses a link-state routing (LSR) algorithm and falls into the group of interior gateway protocols (IGPs), operating within a single autonomous system (AS).
OSPF gathers link state information from available routers and constructs a topology map of the network. The topology is presented as a routing table.
There are 2 versions, OSPFv2 is for IPv4 and OSPFv3 is for IPv6.
Link-State Protocol Characteristics:
With link-state routing protocols (LSR), each router has the full picture of the network topology, and can independently make a decision based on an accurate picture of the network topology.
To do so, each link-state router keeps a record of:
- Its immediate neighbor routers.
- All the other routers in its area of the network, and their attached networks: The router recognizes other routers and networks through LSAs, which are flooded through the network. LSAs are stored in a topology table or database (which is also called an LSDB: Link-State DataBase).
- Then The best paths to each destination are calculated:
Each router independently calculates the best paths to each destination in the network using Dijkstra’s (SPF) algorithm.
The SPF algorithm accumulates costs along each path, from source to destination. The accumulated costs are then used by the router to build a topology table.
All paths are kept in the LSDB. The best paths are then offered to the routing table. Packets arriving at the router are forwarded based on the information held in the routing table.
OSPF LSAs (Link-State Advertisements) types
- When a change occurs in the network topology, the router experiencing the change creates a link-state advertisement (LSA) concerning that link. LSAs are also called link-state protocol data units (PDUs).
- The LSA is multicasted to all neighboring devices using either 224.0.0.5 or 224.0.0.6. Routers receiving the LSA immediately forward it to all neighboring routers.
Standard OSPF LSAs:
- OSPF Type 1 LSA (Route-LSA): Point-to-point connection to another router
– Generated by each router in a given area. Flooded in its own area only (Intra-Area)
- OSPF Type 2 LSA (Network-LSA): The link-state ID of the Type 2 LSA is the IP interface address of the DR.
– This LSA serve as a description for all routers connected to the segment of the DR.
– Non DR router will only flood LSA-1 with no subnet in it. the DR will complete the information.
– Flooded only within the Area.
- OSPF Type 3 LSA (Summary-LSA): advertise inter-area router information to other areas via the ABR.
– Flooded Inter-Area
– Serve as description for the networks in an Area for the Other Areas.
– The Advertising router is the ABR, so, other router in different areas can reach the network via the ABR, which is already know for them via the LSA-1 and 2.
- OSPF Type 5 LSA (AS-external-LSAs): Advertise external redistributed routes into the OSPF Areas via the ASBR. Flooded to all Area, unless restricted (STUB)
– Generated by the ASBR.
– Describe external network to the OSPF domain.
– Its type can be E1 or E2
- OSPF Type 4 LSA (ASBR-Summary): The ABR advertises this LSA to indicate the presence of an (ASBR) to the other areas (but ASBR to ABR communication is still LSA Type-1)
– Since LSA-5 advertising router is the ASBR, the router is different Area need to know how to reach the ASBR, This is resolved by the ABR generating an LSA-4 once it detect the presence of ASBR in its Area (via LSA-1 and O flag set to E indicating “External routing: capable”).
This Table summarises the Common OSPF LSA types:
| LSA name | Generated by | Description |
1 | Router-LSAs | Each internal router within an area | The link-state ID of the type 1 LSA is the originating router
ID. Router-LSAs, describe the following types of interfaces: · Point-to-point connection to another router · Connection to a transit network · Connection to a stub network (Reserved in v3) · Virtual link |
2 | Network-LSAs | The DR | Originated for broadcasts and NBMA networks
by the designated router. This LSA contains the list of routers connected to
the network. The link-state ID of the type 2 LSA is the IP interface address
of the DR. |
3 | Summary-LSAs | The ABR | Type 3 summary-LSAs describe routes to
networks. To inform other areas about inter-area routers. These routes
can also be summarized. |
4 | ASBR-summary | The ABR | Type 4 describe routes to AS boundary
routers beyond its area. The area border router (ABR) generates this LSA to inform
other routers in the OSPF domain, that the matching router is an autonomous
system boundary router (ASBR), so that the external LSAs (Type 5 / Type 7) it
sent may be properly resolved outside its own area. |
5 | AS-external-LSAs | The ASBR | Type 5 These describe routes advertised by
the ASBR. LSAs contain information imported into OSPF from other routing
processes. Together with Type 4 they describe the way to an external route. |
7 | NSSA external link-state advertisements | The ASBR, within a not-so-stubby area | Type 7-LSAs are identical to type-5 LSAs. |
OSPF Route Selection Preference
The Diagram below illustrates the process of OSPF route selection:
OSPF Network type
- Point-to-point: Each router advertises itself by periodically multicasting hello packets. No designated router is elected. The interface can be IP unnumbered.
- Broadcast (default on Ethernet): each router advertises itself by periodically multicasting hello packets.
- Non-broadcast multi-access (NBMA): with the use of designated routers. May need static configuration. Packets are sent as unicast.
- Point-to-multipoint: where OSPF treats neighbors as a collection of point-to-point links. No designated router is elected. Separate hello packets are sent to each neighbor.
Network type | Point to point | Broadcast | Non-Broadcast | Point to Multipoint |
Max routers per network | 2 | Unlimited | Unlimited | Unlimited |
Hello (Default cisco) | 10 | 10 | 30 | 30 |
Dead timers (Default cisco) | 40 | 40 | 120 | 120 |
Wait timer: | 0 | equal to | equal to | 0 |
Automatic neighbour Discovery | Yes | Yes | No | Yes |
hellos are sent to | 224.0.0.5 | 224.0.0.5 | Neighbor IP | 224.0.0.5 |
Neighbor communication are send to | 224.0.0.5 | Unicast | Unicast | Unicast |
LSA’s are sent to: | 224.0.0.5 | DR/BDR: 224.0.0.6 | DR/BDR: 224.0.0.6 | Unicast |
Next-hop IP: | Peer | Original router | Original router | Hub |
OSPF Areas
To minimize processing and memory requirements, OSPF can divide the routing topology into areas.
Characteristics of OSPF areas include:
- Minimizes routing table entries.
- Localizes impact of a topology change within an area.
- Detailed LSA flooding stops at the area boundary.
- Requires a hierarchical network design.
OSPF routers may function as either:
- Internal router
- Backbone router
- Area Border Router (ABR)
- Autonomous System Boundary Router (ASBR)