Attaching or detaching a port from a VRF

Prerequisites

You must be in the interface configuration context (config-if), or the VLAN interface configuration context (config-vlan-if), or the LAG interface configuration context (config-lag-if).

Procedure
To attach a port to a VRF, enter the following command in the required context.

vrf attach <vrf-name>

Where <vrf-name> is the name of the VRF, up to 32 alpha numeric characters.

CAUTION:

The no form of the command detaches the port from the named VRF and will remove all configurations from the port and attach the port to the default VRF.

See the following examples:
switch(config)# interface 1/1/1
switch(config-if)# vrf attach test
switch(config)# vlan 3
switch(config-vlan)# exit
switch(config)# interface vlan 3
switch(config-if-vlan)# vrf attach test

Related topic: vrf attach (command reference)