OcNOS-RON : Layer 3 Guide : VRF Lite Configuration Guide : OSPF Configuration
OSPF Configuration
Overview
Open Shortest Path First (OSPF) is an interior routing protocol operating within a single autonomous system (AS) that uses a link state routing algorithm. OSPF gathers link state information from available routers and constructs a topology map of the network. The topology determines the routing table presented to the Internet layer which makes routing decisions based solely on the destination IP address in IP packets.
This chapter covers OSPF configuration in non-default VRF.
Topology
OSPF topology for VRF
Configuration IPv4 VRF
R1
 
#con t
Enter the router config mode.
(config)#ip vrf vrf1
Create vrf1
((config-vrf)#exit
Exit VRF mode
(config)#router ospf 1 vrf1
Associate the ospf process with vrf1.
(config-router)#network 2.2.2.0/24 area 0
Specify the network type and area 0.
(config-router)#ex
Exit the OSPF configuration mode.
(config)#interface eth1
Enter interface mode.
(config-if)#ip vrf forwarding vrf1
Associate eth1 to vrf1.
(config-if)#ip address 2.2.2.1/24
Assign the IP address 2.2.2.1 to eth1 in vrf1
R2
 
#con t
Enter the router config mode
(config)#ip vrf vrf1
Create vrf1
(config-vrf)#exit
Exit VRF mode
(config)#router ospf 1 vrf1
Associate the ospf process with vrf1
(config-router)#network 2.2.2.0/24 area 0
Specify the network type and area 0.
(config-router)#ex
Exit router mode.
(config)#interface eth1
Enter interface mode.
(config-if)#ip vrf forwarding vrf1
Associate eth1 to vrf1.
(config-if)#ip address 2.2.2.2/24
Assign the IP address 2.2.2.1 to eth1 in vrf1
Validation
R1
#show ip ospf neighbor
Total number of full neighbors: 1
OSPF process 1 VRF(vrf1):
Neighbor ID Pri State Dead Time Address Interface Instance ID
2.2.2.2 1 Full/Backup 00:00:30 2.2.2.2 eth1 0
 
#show ip route vrf vrf1
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
 
IP Route Table for VRF "vrf1"
C 2.2.2.0/24 is directly connected, eth1, 00:11:31
 
Gateway of last resort is not set
R2
#show ip ospf neighbor
Total number of full neighbors: 1
OSPF process 1 VRF(vrf1):
Neighbor ID Pri State Dead Time Address Interface Instance ID
2.2.2.1 1 Full/Backup 00:00:35 2.2.2.1 eth1 0
 
#show ip route vrf vrf1
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
 
IP Route Table for VRF "vrf1"
C 2.2.2.0/24 is directly connected, eth1, 00:11:31
Gateway of last resort is not set