Virtual routing and forwarding (VRF) is a technology that allows multiple instances of a routing table to co-exist within the same router at the same time. Because the routing instances are independent, overlapping IP addresses can be used without conflicting with each other. The multiple Routing instances can be made to traverse different path (ie take different outgoing interfaces).
VRFs are the same methods of network isolation/virtualization as VLANs. VLANs are used at the L2 and VRFs are L3 tools.VRFs are to routing table like VLANs are to LANs. Using VRFs, we are virtualizing routing table into multiple routing tables, similarly to VLANs used to virtualize LANs. One could say that VLANs are performing L2 virtualization, VRFs are performing L3 virtualization. VLANs make a single switch look like several switches; VRFs make a single router look like several routers.
Below scenario will help us understand how VRF works and logically separates traffic for multiple customer by having multiple routing table for each customer VRF.In the diagram , PE is the Provider Router connected on FasEthernet 0/0 to C1 and C2 Routers where C1 is customer 1 Router (Allocation under Vlan RED) and C2 is customer 2 Router (Allocation under Vlan GREEN).
1st in order to configure 2 instances of Routing table (1 for customer under RED instance and 1 for customer under GREEN instance) we will allocate different VRF to both the customers and assign different RD values as below –
Next , configure subinterface for both the customers. In this case fa0/0.2 for RED vrf customer and fa0/0.3 for GREEN vrf customer. Please note , the IP address at PE end for both the VRF will remain the same ie 192.168.1.1.
Now since configuration is complete , lets perform the connectivity test.
1st ping from Customer 1 Router towards PE IP address 192.168.1.1 (RED VRF)
2nd ping from customer 2 Router towards PE IP address 192.168.1.1 (GREEN VRF)
Ping test from PE towards customer Routers