Published On: June 15ᵗʰ, 2020 07:17

VLAN Configuration Guide, Cisco IOS XE Amsterdam 17.1.x (Catalyst 9500 Switches)

Prerequisites for VLAN Trunks

The IEEE 802.1Q trunks impose these limitations on the trunking strategy for a network:

  • In a network of Cisco devices connected through IEEE 802.1Q trunks, the devices 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 device to a non-Cisco device through an IEEE 802.1Q trunk, the Cisco device combines the spanning-tree instance of the VLAN of the trunk with the spanning-tree instance of the non-Cisco IEEE 802.1Q device. However, spanning-tree information for each VLAN is maintained by Cisco devices separated by a cloud of non-Cisco IEEE 802.1Q devices. The non-Cisco IEEE 802.1Q cloud separating the Cisco device is treated as a single trunk link between the devices.

  • 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.

Restrictions for VLAN Trunks

The following are restrictions for VLAN trunks:

  • A trunk port cannot be a secure port.

  • Trunk ports can be grouped into EtherChannel port groups, but all trunks in the group must have the same configuration. When a group is first created, all ports follow the parameters set for the first port to be added to the group. If you change the configuration of one of these parameters, the device propagates the setting that you entered to all ports in the group:

    • Allowed-VLAN list.

    • STP port priority for each VLAN.

    • STP Port Fast setting.

    • Trunk status:

      If one port in a port group ceases to be a trunk, all ports cease to be trunks.

  • 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.

  • Dynamic Trunking Protocol (DTP) is not supported on tunnel ports.

  • The device does not support Layer 3 trunks; you cannot configure subinterfaces or use the encapsulation keyword on Layer 3 interfaces. The device does support Layer 2 trunks and Layer 3 VLAN interfaces, which provide equivalent capabilities.

    Because subinterfaces are not supported on Cisco Catalyst 9500 Series Switches, these cannot be used as an Application Centric Infrastructure (ACI) Interpod Network (IPN) device. You also cannot use a switch virtual interface (SVI) because Interpod spine switches reuse the same MAC address; which causes flapping of MAC address in the IPN Layer 2 network.

Information About VLAN Trunks

The following sections provide information about VLAN Trunks:

Trunking Overview

A trunk is a point-to-point link between one or more Ethernet interfaces and another networking device such as a router or a controller. Ethernet trunks carry the traffic of multiple VLANs over a single link, and you can extend the VLANs across an entire network.

IEEE 802.1Q— Industry-standard trunking encapsulation is available on all Ethernet interfaces.

Trunking Modes

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.

Layer 2 Interface Modes

Table 1. Layer 2 Interface Modes

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 private-vlan

Configures the private VLAN mode.

Allowed VLANs on a Trunk

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 on Trunk Ports

Load sharing divides the bandwidth supplied by parallel trunks connecting devices. To avoid loops, STP normally blocks all but one parallel link between the devices. 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 device. For load sharing using STP path costs, each load-sharing link can be connected to the same device or to two different devices.

Network Load Sharing Using STP Priorities

When two ports on the same device form a loop, the device 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.

Network Load Sharing Using STP Path Cost

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.

Feature Interactions

Trunking interacts with other features in these ways:

  • A trunk port cannot be a secure port.

  • Trunk ports can be grouped into EtherChannel port groups, but all trunks in the group must have the same configuration. When a group is first created, all ports follow the parameters set for the first port to be added to the group. If you change the configuration of one of these parameters, the device propagates the setting that you entered to all ports in the group:

    • Allowed-VLAN list.

    • STP port priority for each VLAN.

    • STP Port Fast setting.

    • Trunk status:

      If one port in a port group ceases to be a trunk, all ports cease to be trunks.

  • 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.

How to Configure VLAN Trunks

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.

Configuring an Ethernet Interface as a Trunk Port

This section provides information about configuring an Ethernet Interface as a trunk port:

Configuring a Trunk Port

Because trunk ports send and receive VTP advertisements, to use VTP you must ensure that at least one trunk port is configured on the device and that this trunk port is connected to the trunk port of a second device. Otherwise, the device cannot receive any VTP advertisements.

Before you begin

By default, an interface is in Layer 2 mode. The default mode for Layer 2 interfaces is switchport mode dynamic auto . If the neighboring interface supports trunking and is configured to allow trunking, the link is a Layer 2 trunk or, if the interface is in Layer 3 mode, it becomes a Layer 2 trunk when you enter the switchport interface configuration command.

Procedure
  Command or Action Purpose
Step 1

enable

Example:

Device> enable


Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal


Enters global configuration mode.

Step 3

interface interface-id

Example:

Device(config)# interface gigabitethernet 1/0/2


Specifies the port to be configured for trunking, and enters interface configuration mode.

Step 4

switchport mode {dynamic {auto | desirable} | trunk}

Example:

Device(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).

  • dynamic auto —Sets the interface to a trunk link if the neighboring interface is set to trunk or desirable mode. This is the default.

  • dynamic desirable —Sets the interface to a trunk link if the neighboring interface is set to trunk, desirable, or auto mode.

  • trunk —Sets the interface in permanent trunking mode and negotiate to convert the link to a trunk link even if the neighboring interface is not a trunk interface.

Step 5

switchport access vlan vlan-id

Example:

Device(config-if)# switchport access vlan 200


(Optional) Specifies the default VLAN, which is used if the interface stops trunking.

Step 6

switchport trunk native vlan vlan-id

Example:

Device(config-if)# switchport trunk native vlan 200


Specifies the native VLAN for IEEE 802.1Q trunks.

Step 7

end

Example:

Device(config)# end


Returns to privileged EXEC mode.

Step 8

show interfaces interface-id switchport

Example:

Device# show interfaces gigabitethernet 1/0/2 switchport


Displays the switch port configuration of the interface in the Administrative Mode and the Administrative Trunking Encapsulation fields of the display.

Step 9

show interfaces interface-id trunk

Example:

Device# show interfaces gigabitethernet 1/0/2 trunk


Displays the trunk configuration of the interface.

Step 10

copy running-config startup-config

Example:

Device# copy running-config startup-config


(Optional) Saves your entries in the configuration file.

Defining the Allowed VLANs on a Trunk

VLAN 1 is the default VLAN on all trunk ports in all Cisco devices, 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.

Procedure
  Command or Action Purpose
Step 1

enable

Example:

Device> enable


Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal


Enters global configuration mode.

Step 3

interface interface-id

Example:

Device(config)# interface gigabitethernet 1/0/1


Specifies the port to be configured, and enters interface configuration mode.

Step 4

switchport mode trunk

Example:

Device(config-if)# switchport mode trunk


Configures the interface as a VLAN trunk port.

Step 5

switchport trunk allowed vlan { word | add | all | except | none | remove} vlan-list

Example:

Device(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.

Step 6

end

Example:

Device(config)# end


Returns to privileged EXEC mode.

Step 7

show interfaces interface-id switchport

Example:

Device# show interfaces gigabitethernet 1/0/1 switchport


Verifies your entries in the Trunking VLANs Enabled field of the display.

Step 8

copy running-config startup-config

Example:

Device# copy running-config startup-config


(Optional) Saves your entries in the configuration file.

Changing the Pruning-Eligible List

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.

Procedure
  Command or Action Purpose
Step 1

enable

Example:

Device> enable


Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal


Enters global configuration mode.

Step 3

interface interface-id

Example:

Device(config)# interface gigabitethernet0/1


Selects the trunk port for which VLANs should be pruned, and enters interface configuration mode.

Step 4

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.

Step 5

end

Example:

Device(config)# end


Returns to privileged EXEC mode.

Step 6

show interfaces interface-id switchport

Example:

Device# show interfaces gigabitethernet 1/0/1 switchport


Verifies your entries in the Pruning VLANs Enabled field of the display.

Step 7

copy running-config startup-config

Example:

Device# copy running-config startup-config


(Optional) Saves your entries in the configuration file.

Configuring the Native VLAN for Untagged Traffic

A trunk port configured with IEEE 802.1Q tagging can receive both tagged and untagged traffic. By default, the device 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 device sends the packet with a tag.

Procedure
  Command or Action Purpose
Step 1

enable

Example:

Device> enable


Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal


Enters global configuration mode.

Step 3

interface interface-id

Example:

Device(config)# interface gigabitethernet 1/0/2


Defines the interface that is configured as the IEEE 802.1Q trunk, and enters interface configuration mode.

Step 4

switchport trunk native vlan vlan-id

Example:

Device(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.

Step 5

end

Example:

Device(config-if)# end


Returns to privileged EXEC mode.

Step 6

show interfaces interface-id switchport

Example:

Device# show interfaces gigabitethernet 1/0/2 switchport


Verifies your entries in the Trunking Native Mode VLAN field.

Step 7

copy running-config startup-config

Example:

Device# copy running-config startup-config


(Optional) Saves your entries in the configuration file.

Configuring Trunk Ports for Load Sharing

The following sections provide information about configuring trunk ports for load sharing:

Configuring Load Sharing Using STP Port Priorities

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.

Procedure
  Command or Action Purpose
Step 1

enable

Example:

Device> enable


Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal


Enters global configuration mode on Device A.

Step 3

vtp domain domain-name

Example:

Device(config)# vtp domain workdomain


Configures a VTP administrative domain.

The domain name can be 1 to 32 characters.

Step 4

vtp mode server

Example:

Device(config)# vtp mode server


Configures Device A as the VTP server.

Step 5

end

Example:

Device(config)# end


Returns to privileged EXEC mode.

Step 6

show vtp status

Example:

Device# show vtp status


Verifies the VTP configuration on both Device A and Device B.

In the display, check the VTP Operating Mode and the VTP Domain Name fields.

Step 7

show vlan

Example:

Device# show vlan


Verifies that the VLANs exist in the database on Device A.

Step 8

configure terminal

Example:

Device# configure terminal


Enters global configuration mode.

Step 9

interface interface-id

Example:

Device(config)# interface gigabitethernet1/0/1


Defines the interface to be configured as a trunk, and enters interface configuration mode.

Step 10

switchport mode trunk

Example:

Device(config-if)# switchport mode trunk


Configures the port as a trunk port.

Step 11

end

Example:

Device(config-if)# end


Returns to privileged EXEC mode.

Step 12

show interfaces interface-id switchport

Example:

Device# show interfaces gigabitethernet 1/0/1 switchport


Verifies the VLAN configuration.

Step 13

Repeat the above steps on Device A for a second port in the device.

Step 14

Repeat the above steps on Device B to configure the trunk ports that connect to the trunk ports configured on Device A.

Step 15

show vlan

Example:

Device# show vlan


When the trunk links come up, VTP passes the VTP and VLAN information to Device B. This command verifies that Device B has learned the VLAN configuration.

Step 16

configure terminal

Example:

Device# configure terminal


Enters global configuration mode on Device A.

Step 17

interface interface-id

Example:

Device(config)# interface gigabitethernet 1/0/1


Defines the interface to set the STP port priority, and enters interface configuration mode.

Step 18

spanning-tree vlan vlan-range port-priority priority-value

Example:

Device(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.

Step 19

exit

Example:

Device(config-if)# exit


Returns to global configuration mode.

Step 20

interface interface-id

Example:

Device(config)# interface gigabitethernet 1/0/2


Defines the interface to set the STP port priority, and enters interface configuration mode.

Step 21

spanning-tree vlan vlan-range port-priority priority-value

Example:

Device(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.

Step 22

end

Example:

Device(config-if)# end


Returns to privileged EXEC mode.

Step 23

show running-config

Example:

Device# show running-config


Verifies your entries.

Step 24

copy running-config startup-config

Example:

Device# copy running-config startup-config


(Optional) Saves your entries in the configuration file.

Configuring Load Sharing Using STP Path Cost

These steps describe how to configure a network with load sharing using STP path costs.

Procedure
  Command or Action Purpose
Step 1

enable

Example:

Device> enable


Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal


Enters global configuration mode on Device A.

Step 3

interface interface-id

Example:

Device(config)# interface gigabitethernet 1/0/1


Defines the interface to be configured as a trunk, and enters interface configuration mode.

Step 4

switchport mode trunk

Example:

Device(config-if)# switchport mode trunk


Configures the port as a trunk port.

Step 5

exit

Example:

Device(config-if)# exit


Returns to global configuration mode.

Step 6

Repeat Steps 2 through 4 on a second interface in Device A or in Device A stack.

Step 7

end

Example:

Device(config)# end


Returns to privileged EXEC mode.

Step 8

show running-config

Example:

Device# show running-config


Verifies your entries. In the display, make sure that the interfaces are configured as trunk ports.

Step 9

show vlan

Example:

Device# show vlan


When the trunk links come up, Device A receives the VTP information from the other devices. This command verifies that Device A has learned the VLAN configuration.

Step 10

configure terminal

Example:

Device# configure terminal


Enters global configuration mode.

Step 11

interface interface-id

Example:

Device(config)# interface gigabitethernet 1/0/1


Defines the interface on which to set the STP cost, and enters interface configuration mode.

Step 12

spanning-tree vlan vlan-range cost cost-value

Example:

Device(config-if)# spanning-tree vlan 2-4 cost 30


Sets the spanning-tree path cost to 30 for VLANs 2 through 4.

Step 13

end

Example:

Device(config-if)# end


Returns to global configuration mode.

Step 14

Repeat Steps 9 through 13 on the other configured trunk interface on Device A, and set the spanning-tree path cost to 30 for VLANs 8, 9, and 10.

Step 15

exit

Example:

Device(config)# exit


Returns to privileged EXEC mode.

Step 16

show running-config

Example:

Device# show running-config


Verifies your entries. In the display, verify that the path costs are set correctly for both trunk interfaces.

Step 17

copy running-config startup-config

Example:

Device# copy running-config startup-config


(Optional) Saves your entries in the configuration file.

Where to Go Next

After configuring VLAN trunks, you can configure the following:

  • VLANs

  • Voice VLANs

  • Private VLANs

Additional References

Related Documents

Related Topic Document Title

For complete syntax and usage information for the commands used in this chapter.

Command Reference (Catalyst 9500 Series Switches)

Standards and RFCs

Standard/RFC Title

RFC 1573

Evolution of the Interfaces Group of MIB-II

RFC 1757

Remote Network Monitoring Management

RFC 2021

SNMPv2 Management Information Base for the Transmission Control Protocol using SMIv2

Feature History and Information for VLAN Trunks

Release

Modification

Cisco IOS XE Everest 16.5.1a

This command was introduced.