Assigning a VLAN ID to a trunk 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 a trunk interface with the command interface.
  3. Disable routing with the command no routing.
  4. Configure the trunk interface and assign a VLAN ID with the command vlan trunk allowed.

Example

This example configures interface 1/1/2 as a trunk interface allowing traffic 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 trunk allowed 20

This example configures interface 1/1/2 as a trunk interface allowing traffic with VLAN IDs 2, 3, and 4.

switch# config
switch(config)# vlan 2,3,4
switch(config)# interface 1/1/2
switch(config-if)# no routing
switch(config-if)# vlan trunk allowed 2,3,4

This example configures interface 1/1/2 as a trunk interface allowing traffic with VLAN IDs 2 to 8.

switch# config
switch(config)# vlan 2-8
switch(config)# interface 1/1/2
switch(config-if)# no routing
switch(config-if)# vlan trunk allowed 2-8

This example configures interface 1/1/2 as a trunk interface allowing traffic with VLAN IDs 2 to 8 and 10.

switch# config
switch(config)# vlan 2-8,10
switch(config)# interface 1/1/2
switch(config-if)# no routing
switch(config-if)# vlan trunk allowed 2-8,10

This example configures interface 1/1/2 as a trunk interface allowing traffic on all configured VLAN IDs (20-100).

switch# config
switch(config)# vlan 20-100
switch(config)# interface 1/1/2
switch(config-if)# no routing
switch(config-if)# vlan trunk allowed all