What is VRF and why we use it??
VRFs are virtual routers. This is very similar to VLANs in switches. A VRF is totally independent router. It has its own interface, IP subnets, routing protocols, routing and forwarding table.
VRF (Virtual Routing and Forwarding) is used to separate routing table within one router. You can have multiple instance of routing table on the same router using VRF. In a real world application, you can use VRF to separate traffic of various customers using different instance of VRF.
How to create VRF
Cisco(config)#ip vrf Marketing
Cisco(config-vrf)#
VRF related commands
#sh ip vrf – Shows all vrf instances and interface associated to each
How to assign VRF to interfaces
You can assign a VRF to any interfaces including SVI and Loopback
CISCO(config)#interface vlan 100
CISCO(config-if)#ip vrf forwarding Marketing
% Interface vlan 100 IP address 192.168.1.250 removed due to enabling VRF Marketing
CISCO(config-if)#ip address 192.168.1.250 255.255.255.0
CISCO(config-if)#exit
CISCO(config)#vlan 100
CISCO(config-if)#ip vrf forwarding Marketing
CISCO(config-if)#ip address 192.168.1.250 255.255.255.0
VRF is a separate router by itself; you can assign duplicate IPs but need to be assigned to different router. When VRF is assigned to an interface associated with an IP address that IP will be removed but can be easily re-added as you can see in the above example.