What is a VRF, what is VRF-lite, and how do you configure it?
Show the answer
Say this first
A VRF is a separate routing table, with its own interfaces and routing processes, inside one router. Interfaces in different VRFs cannot reach each other unless you leak routes, and the same addresses can exist in two VRFs. VRF-lite means VRFs without MPLS: each VRF is carried hop by hop on its own subinterface or VLAN, and each router runs a routing instance per VRF. It suits a few VRFs over a few hops.
Go deeper
Configuration on IOS-XE
vrf definition CORP
address-family ipv4
exit-address-family
!
vrf definition GUEST
address-family ipv4
exit-address-family
!
interface GigabitEthernet0/0/1.10
encapsulation dot1Q 10
vrf forwarding CORP
ip address 10.10.0.1 255.255.255.0
!
interface GigabitEthernet0/0/1.50
encapsulation dot1Q 50
vrf forwarding GUEST
ip address 10.50.0.1 255.255.255.0
!
interface GigabitEthernet0/0/0.550
encapsulation dot1Q 550
vrf forwarding GUEST
ip address 172.16.50.1 255.255.255.252
!
ip route vrf GUEST 0.0.0.0 0.0.0.0 172.16.50.2
!
router ospf 10 vrf CORP
capability vrf-lite
network 10.10.0.0 0.0.0.255 area 0Guest users get a default route toward a firewall on their own uplink VLAN, and CORP runs OSPF in its own table.
Gotchas
vrf forwardingremoves the interface's IP address. IOS warns% Interface GigabitEthernet0/0/1.50 IPv4 disabled and address(es) removed due to enabling VRF GUEST. Apply the VRF first, then the address.- An RD is optional for VRF-lite on current IOS-XE. BGP needs one as soon as it carries the VRF.
capability vrf-liteturns off checks OSPF does when it thinks it is on an MPLS PE. Without it, some inter-area and external routes may not be installed in a VRF-lite design.- Every command needs the VRF:
show ip route vrf GUEST,ping vrf GUEST 10.50.0.10,traceroute vrf GUEST .... - The older
ip vrfandip vrf forwardingsyntax is IPv4 only.vrf definitionsupports both families.
VRF-lite or MPLS L3VPN
VRF-lite needs a subinterface and a routing instance per VRF on every hop. With many VRFs or many hops, an MPLS L3VPN or EVPN core carries all VRFs over one set of links with labels, RDs and route targets.
They will ask next
Where do you see VRFs on a device you already manage?
The management VRF:
Mgmt-intfon IOS-XE routers,Mgmt-vrfon Catalyst 9000 switches,managementon NX-OS. It keeps the management port out of the data plane routing table.How do VRFs compare with ACLs for separation?
ACLs filter traffic between networks that can still route to each other; one missing line opens a path. VRFs have no route between them at all unless you add one, and they allow overlapping addresses.
Traps
- Configuring the IP address before
vrf forwardingand then wondering where it went. - Testing with a plain ping. Without
vrf, the ping uses the global table.