Assigning a VLAN ID to a trunk interface
Prerequisites
At least one defined VLAN.
Procedure
-
Switch to configuration context with the command
config
. -
Switch to the interface that you want to define as a trunk interface with the command
interface
. -
Disable routing with the command
no routing
. -
Configure the trunk interface and assign a VLAN ID with the command
vlan trunk allowed
.
Examples
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-lag-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-lag-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-lag-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-lag-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-lag-if)# no routing
switch(config-if)# vlan trunk allowed all