Tip
This is the documentation for the 20.02 version. Looking for the documentation of the latest version? Have a look here.
Open Shortest Path First v2 (OSPF)¶
Open Shortest Path First v2 (OSPF) is a link-state routing protocol defined by RFC 2328. OSPF automatically locates neighboring IPv4 routers within an autonomous system, typically with multicast, and exchanges IPv4 routing information for networks reachable through each neighbor.
OSPF is an interior routing protocol (IGP), and facilitates routing between private links or segments of local networks.
OSPF Terminology¶
OSPF has some common terms used throughout this section which can be confusing for those unfamiliar with the protocol.
- Area:
A collection of routers inside an AS, each sharing the same area ID. An Area ID is typically formatted like an IP address in dotted quad notation,
nnn.nnn.nnn.nnn
, but can also be expressed as an unsigned 32-bit integer.- Area Border Router (ABR):
A router connected to multiple areas.
- Autonomous System Boundary Router (ASBR):
A router connected to external networks (outside the area).
- Backbone:
The central area of an AS, typically area
0.0.0.0
. All areas in the AS connect to the backbone through ABRs.- Cost:
A numeric value assigned to a link between networks, using by OSPF to calculate optimal paths to a destination. Typically higher bandwidth or higher quality circuits will be assigned a low cost, while circuits that are undesirable will be given a high cost. OSPF will prefer to use a route when it has the lowest total cost from a source to a destination.
- Designated Router (DR):
In a network with multiple routers, one of them will be elected as a Designated Router using Hello messages. The DR takes on the task of generating LSA messages for the network, among other special duties.
- Flooding:
The mechanism by which OSPF routers distribute link state database information to neighbors.
- Hello:
Special OSPF messages which introduce neighbors to each other. Using these messages, neighbors can discover each other and begin to form routing relationships.
- Interior Gateway Protocol (IGP):
A routing protocol, such as OSPF, which exchanges information about how to reach networks inside an autonomous system.
- Link State Advertisement (LSA):
Messages sent by OSPF routers which describe the state of network links, or the router itself, including information about its interfaces and other neighbors.
- Link State Database (LSDB):
A database containing the collected LSA messages of all routers and networks in the domain.
Link State Advertisement Message Types¶
LSA messages each have a type, indicating the information carried within. These types may be referenced throughout this section when describing routing behaviors.
- Type 1 - Router LSA:
Sent by every router in an area. Contains a description of all links on the router, including their state and costs.
- Type 2 - Network LSA:
Sent by the DR for a network. Contains a description of every router attached to the network, including the DR.
- Type 3 - Network Summary-LSA:
Sent by ABRs. Contains a description of destinations outside the current area (inter-area) when the destination is an IP network.
- Type 4 - ASBR Summary-LSA:
Similar to Type 3, but when sent when the destination is an ASBR.
- Type 5 - AS-external LSA:
Sent by ASBRs. Contains a description of destinations outside of this AS. Typically each message only contains information about a single destination.
- Type 6 - Multicast Group Membership LSA:
Not used.
- Type 7 - NSSA External Link-State Advertisements:
Similar to Type 5, but are only exchanged inside an NSSA.
- Type 8 - External attribute LSA:
Carry information from external routing protocols, such as BGP, when such destinations are announced with Type 5 LSAs.
- Type 9 - Link Scope Opaque LSA:
Carries information intended for uses other than OSPF, such as available bandwidth. It is carried through to other routers without being processed by OSPF itself. Type 9 messages are for other routers on the same link.
- Type 10 - Area Scope Opaque LSA:
Similar to Type 9, but flooded to all routers in an area.
- Type 11 - AS Scope Opaque LSA:
Similar to Type 9, but flooded to all routers throughout the AS, except for special areas such as stubs.
Area Types¶
OSPF Areas can be one of several types which alter their behavior in important ways.
- Normal:
A typical area in which all routers know all possible routes.
- Stub Area:
An area with no external connections. Since traffic passing out of a stub area must pass through an ABR, it only needs to know about routes to the ABR, not beyond the ABR. Routers in a stub area do not receive Type 5 LSAs.
- Totally Stub Area:
Similar to a stub area, but routers also do not receive summary LSA messages except for default route information. As such, they do not receive LSA messages of type 3, 4, or 5.
- Not-so-Stubby-Area (NSSA):
Similar to a Stub area but it may contain static routes to non-OSPF networks. Routers in an NSSA exchange external routing information in Type 7 LSAs instead of Type 5.
- NSSA Totally Stub Area:
Similar to both NSSA and a Totally Stub area. As such, they do not receive LSA messages of type 3, 4, or 5.
Metric Types¶
- Type 1 or E1:
A Type 1 external metric, also known as E1, uses a similar cost calculation to typical link states, where internal and external costs are added together to find the total cost.
- Type 2 or E2:
A Type 2 external metric, also known as E2, only considers external costs and ignores internal costs.