Assigning an Interface to a VRF

You must assign an interface or subinterface to a VRF so that when the router receives a packet at this interface, it routes the packet using the VRF’s forwarding table rather the global forwarding table. You can assign the interface from outside the context of the VRF or inside the context of the VRF.

To assign an interface to a VRF from outside the VRF context:

  1. Select the interface.
  2. Specify the VRF to associate with the interface.
    host1:vr1(config)#interface gigabitEthernet 1/0 host1:vr1(config-if)#ip vrf forwarding vrfA
  3. Assign an IP address to the interface because forwarding the interface from the VR to the VRF removes the existing IP configuration from the interface.
    host1:vr1:vrfA(config-if)#ip address 10.16.2.77 255.255.255.0

To assign an interface to a VRF from inside the VRF context:

  1. Select the interface.
  2. Enter the VRF context.
    host1:vr1(config)#virtual-router :vrfA
  3. Associate the interface.
    host1:vr1:vrfA(config)#interface gigabitEthernet 1/0

    In this case, you do not have to reassign an IP address to the interface because you did not use the ip vrf forwarding command.

Related Documentation