Assigning a VLAN ID to a trunk interface
Prerequisites
至少有一个定义的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 interface1/1/2as a trunk interface allowing traffic with VLAN ID set to20.
switch#configswitch(config)#vlan 20switch(config-vlan-20)#exitswitch(config)#interface 1/1/2switch(config-lag-if)#no routingswitch(config-if)#vlan trunk allowed 20
This example configures interface1/1/2as a trunk interface allowing traffic with VLAN IDs2,3, and4.
switch#configswitch(config)#vlan 2,3,4switch(config)#interface 1/1/2switch(config-lag-if)#no routingswitch(config-if)#vlan trunk allowed 2,3,4
This example configures interface1/1/2as a trunk interface allowing traffic with VLAN IDs2to 8.
switch#configswitch(config)#vlan 2-8switch(config)#interface 1/1/2switch(config-lag-if)#no routingswitch(config-if)#vlan树干允许2 - 8
This example configures interface1/1/2as a trunk interface allowing traffic with VLAN IDs2to 8 and10.
switch#configswitch(config)#vlan 2-8,10switch(config)#interface 1/1/2switch(config-lag-if)#no routingswitch(config-if)#vlan树干允许2 - 8,10
This example configures interface1/1/2as a trunk interface allowing traffic on all configured VLAN IDs (20-100).
switch#configswitch(config)#vlan 20-100switch(config)#interface 1/1/2switch(config-lag-if)#no routingswitch(config-if)#vlan trunk allowed all