OSPF
Open Shortest Path First (OSPF) is a link-state routing protocol for IP networks. It uses a link state routing algorithm and falls into the group of interior routing protocols, operating within a single autonomous system (AS).
OSPF-speaking routers send Hello packets on all OSPF-enabled IP interfaces. If two routers sharing a common data link agree on certain parameters specified in their respective Hello packets, they become neighbors.
Adjacencies, which can be thought of as virtual point-to-point links, are formed between some neighbors. OSPF defines several network types and several router types. The establishment of an adjacency is determined by the types of routers exchanging Hellos and the type of network over which the Hello packets are exchanged.
Each router sends link-state advertisements (LSAs) over all adjacencies. The LSAs describe all of the router’s links, or interfaces, the router's neighbors, and the state of the links. These links might be to stub networks (those without another router attached), to other OSPF routers, to networks in other areas, or to external networks (those learned from another routing process). Because of the varying types of link-state information, OSPF defines multiple LSA types.
Each router receiving an LSA from a neighbor records the LSA in its link-state database and sends a copy of the LSA to all of its other neighbors. By flooding LSAs throughout an area, all routers will build identical link-state databases.
When the databases are complete, each router uses the SPF algorithm to calculate a loop-free graph describing the shortest (lowest cost) path to every known destination, with itself as the root.
When all link-state information has been flooded to all routers in an area, and neighbors have verified that their databases are identical, it means the link-state databases have been synchronized and the route tables have been built. Hello packets are exchanged between neighbors as keepalives, and LSAs are retransmitted. If the network topology is stable, no other activity should occur.For OSPF network design over NVIDIA L3 VMS, please refer to the Virtual Modular Switch Reference Guide.
The router ID is a 32-bit number assigned to the router running the OSPF protocol. This number uniquely identifies the router in the OSPF link-state database.
Router ID can be configured statically, however, if it is not configured, then the default election is as follows:
If a loopback interface already exists, the router ID selects the highest loopback IP address assigned to a loopback interface. Effective tunnel IP is considered as loopback address.
Otherwise, the the highest IP address assigned to any other interface on the system is selected as router ID.
Equal-cost multi-path (ECMP) routing is a routing strategy where next-hop packet forwarding to a single destination can occur over multiple paths. The OSPF link-state routing algorithm can find multiple routes to the same destination, all multiple routes are added to the routing table only if those routes are equal-cost routes.
In case there are several routes with different costs, only the route with the lowest cost is selected. In case there are multiple routes with the same lowest cost, all of them are used (up to maximum of 64 ECMP routes).
ECMP is not configurable but is enabled by default for OSPF.
Prerequisites:
The following configuration example refers to Router 2 in the figure above The remainder of the routers in the figure are configured similarly.
It is recommended to disable STP before enabling OSPF. Use the command “no spanning-tree”.
Enable IP routing functionality. Run:
switch
(config)# ip routingEnable the desired VLAN. Run:
switch
(config)# vlan10
switch
(config)# vlan20
Add this VLAN to the desired interface. Run:
switch
(config)#interface
ethernet1
/1
switch
(config ethernet1
/1
)# switchport access vlan10
switch
(config ethernet1
/1
)# exitswitch
(config)#interface
ethernet1
/2
switch
(config ethernet1
/2
)# switchport access vlan20
Create a VLAN interface. Run:
switch
(config)#interface
vlan10
Apply IP address to the VLAN interface. Run:
switch
(configinterface
vlan10
)# ip address10.10
.10.2
/16
Enable the interface. Run:
switch
(configinterface
vlan10
)# no shutdownCreate a second VLAN interface. Run:
switch
(config)#interface
vlan20
Apply IP address to the second VLAN interface. Run:
switch
(configinterface
vlan20
)# ip address10.10
.20.2
/16
Enable the second interface. Run:
switch
(configinterface
vlan20
)# no shutdown
Basic OSPF Configuration:
Enable OSPF configuration commands. Run:
switch
(config)# protocol ospfCreate an OSPF instance. Run:
switch
(config)# router ospfWarningOnly one instance of OSPF per VRF is supported.
Associate the VLAN interfaces to the OSPF area. Area 0 is the backbone area. Run:
switch
(configinterface
vlan10
)# ip ospf area0
switch
(configinterface
vlan10
)# exitswitch
(config)#interface
vlan20
switch
(configinterface
vlan20
)# ip ospf area0
To verify OSPF configuration and status:
Verify OSPF configuration and status. Run:
switch
(config) # show ip ospf Routing Process1
with ID10.10
.10.10
vrf-default
Stateful High Availability disabled Graceful-restart is not supported Supports only single TOS (TOS0
) route Opaque LSA not supported OSPF Admin State is enabled Redistributing External Routes: Disabled Administrative distance110
Reference Bandwidth is 100Gb Initial SPF schedule delay1
msecs SPF Hold time10
msecs Maximum paths to destination64
Router is not originating router LSA with maximum metric Condition: Always Number of external LSAs0
, checksum sum0
Number of opaque AS LSAs0
,checksum sum0
Number of areas is1
,1
normal,0
stub,0
nssa Number of active areas is1
,1
normal,0
stub,0
nssa Area (0.0
.0.0
) (Active) Interfaces inthis
area:2
Active Interfaces:2
Passive Interfaces:0
SPF Calculation has run5
times This area is Normal area Number of LSAs:1
, checksum sum7700
Verify the OSPF neighbors status. Make sure that each neighbor reaches FULL state with its peer to enable it take part in all dynamic routing changes in the network. Run:
switch
(config) # show ip ospf neighbors Neighbor10.10
.10.1
,interface
address10.10
.10.2
In the area0.0
.0.0
viainterface
Vlan10
Neighbor priority is1
, State is FULL BDR is10.10
.10.1
Options0
Dead timer due in35
Neighbor10.10
.20.1
,interface
address10.10
.20.2
In the area0.0
.0.0
viainterface
Vlan20
Neighbor priority is1
, State is FULL BDR is10.10
.20.1
Options0
Dead timer due in35
Verify the OSPF interface configuration and status. Run:
switch
(config) # show ip ospfinterface
Interface Vlan is10
Enabled, line protocol is Down IP address10.10
.10.2
, Mask255.255
.0.0
[primary] Process ID1
VRF Default, Area0.0
.0.0
OSPF Interface Admin State is enabled State DOWN, Network Type BROADCAST, Cost1
Transmit delay1
sec, Router Priority1
No designated router onthis
network No backup designated router onthis
network Timer intervals (sec's): Hello10
, Dead40
, Wait40
, Retransmit5
No authentication Number of opaque link LSAs:0
, checksum sum0
Interface Vlan is20
Enabled, line protocol is Up IP address10.10
.20.2
, Mask255.255
.0.0
[primary] Process ID1
VRF Default, Area0.0
.0.0
OSPF Interface Admin State is enabled State DESIGNATED ROUTER, Network Type BROADCAST, Cost1
Transmit delay1
sec, Router Priority1
No designated router onthis
network No backup designated router onthis
network Timer intervals (sec's): Hello10
, Dead40
, Wait40
, Retransmit5
No authentication Number of opaque link LSAs:0
, checksum sum0
For more information about this feature and its potential applications, please refer to the following community post: