Associate a VLAN or Port with a VRF Instance

You can assign a VRF instance to a port or VLAN. You cannot associate a VLAN or port and a VRF instance if the VLAN or port has an IP address. You can configure the IP address after you associate the port and VRF instance.

Before you begin

  • Ensure the VRF is already configured.

Procedure

  1. Enter Interface Configuration mode:

    enable

    configure terminal

    interface GigabitEthernet {slot/port[/sub-port][-slot/port[/sub-port]][,...]} or interface vlan <1–4059>

    Note

    Note

    If the platform supports channelization and the port is channelized, you must also specify the sub-port in the format slot/port/sub-port.

  2. Associate the port or VLAN with a VRF instance:

    vrf WORD<1-16>

Example

Switch:1> enable
Switch:1# configure terminal

Create a VRF named Two:

Switch:1(config-if)# ip vrf Two

Create a VLAN of type byport:

Switch:1(config-if)# vlan create 33 name vlan-30 type port-mstprstp 0

Enter VLAN Interface Configuration mode:

Switch:1(config-if)# interface vlan 33

Assign the VLAN to VRF Two:

Switch:1(config-if)# vrf Two

Assign an IP address to the VLAN:

Switch:1(config-if)# ip address 192.0.2.2/24

Assign a secondary IP address to the VLAN:

Switch:1(config-if)# ip address 192.0.4.2/24

Enter VRF configuration mode:

Switch:1(config-if)# router vrf Two

Variable Definitions

Use the data in the following table to use the vrf command.

Variable

Value

vrf WORD<1-16>

Specifies the VRF instance by name.