This article is going to take you through the configuration of VRF lite. VRF stands for Virtual Routing/Forwarding which is technology that allows you to have multiple routing tables that are kept isolated on a router. It is a feature similar to VLANs on a switch. VRF lite allows you to use the same subnets for each
You can refer to this Cisco document for further details: https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst4500/12-2/25ew/configuration/guide/conf/vrf.html#wp1045190
Note that VRF is usually used when configuring MPLS but because we are not using it with MPLS, it is referred to as VRF lite.
Configuration of VRF lite for IPv4
The following steps will be required to successfully configure VRF lite:
- Create the VRF and set the route distinguisher (rd)
R1(config)# ip vrf [NAME]
R1(config-vrf)# rd 100:1
2. Assigning the interfaces to the VRF (Note: VRF clears the interface IP address so you will have to reconfigure the ip address after applying this command)
R1(config-if)# ip vrf forwarding [NAME]
Review VRF Configuration
- Show the Assigned VRF Interfaces
R1# show ip vrf interfaces
2. Show the VRFs
R1# show ip vrf
3. Show the Routing Table within a VRF
R1# show ip route vrf [NAME]
4. Show the routing protocols operating within VRF
show ip protocol vrf [NAME]
Configure EIGRP and VRF Lite
R1(config)# router eigrp AS
R1(config-router)# address-family ipv4 vrf [NAME] autonomous-system AS
R1(config-router-af)#network [Subnet] [wildcard_mask]
Configure OSPF and VRF Lite
R1(config)# router ospf [Process-id] vrf [NAME]
Configure RIPv2 and VRF Lite
R1(config)# router rip
R1(config-router)# address-family ipv4 vrf [NAME]
Configuration of VRF lite for both IPv4 & IPv6
- Create the VRF and set the route distinguisher (rd)
R1(config)# vrf definition [NAME]
R1(config-vrf)# rd 100:1
R1(config-vrf)#address-family [ipv4|ipv6]
2. Assigning the interfaces to the VRF (Note: VRF clears the interface IP address so you will have to reconfigure the ip address after applying this command)
R1(config-if)# ip vrf forwarding [NAME]
Export and Import Routes from one VRF to another
Importing routes from another VRF using the RD (route distinguisher)
R1(config-vrf)# route-import [RD]
Exporting routes from the VRF using the RD (route distinguisher)
R1(config-vrf)# route-export [RD]
example:
ip vrf GREEN
rd 100:1
route-export 100:1234
ip vrf RED
rd 200:1
router-import 100:1234
Set Default VRF Lite Name
This commands allows you to configure the router in the stated VRF mode.
R1#routing-context vrf [VRFNAME]
R1%VRFNAME#