Associating 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

Give the VLAN an IP address:

Switch:1(config-if)# ip address 192.0.2.1 255.255.255.0

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.

Table 1. Variable definitions

Variable

Value

vrf WORD<0-16>

Specifies the VRF instance by name.