OcNOS-SP : Layer 3 Guide : VRF Lite Configuration Guide : VRF Configuration : User-Defined VRF
User-Defined VRF
 
#con t
Enter configuration mode.
(config)#ip vrf vrf1
Create vrf1. Use no ip vrf vrf1 to delete the created vrf
(config)#exit
Exit configure mode.
(config)#interface eth1
Enter interface mode
(config-if)#ip vrf forwarding vrf1
Associate eth1 to vrf1. Use no ip vrf forwarding vrf1 for un-configuration
(config-if)#ip address 3.3.3.2/24
Configure the IP address 3.3.3.2 to eth1
(config-if)#commit
Commit the candidate configuration to the running configuration
(config-if)#exit
Exit interface mode.
Adding a Static Route
 
#con t
Enter the router configuration mode
(config)# ip route vrf vrf1 20.20.20.0/24 eth1
Add static route in vrf1 with eth1 as exit interface
(config-if)#commit
Commit the candidate configuration to the running configuration
Validation
#show ip route vrf all
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 "default"
C 127.0.0.0/8 is directly connected, lo, 00:14:59
C 192.168.52.0/24 is directly connected, eth0, 00:14:55
IP Route Table for VRF "management"
IP Route Table for VRF "vrf1"
C 3.3.3.0/24 is directly connected, eth1, 00:00:44
S 20.20.20.0/24 [1/0] is directly connected, eth1, 00:00:08
 
Gateway of last resort is not set
 
To display the IP routing table associated with a VRF, use the show ip route vrf vrf-name command
#sh 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 3.3.3.0/24 is directly connected, eth1, 00:01:22
S 20.20.20.0/24 [1/0] is directly connected, eth1, 00:00:13
 
Gateway of last resort is not set
Use this show command to display the static routes configured
#sh ip route vrf vrf1 static
IP Route Table for VRF "vrf1"
S 20.20.20.0/24 [1/0] is directly connected, eth1, 00:01:13
 
Gateway of last resort is not set
 
Last modified date: 10/16/2023