User-Defined VRF
#con t | Enter configuration mode. |
(config)#ip vrf vrf1 | Create vrf1 |
(config)#exit | Exit configure mode. |
(config)#interface eth1 | Enter interface mode |
(config-if)#ip vrf forwarding vrf1 | Associate eth1 to vrf1. |
(config-if)#ip address 3.3.3.2/24 | Configure the IP address 3.3.3.2 to eth1 |
(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 |
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
Last modified date: 08/28/2023