vrf main routing ospf router-id 10.125.0.1 network 10.125.0.0/30 area 0 .. ..
Above example shows an OSPF instance configured on main VRF. The configuration of the router-id is not mandatory, since an election process takes place inside OSPF: the router-id is first based on the IP given by manual configuration, followed by the highest IP available on loopback interface, then followed by the highest IP available on non loopback interface.
Network command permits enabling OSPF on the network interface whose address and network mask is included into this prefix, and will announce a link connected to a stub or transit network defined by the interface address and prefix. As the 10.100.0.0/24 network belongs to eth1 interface, then OSPF will establish adjacencies over that interface. The network entry passed as parameter will be passed in the Type 3 LSA.
The area identifier is a 32 bit id by which an area is identified. Note that area value is 0, usually reserved for backbone operations. Having multiple areas in a complex IGP topology permits simplifying the route calculation of OSPF. Only ABR routers will know both areas defined.
It is possible to use an alternative OSPF configuration by defining networks based
on interface and area configurations. Below configuration relies on interface
10.125.0.0/30 network is configured. The below configuration assumes that
there is only one IPv4 address under
eth0_0 so that both configurations are the same.
vrf main routing ospf router-id 10.125.0.1 .. interface eth0_0 ip ospf area 0 .. .. interface physical eth0_0 ipv4 address 10.125.0.1/30
Using above configuration can simplify network deployments, since the address configuration is tightly linked with the IP provisioning done on the interfaces.
You can also disable OSPF, without having to remove the configuration, by using following command:
vrf main routing ospf enabled false
Nonetheless, it is always possible to supress OSPF configuration:
vrf main routing ospf del network 10.125.0.0/24 .. .. del routing ospf ..
The following commands can be used to verify OSPF operation.
Display the global OSPF parameters (timers, area, router-id, etc.):
vrouter> show ospf OSPF Routing Process, Router ID: 10.125.0.1 Supports only single TOS (TOS0) routes This implementation conforms to RFC2328 RFC1583Compatibility flag is disabled OpaqueCapability flag is disabled Initial SPF scheduling delay 0 millisec(s) Minimum hold time between consecutive SPFs 50 millisec(s) Maximum hold time between consecutive SPFs 5000 millisec(s) Hold time multiplier is currently 1 SPF algorithm last executed 55.670s ago Last SPF duration 62 usecs SPF timer is inactive LSA minimum interval 5000 msecs LSA minimum arrival 1000 msecs Write Multiplier set to 20 Refresh timer 10 secs Number of external LSA 0. Checksum Sum 0x00000000 Number of opaque AS LSA 0. Checksum Sum 0x00000000 Number of areas attached to this router: 1 Area ID: 0.0.0.0 (Backbone) Number of interfaces in this area: Total: 1, Active: 1 Number of fully adjacent neighbors in this area: 1 Area has no authentication SPF algorithm executed 4 times Number of LSA 3 Number of router LSA 2. Checksum Sum 0x0001701c Number of network LSA 1. Checksum Sum 0x00005dd4 Number of summary LSA 0. Checksum Sum 0x00000000 Number of ASBR summary LSA 0. Checksum Sum 0x00000000 Number of NSSA LSA 0. Checksum Sum 0x00000000 Number of opaque link LSA 0. Checksum Sum 0x00000000 Number of opaque area LSA 0. Checksum Sum 0x00000000
Display the OSPF v2 RIB:
vrouter> show ospf route ============ OSPF network routing table ============ N 10.125.0.0/24  area: 0.0.0.0 directly attached to eth1 ============ OSPF router routing table ============= ============ OSPF external routing table ===========
Display the OSPF configuration for the specified interface:
vrouter> show ospf interface eth2 eth2 is up ifindex 4, MTU 1500 bytes, BW 1000 Mbit <UP,BROADCAST,RUNNING,MULTICAST> Internet Address 10.125.0.1/24, Area 0.0.0.0 MTU mismatch detection: enabled Router ID 10.125.0.1, Network Type BROADCAST, Cost: 100 Transmit Delay is 1 sec, State DR, Priority 1 No backup designated router on this network Saved Network-LSA sequence number 0x80000002 Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5 Hello due in 5.118s Neighbor Count is 1, Adjacent neighbor count is 1
Display the state of the relations with the neighbors:
vrouter> show ospf neighbor Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL 10.125.0.3 1 Full/DR 30.833s 10.125.0.3 eth1:10.125.0.1 0 0 0
Display the OSPF v2 Link-State databases and information about LSAs (Link State Advertisements)
vrouter> show ospf database default OSPF Router with ID (10.125.0.1) Router Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum Link count 10.125.0.1 10.125.0.1 1171 0x80000007 0xb213 1 10.125.0.3 10.125.0.3 1134 0x80000007 0xae11 1 Net Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum 10.125.0.3 10.125.0.3 1174 0x80000004 0x57d7
vrf main routing ospf network 10.1.1.0/28 area 0 .. .. interface physical eth1_0 ipv4 address 192.168.1.0/24 .. physical eth0_0 ipv4 address 10.1.1.1/28 .. ..
vrf main routing ospf network 10.1.2.0/28 area 0 .. .. interface physical eth1_0 ipv4 address 192.168.2.0/24 .. physical eth0_0 ipv4 address 10.1.1.2/28 .. ..
vrf main routing ospf network 10.1.3.0/28 area 0 .. .. interface physical eth1_0 ipv4 address 192.168.3.0/24 .. physical eth0_0 ipv4 address 10.1.1.3/28 .. ..
The verification of the operation can be done with following command:
rt1> show ospf neighbor Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL 192.168.2.0 1 Full/Backup 33.553s 10.1.1.2 eth0_0:10.1.1.1 0 0 0 192.168.3.0 1 Full/DROther 37.951s 10.1.1.3 eth0_0:10.1.1.1 0 0 0
The state must be Full. In this state, routers are fully adjacent with each other. All the router and network LSAs are exchanged and the routers’ databases are fully synchronized.
When you get used with the semantic of the OSPF v2 database, it can be displayed with the following command. The details about these entries are out of the scope of this document.
rt1> show ospf database default OSPF Router with ID (192.168.2.0) Router Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum Link count 192.168.1.0 192.168.1.0 214 0x80000004 0xeb12 1 192.168.2.0 192.168.2.0 213 0x80000004 0xe713 1 192.168.3.0 192.168.3.0 214 0x80000004 0xe314 1 Net Link States (Area 0.0.0.0) Link ID ADV Router Age Seq# CkSum 10.1.1.1 192.168.1.0 214 0x80000002 0x5d4d
Following example illustrates how OSPF can be used to redistribute routes to BGP. The above drawing is reused, with some changes on rt1 and rt2.
vrf main routing bgp router-id 10.1.1.1 address-family ipv4-unicast redistribute ospf .. .. as 55 neighbor 192.168.1.10 remote-as 55 .. .. .. routing ospf network 10.100.0.0/24 area 0 router-id 10.175.0.1 .. .. interface physical eth1_0 ipv4 address 192.168.1.0/24 .. physical eth0_0 ipv4 address 10.1.1.1/28 .. ..
vrf main routing ospf network 10.1.2.0/28 area 0 network 192.168.2.0/28 area 0 .. .. interface physical eth1_0 ipv4 address 192.168.2.0/24 .. physical eth0_0 ipv4 address 10.1.1.2/28 .. ..
The BGP routing table of rt1 is updated with the information from rt2.
rt1> show bgp ipv4 unicast BGP table version is 4, local router ID is 10.1.1.1, vrf id 0 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 192.168.2.0 10.1.1.2 200 32768 ?
There is a wide variety of per-interface OSPF configuration items. Using same
parameters between 2 OSPF instances is mandatory, and it is often useful to rely
Below example shows it is possible to change the network type of an interface.
The OSPF network of interface
eth0_0 is defined as a non broadcast type.
Adding to that configuration, the retransmit interval timer has been changed.
vrf main routing ospf router-id 10.125.0.1 .. .. routing interface eth1_0 ip ospf network non-broadcast ip ospf area 0 ip ospf retransmit-interval 6 .. ..