VRF
Overview
VRFs or Virtual Route Forwarding is used to create virtual routing tables/instances on routers and L3 switches.
The most basic configuration of this is called VRF lite and is used to allow functionality of the same IP range to be used on multiple interfaces on the same device.
The below topology is what we will use as a basic VRF configuration. It also shows the overall use of VRFs; to allow multiple routing tables. Along with the global routing table there is now a "RED" and "BLUE" routing table. This is local to our ISP1 router(but can be exported as we will go over later). Networks, routes, and interfaces that are within/assigned to a VRF will stay within that VRF. As you can see this even allows you to have duplicate IPs on the same device.
VRF Lite
Configuration
Configuration consists of a global configuration to create the VRF and then configuration on the interfaces that will participate in the VRF.
If on a switch you will need to enable ip routing if it is not already enabled.
(config)#ip routing
After this we will create the VRF and add a route distinguisher (RD may not be needed if local only)
(config)# ip vrf "vrf name"
(config-vrf)# rd "route-distinguisher"
This creates the VRF instance.
To assign an interface to a VRF instance you need to enter the interface config for that interface.
(conf-if)# ip vrf forwarding "vrf name"
This will remove the IP addressing if it is already configured, I would recommend assigning a VRF to an interface before adding an IP address.
Misc Commands
(conf)# show ip vrf [brief | detail | interfaces] [vrf-name]
(conf)# show ip route vrf "vrf name"
VRF Advanced
OSPF
BGP
Exporting/Importing routes