この製品のマニュアルセットは、偏向のない言語を使用するように配慮されています。このマニュアルセットでの偏向のない言語とは、年齢、障害、性別、人種的アイデンティティ、民族的アイデンティティ、性的指向、社会経済的地位、およびインターセクショナリティに基づく差別を意味しない言語として定義されています。製品ソフトウェアのユーザーインターフェイスにハードコードされている言語、RFP のドキュメントに基づいて使用されている言語、または参照されているサードパーティ製品で使用されている言語によりドキュメントに例外が存在する場合があります。シスコのインクルーシブランゲージに対する取り組みの詳細は、こちらをご覧ください。
このドキュメントは、米国シスコ発行ドキュメントの参考和訳です。リンク情報につきましては、日本語版掲載時点で、英語版にアップデートがあり、リンク先のページが移動/変更されている場合がありますことをご了承ください。あくまでも参考和訳となりますので、正式な内容については米国サイトのドキュメントを参照ください。
目次
Your software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.
The IEEE 802.1Q trunks impose these limitations on the trunking strategy for a network:
In a network of Cisco switches connected through IEEE 802.1Q trunks, the switches maintain one spanning-tree instance for each VLAN allowed on the trunks. Non-Cisco devices might support one spanning-tree instance for all VLANs.
When you connect a Cisco switch to a non-Cisco device through an IEEE 802.1Q trunk, the Cisco switch combines the spanning-tree instance of the VLAN of the trunk with the spanning-tree instance of the non-Cisco IEEE 802.1Q switch. However, spanning-tree information for each VLAN is maintained by Cisco switches separated by a cloud of non-Cisco IEEE 802.1Q switches. The non-Cisco IEEE 802.1Q cloud separating the Cisco switches is treated as a single trunk link between the switches.
Make sure the native VLAN for an IEEE 802.1Q trunk is the same on both ends of the trunk link. If the native VLAN on one end of the trunk is different from the native VLAN on the other end, spanning-tree loops might result.
Disabling spanning tree on the native VLAN of an IEEE 802.1Q trunk without disabling spanning tree on every VLAN in the network can potentially cause spanning-tree loops. We recommend that you leave spanning tree enabled on the native VLAN of an IEEE 802.1Q trunk or disable spanning tree on every VLAN in the network. Make sure your network is loop-free before disabling spanning tree.
Dynamic Trunking Protocol (DTP) is not supported on private-VLAN ports or tunnel ports.
The switch does not support Layer 3 trunks; you cannot configure subinterfaces or use the encapsulation keyword on Layer 3 interfaces. The switch does support Layer 2 trunks and Layer 3 VLAN interfaces, which provide equivalent capabilities.
A trunk is a point-to-point link between one or more Ethernet switch interfaces and another networking device such as a router or a switch. Ethernet trunks carry the traffic of multiple VLANs over a single link, and you can extend the VLANs across an entire network.
The following trunking encapsulations are available on all Ethernet interfaces:
Ethernet trunk interfaces support different trunking modes. You can set an interface as trunking or nontrunking or to negotiate trunking with the neighboring interface. To autonegotiate trunking, the interfaces must be in the same VTP domain.
Trunk negotiation is managed by the Dynamic Trunking Protocol (DTP), which is a Point-to-Point Protocol (PPP). However, some internetworking devices might forward DTP frames improperly, which could cause misconfigurations.
To avoid this, you should configure interfaces connected to devices that do not support DTP to not forward DTP frames, that is, to turn off DTP.
If you do not intend to trunk across those links, use the switchport mode access interface configuration command to disable trunking.
To enable trunking to a device that does not support DTP, use the switchport mode trunk and switchport nonegotiate interface configuration commands to cause the interface to become a trunk but to not generate DTP frames. Use theswitchport trunk encapsulation dot1q interface to select the encapsulation type on the trunk port.
You can also specify on DTP interfaces whether the trunk uses IEEE 802.1Q encapsulation or if the encapsulation type is autonegotiated. The DTP supports autonegotiation of IEEE 802.1Q trunks.
Mode |
Function |
||
---|---|---|---|
switchport mode access |
Puts the interface (access port) into permanent nontrunking mode and negotiates to convert the link into a nontrunk link. The interface becomes a nontrunk interface regardless of whether or not the neighboring interface is a trunk interface. |
||
switchport mode dynamic auto |
Makes the interface able to convert the link to a trunk link. The interface becomes a trunk interface if the neighboring interface is set to trunk or desirable mode. The default switchport mode for all Ethernet interfaces is dynamic auto. |
||
switchport mode dynamic desirable |
Makes the interface actively attempt to convert the link to a trunk link. The interface becomes a trunk interface if the neighboring interface is set to trunk, desirable, or auto mode. |
||
switchport mode trunk |
Puts the interface into permanent trunking mode and negotiates to convert the neighboring link into a trunk link. The interface becomes a trunk interface even if the neighboring interface is not a trunk interface. |
||
switchport nonegotiate |
Prevents the interface from generating DTP frames. You can use this command only when the interface switchport mode is access or trunk. You must manually configure the neighboring interface as a trunk interface to establish a trunk link. |
||
switchport mode dot1q-tunnel |
Configures the interface as a tunnel (nontrunking) port to be connected in an asymmetric link with an IEEE 802.1Q trunk port. The IEEE 802.1Q tunneling is used to maintain customer VLAN integrity across a service provider network. |
||
switchport mode private-vlan |
Configures the private VLAN mode.
|
By default, a trunk port sends traffic to and receives traffic from all VLANs. All VLAN IDs, 1 to 4094, are allowed on each trunk. However, you can remove VLANs from the allowed list, preventing traffic from those VLANs from passing over the trunk.
To reduce the risk of spanning-tree loops or storms, you can disable VLAN 1 on any individual VLAN trunk port by removing VLAN 1 from the allowed list. When you remove VLAN 1 from a trunk port, the interface continues to send and receive management traffic, for example, Cisco Discovery Protocol (CDP), Port Aggregation Protocol (PAgP), Link Aggregation Control Protocol (LACP), DTP, and VTP in VLAN 1.
If a trunk port with VLAN 1 disabled is converted to a nontrunk port, it is added to the access VLAN. If the access VLAN is set to 1, the port will be added to VLAN 1, regardless of the switchport trunk allowed setting. The same is true for any VLAN that has been disabled on the port.
A trunk port can become a member of a VLAN if the VLAN is enabled, if VTP knows of the VLAN, and if the VLAN is in the allowed list for the port. When VTP detects a newly enabled VLAN and the VLAN is in the allowed list for a trunk port, the trunk port automatically becomes a member of the enabled VLAN. When VTP detects a new VLAN and the VLAN is not in the allowed list for a trunk port, the trunk port does not become a member of the new VLAN.
Load sharing divides the bandwidth supplied by parallel trunks connecting switches. To avoid loops, STP normally blocks all but one parallel link between switches. Using load sharing, you divide the traffic between the links according to which VLAN the traffic belongs.
You configure load sharing on trunk ports by using STP port priorities or STP path costs. For load sharing using STP port priorities, both load-sharing links must be connected to the same switch. For load sharing using STP path costs, each load-sharing link can be connected to the same switch or to two different switches.
When two ports on the same switch form a loop, the switch uses the STP port priority to decide which port is enabled and which port is in a blocking state. You can set the priorities on a parallel trunk port so that the port carries all the traffic for a given VLAN. The trunk port with the higher priority (lower values) for a VLAN is forwarding traffic for that VLAN. The trunk port with the lower priority (higher values) for the same VLAN remains in a blocking state for that VLAN. One trunk port sends or receives all traffic for the VLAN.
This figure shows two trunks connecting supported switches.
Trunk 1 carries traffic for VLANs 8 through 10, and Trunk 2 carries traffic for VLANs 3 through 6. If the active trunk fails, the trunk with the lower priority takes over and carries the traffic for all of the VLANs. No duplication of traffic occurs over any trunk port.
You can configure parallel trunks to share VLAN traffic by setting different path costs on a trunk and associating the path costs with different sets of VLANs, blocking different ports for different VLANs. The VLANs keep the traffic separate and maintain redundancy in the event of a lost link.
Trunk ports 1 and 2 are configured as 100BASE-T ports. These VLAN path costs are assigned:
Trunking interacts with other features in these ways:
A trunk port cannot be a secure port.
A trunk port cannot be a tunnel port.
We recommend that you configure no more than 24 trunk ports in Per VLAN Spanning Tree (PVST) mode and no more than 40 trunk ports in Multiple Spanning Tree (MST) mode.
If you try to enable IEEE 802.1x on a trunk port, an error message appears, and IEEE 802.1x is not enabled. If you try to change the mode of an IEEE 802.1x-enabled port to trunk, the port mode is not changed.
A port in dynamic mode can negotiate with its neighbor to become a trunk port. If you try to enable IEEE 802.1x on a dynamic port, an error message appears, and IEEE 802.1x is not enabled. If you try to change the mode of an IEEE 802.1x-enabled port to dynamic, the port mode is not changed.
Feature |
Default Setting |
---|---|
Interface mode |
switchport mode dynamic auto |
Trunk encapsulation |
switchport trunk encapsulation negotiate |
Allowed VLAN range |
VLANs 1 to 4094 |
VLAN range eligible for pruning |
VLANs 2 to 1001 |
Default VLAN (for access ports) |
VLAN 1 |
Native VLAN (for IEEE 802.1Q trunks) |
VLAN 1 |
To avoid trunking misconfigurations, configure interfaces connected to devices that do not support DTP to not forward DTP frames, that is, to turn off DTP.
If you do not intend to trunk across those links, use the switchport mode access interface configuration command to disable trunking.
To enable trunking to a device that does not support DTP, use the switchport mode trunk and switchport nonegotiate interface configuration commands to cause the interface to become a trunk but to not generate DTP frames.
Because trunk ports send and receive VTP advertisements, to use VTP you must ensure that at least one trunk port is configured on the switch and that this trunk port is connected to the trunk port of a second switch. Otherwise, the switch cannot receive any VTP advertisements.
2. interface interface-id
3. switchport mode {dynamic {auto | desirable} | trunk}
4. switchport access vlan vlan-id
5. switchport trunk native vlan vlan-id
7. show interfaces interface-id switchport
8. show interfaces interface-id trunk
9. copy running-config startup-config
VLAN 1 is the default VLAN on all trunk ports in all Cisco switches, and it has previously been a requirement that VLAN 1 always be enabled on every trunk link. You can use the VLAN 1 minimization feature to disable VLAN 1 on any individual VLAN trunk link so that no user traffic (including spanning-tree advertisements) is sent or received on VLAN 1.
2. interface interface-id
3. switchport mode trunk
4. switchport trunk allowed vlan {add | all | except | none | remove} vlan-list
6. show interfaces interface-id switchport
7. copy running-config startup-config
コマンドまたはアクション | 目的 | |||
---|---|---|---|---|
ステップ 1 |
configure terminal 例: Switch# configure terminal |
|||
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Specifies the port to be configured, and enters interface configuration mode. |
||
ステップ 3 | switchport mode trunk 例:
Switch(config-if)# switchport mode trunk
|
Configures the interface as a VLAN trunk port. |
||
ステップ 4 | switchport trunk allowed vlan {add | all | except | none | remove} vlan-list 例:
Switch(config-if)# switchport trunk allowed vlan remove 2
|
(Optional) Configures the list of VLANs allowed on the trunk. The vlan-list parameter is either a single VLAN number from 1 to 4094 or a range of VLANs described by two VLAN numbers, the lower one first, separated by a hyphen. Do not enter any spaces between comma-separated VLAN parameters or in hyphen-specified ranges. All VLANs are allowed by default. |
||
ステップ 5 |
end 例: Switch(config)# end |
|||
ステップ 6 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet1/0/1
|
Verifies your entries in the Trunking VLANs Enabled field of the display. |
||
ステップ 7 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file.
|
The pruning-eligible list applies only to trunk ports. Each trunk port has its own eligibility list. VTP pruning must be enabled for this procedure to take effect.
2. interface interface-id
3. switchport trunk pruning vlan {add | except | none | remove} vlan-list [,vlan [,vlan [,,,]]
5. show interfaces interface-id switchport
6. copy running-config startup-config
コマンドまたはアクション | 目的 | |||
---|---|---|---|---|
ステップ 1 |
configure terminal 例: Switch# configure terminal |
|||
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet2/0/1
|
Selects the trunk port for which VLANs should be pruned, and enters interface configuration mode. |
||
ステップ 3 | switchport trunk pruning vlan {add | except | none | remove} vlan-list [,vlan [,vlan [,,,]] |
Configures the list of VLANs allowed to be pruned from the trunk. For explanations about using the add, except, none, and remove keywords, see the command reference for this release. Separate non-consecutive VLAN IDs with a comma and no spaces; use a hyphen to designate a range of IDs. Valid IDs are 2 to 1001. Extended-range VLANs (VLAN IDs 1006 to 4094) cannot be pruned. VLANs that are pruning-ineligible receive flooded traffic. The default list of VLANs allowed to be pruned contains VLANs 2 to 1001.
|
||
ステップ 4 |
end 例: Switch(config)# end |
|||
ステップ 5 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet2/0/1 switchport
|
Verifies your entries in the Pruning VLANs Enabled field of the display. |
||
ステップ 6 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
A trunk port configured with IEEE 802.1Q tagging can receive both tagged and untagged traffic. By default, the switch forwards untagged traffic in the native VLAN configured for the port. The native VLAN is VLAN 1 by default.
The native VLAN can be assigned any VLAN ID.
If a packet has a VLAN ID that is the same as the outgoing port native VLAN ID, the packet is sent untagged; otherwise, the switch sends the packet with a tag.
2. interface interface-id
3. switchport trunk native vlan vlan-id
4. end
5. show interfaces interface-id switchport
6. copy running-config startup-config
コマンドまたはアクション | 目的 | |
---|---|---|
ステップ 1 |
configure terminal 例: Switch# configure terminal |
|
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/2
|
Defines the interface that is configured as the IEEE 802.1Q trunk, and enters interface configuration mode. |
ステップ 3 | switchport trunk native vlan vlan-id 例:
Switch(config-if)# switchport trunk native vlan 12
|
Configures the VLAN that is sending and receiving untagged traffic on the trunk port. For vlan-id, the range is 1 to 4094. |
ステップ 4 | end 例:
Switch(config-if)# end
|
Returns to privileged EXEC mode. |
ステップ 5 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet1/0/2 switchport
|
Verifies your entries in the Trunking Native Mode VLAN field. |
ステップ 6 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
If your switch is a member of a switch stack, you must use the spanning-tree [vlan vlan-id] cost cost interface configuration command instead of the spanning-tree [vlan vlan-id] port-priority priority interface configuration command to select an interface to put in the forwarding state. Assign lower cost values to interfaces that you want selected first and higher cost values that you want selected last.
These steps describe how to configure a network with load sharing using STP port priorities.
1. configure terminal
2. vtp domain domain-name
3. vtp mode server
5. show vtp status
6. show vlan
7. configure terminal
8. interface interface-id
9. switchport mode trunk
10. end
11. show interfaces interface-id switchport
12. Repeat the above steps on Switch A for a second port in the switch or switch stack.
13. Repeat the above steps on Switch B to configure the trunk ports that connect to the trunk ports configured on Switch A.
14. show vlan
15. configure terminal
16. interface interface-id
17. spanning-tree vlan vlan-range port-priority priority-value
18. exit
19. interface interface-id
20. spanning-tree vlan vlan-range port-priority priority-value
21. end
22. show running-config
23. copy running-config startup-config
コマンドまたはアクション | 目的 | |
---|---|---|
ステップ 1 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode on Switch A. |
ステップ 2 | vtp domain domain-name 例:
Switch(config)# vtp domain workdomain
|
Configures a VTP administrative domain. The domain name can be 1 to 32 characters. |
ステップ 3 | vtp mode server 例:
Switch(config)# vtp mode server
|
Configures Switch A as the VTP server. |
ステップ 4 |
end 例: Switch(config)# end |
|
ステップ 5 | show vtp status 例:
Switch# show vtp status
|
Verifies the VTP configuration on both Switch A and Switch B. In the display, check the VTP Operating Mode and the VTP Domain Name fields. |
ステップ 6 | show vlan 例:
Switch# show vlan
|
Verifies that the VLANs exist in the database on Switch A. |
ステップ 7 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode. |
ステップ 8 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface to be configured as a trunk, and enters interface configuration mode. |
ステップ 9 | switchport mode trunk 例:
Switch(config-if)# switchport mode trunk
|
Configures the port as a trunk port. |
ステップ 10 | end 例:
Switch(config-if)# end
|
Returns to privileged EXEC mode. |
ステップ 11 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet1/0/1
|
Verifies the VLAN configuration. |
ステップ 12 | Repeat the above steps on Switch A for a second port in the switch or switch stack. | |
ステップ 13 | Repeat the above steps on Switch B to configure the trunk ports that connect to the trunk ports configured on Switch A. | |
ステップ 14 | show vlan 例:
Switch# show vlan
|
When the trunk links come up, VTP passes the VTP and VLAN information to Switch B. This command verifies that Switch B has learned the VLAN configuration. |
ステップ 15 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode on Switch A. |
ステップ 16 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface to set the STP port priority, and enters interface configuration mode. |
ステップ 17 | spanning-tree vlan vlan-range port-priority priority-value 例:
Switch(config-if)# spanning-tree vlan 8-10 port-priority 16
|
Assigns the port priority for the VLAN range specified. Enter a port priority value from 0 to 240. Port priority values increment by 16. |
ステップ 18 | exit 例:
Switch(config-if)# exit
|
Returns to global configuration mode. |
ステップ 19 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/2
|
Defines the interface to set the STP port priority, and enters interface configuration mode. |
ステップ 20 | spanning-tree vlan vlan-range port-priority priority-value 例:
Switch(config-if)# spanning-tree vlan 3-6 port-priority 16
|
Assigns the port priority for the VLAN range specified. Enter a port priority value from 0 to 240. Port priority values increment by 16. |
ステップ 21 | end 例:
Switch(config-if)# end
|
Returns to privileged EXEC mode. |
ステップ 22 | show running-config 例:
Switch# show running-config
|
Verifies your entries. |
ステップ 23 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
These steps describe how to configure a network with load sharing using STP path costs.
1. configure terminal
2. interface interface-id
3. switchport mode trunk
4. exit
5. Repeat Steps 2 through 4 on a second interface in Switch A or in Switch A stack.
7. show running-config
8. show vlan
9. configure terminal
10. interface interface-id
11. spanning-tree vlan vlan-range cost cost-value
12. end
13. Repeat Steps 9 through 13 on the other configured trunk interface on Switch A, and set the spanning-tree path cost to 30 for VLANs 8, 9, and 10.
14. exit
15. show running-config
16. copy running-config startup-config
コマンドまたはアクション | 目的 | |
---|---|---|
ステップ 1 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode on Switch A. |
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface to be configured as a trunk, and enters interface configuration mode. |
ステップ 3 | switchport mode trunk 例:
Switch(config-if)# switchport mode trunk
|
Configures the port as a trunk port. |
ステップ 4 | exit 例:
Switch(config-if)# exit
|
Returns to global configuration mode. |
ステップ 5 | Repeat Steps 2 through 4 on a second interface in Switch A or in Switch A stack. | |
ステップ 6 |
end 例: Switch(config)# end |
|
ステップ 7 | show running-config 例:
Switch# show running-config
|
Verifies your entries. In the display, make sure that the interfaces are configured as trunk ports. |
ステップ 8 | show vlan 例:
Switch# show vlan
|
When the trunk links come up, Switch A receives the VTP information from the other switches. This command verifies that Switch A has learned the VLAN configuration. |
ステップ 9 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode. |
ステップ 10 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface on which to set the STP cost, and enters interface configuration mode. |
ステップ 11 | spanning-tree vlan vlan-range cost cost-value 例:
Switch(config-if)# spanning-tree vlan 2-4 cost 30
|
Sets the spanning-tree path cost to 30 for VLANs 2 through 4. |
ステップ 12 | end 例:
Switch(config-if)# end
|
Returns to global configuration mode. |
ステップ 13 | Repeat Steps 9 through 13 on the other configured trunk interface on Switch A, and set the spanning-tree path cost to 30 for VLANs 8, 9, and 10. | |
ステップ 14 | exit 例:
Switch(config)# exit
|
Returns to privileged EXEC mode. |
ステップ 15 | show running-config 例:
Switch# show running-config
|
Verifies your entries. In the display, verify that the path costs are set correctly for both trunk interfaces. |
ステップ 16 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
This example shows how to configure a port as an IEEE 802.1Q trunk. The example assumes that the neighbor interface is configured to support IEEE 802.1Q trunking.
Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface gigabitethernet0/2 Switch(config-if)# switchport mode dynamic desirable Switch(config-if)# switchport trunk encapsulation dot1q Switch(config-if)# end
This example shows how to remove VLAN 2 from the allowed VLAN list on a port:
Switch(config)# interface gigabitethernet0/1 Switch(config-if)# switchport trunk allowed vlan remove 2 Switch(config-if)# end
After configuring VLAN trunks, you can configure the following:
Related Topic | Document Title |
---|---|
For complete syntax and usage information for the commands used in this chapter. |
Standard/RFC | Title |
---|---|
— |
— |
MIB | MIBs Link |
---|---|
All supported MIBs for this release. | To locate and download MIBs for selected platforms, Cisco IOS releases, and feature sets, use Cisco MIB Locator found at the following URL: |
Description | Link |
---|---|
The Cisco Support website provides extensive online resources, including documentation and tools for troubleshooting and resolving technical issues with Cisco products and technologies. To receive security and technical information about your products, you can subscribe to various services, such as the Product Alert Tool (accessed from Field Notices), the Cisco Technical Services Newsletter, and Really Simple Syndication (RSS) Feeds. Access to most tools on the Cisco Support website requires a Cisco.com user ID and password. |
Release | Modification |
---|---|
Cisco IOS 15.0(2)EX1 |
This feature was introduced. |
目次
Your software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.
The IEEE 802.1Q trunks impose these limitations on the trunking strategy for a network:
In a network of Cisco switches connected through IEEE 802.1Q trunks, the switches maintain one spanning-tree instance for each VLAN allowed on the trunks. Non-Cisco devices might support one spanning-tree instance for all VLANs.
When you connect a Cisco switch to a non-Cisco device through an IEEE 802.1Q trunk, the Cisco switch combines the spanning-tree instance of the VLAN of the trunk with the spanning-tree instance of the non-Cisco IEEE 802.1Q switch. However, spanning-tree information for each VLAN is maintained by Cisco switches separated by a cloud of non-Cisco IEEE 802.1Q switches. The non-Cisco IEEE 802.1Q cloud separating the Cisco switches is treated as a single trunk link between the switches.
Make sure the native VLAN for an IEEE 802.1Q trunk is the same on both ends of the trunk link. If the native VLAN on one end of the trunk is different from the native VLAN on the other end, spanning-tree loops might result.
Disabling spanning tree on the native VLAN of an IEEE 802.1Q trunk without disabling spanning tree on every VLAN in the network can potentially cause spanning-tree loops. We recommend that you leave spanning tree enabled on the native VLAN of an IEEE 802.1Q trunk or disable spanning tree on every VLAN in the network. Make sure your network is loop-free before disabling spanning tree.
Dynamic Trunking Protocol (DTP) is not supported on private-VLAN ports or tunnel ports.
The switch does not support Layer 3 trunks; you cannot configure subinterfaces or use the encapsulation keyword on Layer 3 interfaces. The switch does support Layer 2 trunks and Layer 3 VLAN interfaces, which provide equivalent capabilities.
A trunk is a point-to-point link between one or more Ethernet switch interfaces and another networking device such as a router or a switch. Ethernet trunks carry the traffic of multiple VLANs over a single link, and you can extend the VLANs across an entire network.
The following trunking encapsulations are available on all Ethernet interfaces:
Ethernet trunk interfaces support different trunking modes. You can set an interface as trunking or nontrunking or to negotiate trunking with the neighboring interface. To autonegotiate trunking, the interfaces must be in the same VTP domain.
Trunk negotiation is managed by the Dynamic Trunking Protocol (DTP), which is a Point-to-Point Protocol (PPP). However, some internetworking devices might forward DTP frames improperly, which could cause misconfigurations.
To avoid this, you should configure interfaces connected to devices that do not support DTP to not forward DTP frames, that is, to turn off DTP.
If you do not intend to trunk across those links, use the switchport mode access interface configuration command to disable trunking.
To enable trunking to a device that does not support DTP, use the switchport mode trunk and switchport nonegotiate interface configuration commands to cause the interface to become a trunk but to not generate DTP frames. Use theswitchport trunk encapsulation dot1q interface to select the encapsulation type on the trunk port.
You can also specify on DTP interfaces whether the trunk uses IEEE 802.1Q encapsulation or if the encapsulation type is autonegotiated. The DTP supports autonegotiation of IEEE 802.1Q trunks.
Mode |
Function |
||
---|---|---|---|
switchport mode access |
Puts the interface (access port) into permanent nontrunking mode and negotiates to convert the link into a nontrunk link. The interface becomes a nontrunk interface regardless of whether or not the neighboring interface is a trunk interface. |
||
switchport mode dynamic auto |
Makes the interface able to convert the link to a trunk link. The interface becomes a trunk interface if the neighboring interface is set to trunk or desirable mode. The default switchport mode for all Ethernet interfaces is dynamic auto. |
||
switchport mode dynamic desirable |
Makes the interface actively attempt to convert the link to a trunk link. The interface becomes a trunk interface if the neighboring interface is set to trunk, desirable, or auto mode. |
||
switchport mode trunk |
Puts the interface into permanent trunking mode and negotiates to convert the neighboring link into a trunk link. The interface becomes a trunk interface even if the neighboring interface is not a trunk interface. |
||
switchport nonegotiate |
Prevents the interface from generating DTP frames. You can use this command only when the interface switchport mode is access or trunk. You must manually configure the neighboring interface as a trunk interface to establish a trunk link. |
||
switchport mode dot1q-tunnel |
Configures the interface as a tunnel (nontrunking) port to be connected in an asymmetric link with an IEEE 802.1Q trunk port. The IEEE 802.1Q tunneling is used to maintain customer VLAN integrity across a service provider network. |
||
switchport mode private-vlan |
Configures the private VLAN mode.
|
By default, a trunk port sends traffic to and receives traffic from all VLANs. All VLAN IDs, 1 to 4094, are allowed on each trunk. However, you can remove VLANs from the allowed list, preventing traffic from those VLANs from passing over the trunk.
To reduce the risk of spanning-tree loops or storms, you can disable VLAN 1 on any individual VLAN trunk port by removing VLAN 1 from the allowed list. When you remove VLAN 1 from a trunk port, the interface continues to send and receive management traffic, for example, Cisco Discovery Protocol (CDP), Port Aggregation Protocol (PAgP), Link Aggregation Control Protocol (LACP), DTP, and VTP in VLAN 1.
If a trunk port with VLAN 1 disabled is converted to a nontrunk port, it is added to the access VLAN. If the access VLAN is set to 1, the port will be added to VLAN 1, regardless of the switchport trunk allowed setting. The same is true for any VLAN that has been disabled on the port.
A trunk port can become a member of a VLAN if the VLAN is enabled, if VTP knows of the VLAN, and if the VLAN is in the allowed list for the port. When VTP detects a newly enabled VLAN and the VLAN is in the allowed list for a trunk port, the trunk port automatically becomes a member of the enabled VLAN. When VTP detects a new VLAN and the VLAN is not in the allowed list for a trunk port, the trunk port does not become a member of the new VLAN.
Load sharing divides the bandwidth supplied by parallel trunks connecting switches. To avoid loops, STP normally blocks all but one parallel link between switches. Using load sharing, you divide the traffic between the links according to which VLAN the traffic belongs.
You configure load sharing on trunk ports by using STP port priorities or STP path costs. For load sharing using STP port priorities, both load-sharing links must be connected to the same switch. For load sharing using STP path costs, each load-sharing link can be connected to the same switch or to two different switches.
When two ports on the same switch form a loop, the switch uses the STP port priority to decide which port is enabled and which port is in a blocking state. You can set the priorities on a parallel trunk port so that the port carries all the traffic for a given VLAN. The trunk port with the higher priority (lower values) for a VLAN is forwarding traffic for that VLAN. The trunk port with the lower priority (higher values) for the same VLAN remains in a blocking state for that VLAN. One trunk port sends or receives all traffic for the VLAN.
This figure shows two trunks connecting supported switches.
Trunk 1 carries traffic for VLANs 8 through 10, and Trunk 2 carries traffic for VLANs 3 through 6. If the active trunk fails, the trunk with the lower priority takes over and carries the traffic for all of the VLANs. No duplication of traffic occurs over any trunk port.
You can configure parallel trunks to share VLAN traffic by setting different path costs on a trunk and associating the path costs with different sets of VLANs, blocking different ports for different VLANs. The VLANs keep the traffic separate and maintain redundancy in the event of a lost link.
Trunking interacts with other features in these ways:
A trunk port cannot be a secure port.
A trunk port cannot be a tunnel port.
We recommend that you configure no more than 24 trunk ports in Per VLAN Spanning Tree (PVST) mode and no more than 40 trunk ports in Multiple Spanning Tree (MST) mode.
If you try to enable IEEE 802.1x on a trunk port, an error message appears, and IEEE 802.1x is not enabled. If you try to change the mode of an IEEE 802.1x-enabled port to trunk, the port mode is not changed.
A port in dynamic mode can negotiate with its neighbor to become a trunk port. If you try to enable IEEE 802.1x on a dynamic port, an error message appears, and IEEE 802.1x is not enabled. If you try to change the mode of an IEEE 802.1x-enabled port to dynamic, the port mode is not changed.
Feature |
Default Setting |
---|---|
Interface mode |
switchport mode dynamic auto |
Trunk encapsulation |
switchport trunk encapsulation negotiate |
Allowed VLAN range |
VLANs 1 to 4094 |
VLAN range eligible for pruning |
VLANs 2 to 1001 |
Default VLAN (for access ports) |
VLAN 1 |
Native VLAN (for IEEE 802.1Q trunks) |
VLAN 1 |
To avoid trunking misconfigurations, configure interfaces connected to devices that do not support DTP to not forward DTP frames, that is, to turn off DTP.
If you do not intend to trunk across those links, use the switchport mode access interface configuration command to disable trunking.
To enable trunking to a device that does not support DTP, use the switchport mode trunk and switchport nonegotiate interface configuration commands to cause the interface to become a trunk but to not generate DTP frames.
Because trunk ports send and receive VTP advertisements, to use VTP you must ensure that at least one trunk port is configured on the switch and that this trunk port is connected to the trunk port of a second switch. Otherwise, the switch cannot receive any VTP advertisements.
2. interface interface-id
3. switchport mode {dynamic {auto | desirable} | trunk}
4. switchport access vlan vlan-id
5. switchport trunk native vlan vlan-id
7. show interfaces interface-id switchport
8. show interfaces interface-id trunk
9. copy running-config startup-config
コマンドまたはアクション | 目的 | |||
---|---|---|---|---|
ステップ 1 |
configure terminal 例: Switch# configure terminal |
|||
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/2
|
Specifies the port to be configured for trunking, and enters interface configuration mode. |
||
ステップ 3 | switchport mode {dynamic {auto | desirable} | trunk} 例:
Switch(config-if)# switchport mode dynamic desirable
|
Configures the interface as a Layer 2 trunk (required only if the interface is a Layer 2 access port or tunnel port or to specify the trunking mode).
|
||
ステップ 4 | switchport access vlan vlan-id 例:
Switch(config-if)# switchport access vlan 200
|
(Optional) Specifies the default VLAN, which is used if the interface stops trunking. |
||
ステップ 5 | switchport trunk native vlan vlan-id 例:
Switch(config-if)# switchport trunk native vlan 200
|
Specifies the native VLAN for IEEE 802.1Q trunks. |
||
ステップ 6 |
end 例: Switch(config)# end |
|||
ステップ 7 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet1/0/2 switchport
|
Displays the switch port configuration of the interface in the Administrative Mode and the Administrative Trunking Encapsulation fields of the display. |
||
ステップ 8 | show interfaces interface-id trunk 例:
Switch# show interfaces gigabitethernet1/0/2 trunk
|
Displays the trunk configuration of the interface. |
||
ステップ 9 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file.
|
VLAN 1 is the default VLAN on all trunk ports in all Cisco switches, and it has previously been a requirement that VLAN 1 always be enabled on every trunk link. You can use the VLAN 1 minimization feature to disable VLAN 1 on any individual VLAN trunk link so that no user traffic (including spanning-tree advertisements) is sent or received on VLAN 1.
2. interface interface-id
3. switchport mode trunk
4. switchport trunk allowed vlan {add | all | except | none | remove} vlan-list
6. show interfaces interface-id switchport
7. copy running-config startup-config
コマンドまたはアクション | 目的 | |||
---|---|---|---|---|
ステップ 1 |
configure terminal 例: Switch# configure terminal |
|||
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Specifies the port to be configured, and enters interface configuration mode. |
||
ステップ 3 | switchport mode trunk 例:
Switch(config-if)# switchport mode trunk
|
Configures the interface as a VLAN trunk port. |
||
ステップ 4 | switchport trunk allowed vlan {add | all | except | none | remove} vlan-list 例:
Switch(config-if)# switchport trunk allowed vlan remove 2
|
(Optional) Configures the list of VLANs allowed on the trunk. The vlan-list parameter is either a single VLAN number from 1 to 4094 or a range of VLANs described by two VLAN numbers, the lower one first, separated by a hyphen. Do not enter any spaces between comma-separated VLAN parameters or in hyphen-specified ranges. All VLANs are allowed by default. |
||
ステップ 5 |
end 例: Switch(config)# end |
|||
ステップ 6 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet1/0/1
|
Verifies your entries in the Trunking VLANs Enabled field of the display. |
||
ステップ 7 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file.
|
The pruning-eligible list applies only to trunk ports. Each trunk port has its own eligibility list. VTP pruning must be enabled for this procedure to take effect.
2. interface interface-id
3. switchport trunk pruning vlan {add | except | none | remove} vlan-list [,vlan [,vlan [,,,]]
5. show interfaces interface-id switchport
6. copy running-config startup-config
コマンドまたはアクション | 目的 | |||
---|---|---|---|---|
ステップ 1 |
configure terminal 例: Switch# configure terminal |
|||
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet2/0/1
|
Selects the trunk port for which VLANs should be pruned, and enters interface configuration mode. |
||
ステップ 3 | switchport trunk pruning vlan {add | except | none | remove} vlan-list [,vlan [,vlan [,,,]] |
Configures the list of VLANs allowed to be pruned from the trunk. For explanations about using the add, except, none, and remove keywords, see the command reference for this release. Separate non-consecutive VLAN IDs with a comma and no spaces; use a hyphen to designate a range of IDs. Valid IDs are 2 to 1001. Extended-range VLANs (VLAN IDs 1006 to 4094) cannot be pruned. VLANs that are pruning-ineligible receive flooded traffic. The default list of VLANs allowed to be pruned contains VLANs 2 to 1001.
|
||
ステップ 4 |
end 例: Switch(config)# end |
|||
ステップ 5 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet2/0/1 switchport
|
Verifies your entries in the Pruning VLANs Enabled field of the display. |
||
ステップ 6 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
A trunk port configured with IEEE 802.1Q tagging can receive both tagged and untagged traffic. By default, the switch forwards untagged traffic in the native VLAN configured for the port. The native VLAN is VLAN 1 by default.
The native VLAN can be assigned any VLAN ID.
If a packet has a VLAN ID that is the same as the outgoing port native VLAN ID, the packet is sent untagged; otherwise, the switch sends the packet with a tag.
2. interface interface-id
3. switchport trunk native vlan vlan-id
4. end
5. show interfaces interface-id switchport
6. copy running-config startup-config
コマンドまたはアクション | 目的 | |
---|---|---|
ステップ 1 |
configure terminal 例: Switch# configure terminal |
|
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/2
|
Defines the interface that is configured as the IEEE 802.1Q trunk, and enters interface configuration mode. |
ステップ 3 | switchport trunk native vlan vlan-id 例:
Switch(config-if)# switchport trunk native vlan 12
|
Configures the VLAN that is sending and receiving untagged traffic on the trunk port. For vlan-id, the range is 1 to 4094. |
ステップ 4 | end 例:
Switch(config-if)# end
|
Returns to privileged EXEC mode. |
ステップ 5 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet1/0/2 switchport
|
Verifies your entries in the Trunking Native Mode VLAN field. |
ステップ 6 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
If your switch is a member of a switch stack, you must use the spanning-tree [vlan vlan-id] cost cost interface configuration command instead of the spanning-tree [vlan vlan-id] port-priority priority interface configuration command to select an interface to put in the forwarding state. Assign lower cost values to interfaces that you want selected first and higher cost values that you want selected last.
These steps describe how to configure a network with load sharing using STP port priorities.
1. configure terminal
2. vtp domain domain-name
3. vtp mode server
5. show vtp status
6. show vlan
7. configure terminal
8. interface interface-id
9. switchport mode trunk
10. end
11. show interfaces interface-id switchport
12. Repeat the above steps on Switch A for a second port in the switch or switch stack.
13. Repeat the above steps on Switch B to configure the trunk ports that connect to the trunk ports configured on Switch A.
14. show vlan
15. configure terminal
16. interface interface-id
17. spanning-tree vlan vlan-range port-priority priority-value
18. exit
19. interface interface-id
20. spanning-tree vlan vlan-range port-priority priority-value
21. end
22. show running-config
23. copy running-config startup-config
コマンドまたはアクション | 目的 | |
---|---|---|
ステップ 1 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode on Switch A. |
ステップ 2 | vtp domain domain-name 例:
Switch(config)# vtp domain workdomain
|
Configures a VTP administrative domain. The domain name can be 1 to 32 characters. |
ステップ 3 | vtp mode server 例:
Switch(config)# vtp mode server
|
Configures Switch A as the VTP server. |
ステップ 4 |
end 例: Switch(config)# end |
|
ステップ 5 | show vtp status 例:
Switch# show vtp status
|
Verifies the VTP configuration on both Switch A and Switch B. In the display, check the VTP Operating Mode and the VTP Domain Name fields. |
ステップ 6 | show vlan 例:
Switch# show vlan
|
Verifies that the VLANs exist in the database on Switch A. |
ステップ 7 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode. |
ステップ 8 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface to be configured as a trunk, and enters interface configuration mode. |
ステップ 9 | switchport mode trunk 例:
Switch(config-if)# switchport mode trunk
|
Configures the port as a trunk port. |
ステップ 10 | end 例:
Switch(config-if)# end
|
Returns to privileged EXEC mode. |
ステップ 11 | show interfaces interface-id switchport 例:
Switch# show interfaces gigabitethernet1/0/1
|
Verifies the VLAN configuration. |
ステップ 12 | Repeat the above steps on Switch A for a second port in the switch or switch stack. | |
ステップ 13 | Repeat the above steps on Switch B to configure the trunk ports that connect to the trunk ports configured on Switch A. | |
ステップ 14 | show vlan 例:
Switch# show vlan
|
When the trunk links come up, VTP passes the VTP and VLAN information to Switch B. This command verifies that Switch B has learned the VLAN configuration. |
ステップ 15 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode on Switch A. |
ステップ 16 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface to set the STP port priority, and enters interface configuration mode. |
ステップ 17 | spanning-tree vlan vlan-range port-priority priority-value 例:
Switch(config-if)# spanning-tree vlan 8-10 port-priority 16
|
Assigns the port priority for the VLAN range specified. Enter a port priority value from 0 to 240. Port priority values increment by 16. |
ステップ 18 | exit 例:
Switch(config-if)# exit
|
Returns to global configuration mode. |
ステップ 19 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/2
|
Defines the interface to set the STP port priority, and enters interface configuration mode. |
ステップ 20 | spanning-tree vlan vlan-range port-priority priority-value 例:
Switch(config-if)# spanning-tree vlan 3-6 port-priority 16
|
Assigns the port priority for the VLAN range specified. Enter a port priority value from 0 to 240. Port priority values increment by 16. |
ステップ 21 | end 例:
Switch(config-if)# end
|
Returns to privileged EXEC mode. |
ステップ 22 | show running-config 例:
Switch# show running-config
|
Verifies your entries. |
ステップ 23 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
1. configure terminal
2. interface interface-id
3. switchport mode trunk
4. exit
5. Repeat Steps 2 through 4 on a second interface in Switch A or in Switch A stack.
7. show running-config
8. show vlan
9. configure terminal
10. interface interface-id
11. spanning-tree vlan vlan-range cost cost-value
12. end
13. Repeat Steps 9 through 13 on the other configured trunk interface on Switch A, and set the spanning-tree path cost to 30 for VLANs 8, 9, and 10.
14. exit
15. show running-config
16. copy running-config startup-config
コマンドまたはアクション | 目的 | |
---|---|---|
ステップ 1 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode on Switch A. |
ステップ 2 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface to be configured as a trunk, and enters interface configuration mode. |
ステップ 3 | switchport mode trunk 例:
Switch(config-if)# switchport mode trunk
|
Configures the port as a trunk port. |
ステップ 4 | exit 例:
Switch(config-if)# exit
|
Returns to global configuration mode. |
ステップ 5 | Repeat Steps 2 through 4 on a second interface in Switch A or in Switch A stack. | |
ステップ 6 |
end 例: Switch(config)# end |
|
ステップ 7 | show running-config 例:
Switch# show running-config
|
Verifies your entries. In the display, make sure that the interfaces are configured as trunk ports. |
ステップ 8 | show vlan 例:
Switch# show vlan
|
When the trunk links come up, Switch A receives the VTP information from the other switches. This command verifies that Switch A has learned the VLAN configuration. |
ステップ 9 | configure terminal 例:
Switch# configure terminal
|
Enters global configuration mode. |
ステップ 10 | interface interface-id 例:
Switch(config)# interface gigabitethernet1/0/1
|
Defines the interface on which to set the STP cost, and enters interface configuration mode. |
ステップ 11 | spanning-tree vlan vlan-range cost cost-value 例:
Switch(config-if)# spanning-tree vlan 2-4 cost 30
|
Sets the spanning-tree path cost to 30 for VLANs 2 through 4. |
ステップ 12 | end 例:
Switch(config-if)# end
|
Returns to global configuration mode. |
ステップ 13 | Repeat Steps 9 through 13 on the other configured trunk interface on Switch A, and set the spanning-tree path cost to 30 for VLANs 8, 9, and 10. | |
ステップ 14 | exit 例:
Switch(config)# exit
|
Returns to privileged EXEC mode. |
ステップ 15 | show running-config 例:
Switch# show running-config
|
Verifies your entries. In the display, verify that the path costs are set correctly for both trunk interfaces. |
ステップ 16 | copy running-config startup-config 例:
Switch# copy running-config startup-config
|
(Optional) Saves your entries in the configuration file. |
This example shows how to configure a port as an IEEE 802.1Q trunk. The example assumes that the neighbor interface is configured to support IEEE 802.1Q trunking.
Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface gigabitethernet0/2 Switch(config-if)# switchport mode dynamic desirable Switch(config-if)# switchport trunk encapsulation dot1q Switch(config-if)# end
Description | Link |
---|---|
The Cisco Support website provides extensive online resources, including documentation and tools for troubleshooting and resolving technical issues with Cisco products and technologies. To receive security and technical information about your products, you can subscribe to various services, such as the Product Alert Tool (accessed from Field Notices), the Cisco Technical Services Newsletter, and Really Simple Syndication (RSS) Feeds. Access to most tools on the Cisco Support website requires a Cisco.com user ID and password. |