Assigning a VLAN ID to an access interface

Prerequisites
At least one defined VLAN.
Procedure
  1. Switch to configuration context with the command config.
  2. Switch to the interface that you want to define as an access interface with the command interface.
  3. Disable routing with the command no routing.
  4. Configure the access interface and assign a VLAN ID with the command vlan access.

Example

This example configures interface 1/1/2 as an access interface with VLAN ID set to 20.

switch# config
switch(config)# vlan 20
switch(config-vlan-20)# exit
switch(config)# interface 1/1/2
switch(config-if)# no routing
switch(config-if)# vlan access 20

This example configures LAG 1 as an access interface with VLAN ID set to 30.

switch# config
switch(config)# vlan 30
switch(config-vlan-30)# exit
switch(config)# interface lag 1
switch(config-lag-if)# no shutdown
switch(config-lag-if)# no routing
switch(config-lag-if)# vlan access 30