JGTech

Technology drives us

OSPF

2021-12-21 JGTechNetworking

Open Shortest Path First (OSPF) is an IETF link-state routing protocol. RFC 2328 describes IPv4 OSPFv2 and RFC 2740 describes IPv6 OSPFv3.

OSPF utilizes hello packets sent out on each OSPF-enabled interface every 10 seconds by default for neighbor discovery. OSPF determines whether a neighbor is still communicating if a router does not receive a hello packet within 40 seconds.

When a neighbor is discovered, the two routers compare information in the hello packet to determine whether the routers have compatible configurations. The neighbor attempts to establish adjacency by synchronizing their link-state databases to ensure that they have identical OSPF routing information. When all OSPF routers have identical link-state databases, the network is converged and routers start using Dijkstra Shortest Path First (SPF) algorithm to build its route table.

OSPF Link-State Advertisements

When an OSPF router receives an LSA to build its routing table, it forwards that LSA out every OSPF-enabled interface, flooding the OSPF area with this information. The LSAs are flooded based on the link-state refresh time (every 30 minutes by default). Each router maintains a link-state database for the OSPF network.

OSPFv2 LSAs have seven different types (LSA type 1 to 7) and extensions (LSA 9 to 11) called Opaque. Opaque LSAs consist of a standard LSA header followed by application-specific information. OSPFv2 uses Opaque LSAs to support the OSPFv2 graceful restart capability.

Type OSPFv2 Name Description OSPFv3 Name Description
1 Router LSA
  • LSA sent by every router which includes state and cost of all links and a list of all OSPFv2 neighbors on the link
  • Triggers an SPF recalculation
  • Flooded to the local OSPFv2 area
Router LSA
  • LSA sent by every router which includes state and cost of all links but does not include prefix info
  • Triggers an SPF recalculation
  • Flooded to the local OSPFv3 area
2 Network LSA
  • LSA sent by the designated router
  • Lists all routers in the multi-access network
  • Triggers an SPF recalculation
Network LSA
  • LSA sent by the designated router
  • Lists all routers in the multi-access network but does not include prefix information
  • Triggers an SPF recalculation
3 Network Summary LSA
  • LSA sent by the area border router to an external area for each destination in the local area
  • Includes the link cost from the area border router to the local destination
Inter-Area Prefix LSA
  • Same as OSPFv2; just different name
4 ASBR Summary LSA
  • LSA sent by the area border router to an external area
  • Advertises the link cost to the ASBR only
Inter-Area Router LSA
  • Same as OSPFv2; just different name
5 AS External LSA
  • LSA generated by the ASBR
  • Includes the link cost to an external autonomous system destination
  • Flooded throughout the autonomous system
AS External LSA
  • Same as OSPFv2
7 NSSA External LSA
  • LSA generated by the ASBR within a not-so-stubby area (NSSA)
  • Includes the cost to an external autonomous system destination
  • Flooded only within the local NSSA
NSSA External LSA
  • Same as OSPFv2
8 N/A Link LSA
  • LSA sent by every router, using a link-local flooding scope
  • Includes the link-local address and IPv6 prefixes for this link
9 Opaque LSAs LSA used to extend OSPF Intra-Area Prefix LSA
  • LSA sent by every router which includes any prefix or link-state changes
  • Flooded to the local OSPFv3 area
  • Does not trigger an SPF recalculation
10 Opaque LSAs LSA used to extend OSPF N/A
11 Opaque LSAs LSA used to extend OSPF Grace LSAs
  • LSA sent by a restarting router, using a link-local scope
  • Used for graceful restart of OSPFv3
  • LSA group pacing feature controls the flooding rate of LSA updates in your network

OSPF Areas

An area is a logical division of routers and links within an OSPF domain that create separate subdomains. LSA flooding is contained within an area and the link-state database is limited to links within the area. You can assign to interfaces an area ID, which is a 32-bit value that can be a number or in dotted-decimal notation.

If you define more than one area, you must also define the backbone area, which has the reserved area ID of 0.0.0.0. Also, one or more routers become area border routers (ABRs), which connects to both the backbone area and at least one other defined area.

Figure 1: OSPF Areas

The ABR sends type-3 LSA from one connected area to the backbone area. The backbone area sends summarized information about area to another area.

Autonomous system boundary router connects an OSPF area to another autonomous system. An autonomous system is a network controlled by a single technical administration entity.

You can limit the amount of external routing information that floods an area by making it a stub area. A stub area is an area that does not allow type-5 LSAs and have the following requirements:

  • All routers in the stub area are stub routers
  • No ASBR routers exists in the stub area
  • You cannot configure virtual links in the stub area

Figure 2: OSPF Stub Area

All OSPF areas must physically connect to area 0. Virtual links allow you to connect OSPF area ABR to a backbone area ABR when a direct physical connection is not available.

Figure 3: OSPF Virtual Links

OSPF routers with the broadcast network will flood the network with LSAs, so OSPF selects a single router, the designated router (DR), to control the LSA floods and represent the network to the rest of the OSPF area. If the DR fails, OSPF selects a backup designated router (BDR).

Parameters Default
Hello interval 10 seconds
Dead interval 40 seconds
Graceful restart grace period 60 seconds
OSPFv2/OSPFv3 feature Disabled
Stub router advertisement announce time 600 seconds
Reference bandwidth for link cost calculation 40 Gbps
LSA minimal arrival time 1 second
LSA group pacing 240 seconds
SPF calculation initial delay time 0.2 second
SPF calculation maximum wait time 0.5 second
SPF minimum hold time 1 second

OSPF Commands

Global-level command Purpose
feature ospf Enables the OSPFv2 feature
feature ospfv3 Enables the OSPFv3 feature
router ospf ospf-instance-tag Creates a new OSPFv2 routing instance
router ospfv3 ospf-inspection-tag Creates a new OSPFv3 routing instance

 

Routing-level command Purpose
router-id ip-address (Optional) Configures a unique OSPFv2 or OSPFv3 router ID. ip-address must exist on a configured interface in the system.
area area-id authentication Configures the authentication mode for an area
area area-id stub Creates this area as a stub area
area area-id nssa Creates this area as an NSSA
address-family iv6 unicast Enters IPv6 unicast address family mode

 

Interface-level command Purpose
ip ospf cost number (Optional) Configures the OSPFv2 cost metric for this interface
ip ospf dead-interval seconds (Optional) Configures the OSPFv2 dead interval in seconds
ip ospf hello-interval seconds (Optional) Configures the OSPFv2 hello interval in seconds
ip ospf mtu-ignore (Optional) Configures OSPFv2 to ignore any IP maximum transmission unit mismatch with a neighbor
ospf network (Optional) Sets the OSPFv2 network type
ip ospf passive-interface (Optional) Suppresses routing updates on the interface
ip ospf priority number (Optional) Configures the OSPFv2 priority used to determine the DR for an area
ip ospf shutdown (Optional) Shuts down the OSPFv2 instance on this interface
ip ospf message-digest-key key-id md5 key Configures message digest authentication for this interface

 

Global-level Verification and Process Clear command Purpose
show ip ospf Displays the OSPFv2 configuration
show ip ospf interface Displays the OSPFv2 interface configuration
show ip ospf route Displays the internal OSPFv2 routes
show ip ospf virtual-links Displays the information about OSPFv2 virtual links
show running-configuration ospf Displays the current running OSPFv2 configuration
show ip ospf statistics Displays the OSPFv2 event counters
show ip ospf traffic Displays the OSPFv2 packet counters
clear ip ospf neighbor Clears neighbors statistics and resets adjacencies for OSPFv2
show ospfv3 Displays the OSPFv3 configuration
show ospfv3 interface Displays the OSPFv3 interface configuration
clear ospfv3 neighbor Clears neighbor statistics and resets adjacencies for OSPFv3

References

Loading...
JGTechnology

Jerry Garfield The technology keeps moving forward, which makes it easier for the artists to tell their stories and paint the pictures they want. —George Lucas

  • Chat with me about technology
  • Learning is the best ability a human has
  • Always strive for a better self