configuring_vlan_trunks
configuring_vlan_trunks
General Restrictions
• Native VLAN tagging is not supported, and the vlan dot1q tag native command is not available.
Note You can configure a trunk on a single Ethernet interface or on an EtherChannel bundle.
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.
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 Makes the interface able to convert the link to a trunk link. The interface
auto 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 Makes the interface actively attempt to convert the link to a trunk link. The
desirable 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.
Mode Function
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.
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 switch 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.
• 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.
Procedure
Device> enable
Step 4 switchport mode {dynamic {auto | Configures the interface as a Layer 2 trunk
desirable} | trunk} (required only if the interface is a Layer 2
access port or tunnel port or to specify the
Example:
trunking mode).
Device(config-if)# switchport mode • dynamic auto: Sets the interface to a
dynamic desirable trunk link if the neighboring interface is
set to trunk or desirable mode. This is the
default.
Step 5 switchport access vlan vlan-id (Optional) Specifies the default VLAN, which
is used if the interface stops trunking.
Example:
Step 6 switchport trunk native vlan vlan-id Specifies the native VLAN for IEEE 802.1Q
trunks.
Example:
Device(config)# end
Step 8 show interfaces interface-id switchport Displays the switch port configuration of the
interface in the Administrative Mode and the
Example:
Administrative Trunking Encapsulation fields
Device# show interfaces gigabitethernet of the display.
1/0/2 switchport
Or
Device# show interfaces fastethernet
1/0/2 switchport
Step 9 show interfaces interface-id trunk Displays the trunk configuration of the
interface.
Example:
Device# show interfaces gigabitethernet
1/0/2 trunk
Or
Device# show interfaces fastethernet
1/0/2 trunk
Procedure
Device> enable
Step 4 switchport mode trunk Configures the interface as a VLAN trunk port.
Example:
Device(config)# end
Procedure
Device> enable
Step 3 interface interface-id Selects the trunk port for which VLANs should
be pruned, and enters interface configuration
Example:
mode.
Device(config)# interface gigabitethernet
1/0/1-48
Or
Device(config)# interface fastethernet
1/0/1-48
Step 4 switchport trunk pruning vlan {add | except Configures the list of VLANs allowed to be
| none | remove} vlan-list [,vlan [,vlan [,,,]] pruned from the trunk.
Device(config)# end
Step 6 show interfaces interface-id switchport Verifies your entries in the Pruning VLANs
Enabled field of the display.
Example:
Device# show interfaces gigabitethernet
1/0/2 switchport
Or
Device# show interfaces fastethernet
1/0/2 switchport
Procedure
Device> enable
Step 4 switchport trunk native vlan vlan-id Configures the VLAN that is sending and
receiving untagged traffic on the trunk port.
Example:
For vlan-id, the range is 1 to 4094.
Device(config-if)# switchport trunk
native vlan 12
Device(config)# end
Step 6 show interfaces interface-id switchport Verifies your entries in the Trunking Native
Mode VLAN field.
Example:
Device# show interfaces gigabitethernet
1/0/2 switchport
Or
Device# show interfaces fastethernet
1/0/2 switchport
Procedure
Device> enable
Device(config)# end
Step 6 show vtp status Verifies the VTP configuration on both Switch
A and Switch B.
Example:
In the display, check the VTP Operating Mode
Device# show vtp status and the VTP Domain Name fields.
Step 7 show vlan Verifies that the VLANs exist in the database
on Switch A.
Example:
Device(config)# end
Step 17 interface interface-id Defines the interface to set the STP port
priority, and enters interface configuration
Example:
mode.
Device(config)# interface
gigabitethernet 1/0/1
Or
Device(config)# interface fastethernet
1/0/1
Step 18 spanning-tree vlan vlan-range port-priority Assigns the port priority for the VLAN range
priority-value specified. Enter a port priority value from 0 to
240. Port priority values increment by 16.
Example:
Device(config-if)# exit
Step 20 interface interface-id Defines the interface to set the STP port
priority, and enters interface configuration
Example:
mode.
Device(config)# interface
gigabitethernet 1/0/2
Or
Device(config)# interface fastethernet
1/0/2
Step 21 spanning-tree vlan vlan-range port-priority Assigns the port priority for the VLAN range
priority-value specified. Enter a port priority value from 0 to
240. Port priority values increment by 16.
Example:
Device(config)# end
Procedure
Device> enable
Device(config-if)# exit
Device(config)# end
Step 8 show running-config Verifies your entries. In the display, make sure
that the interfaces are configured as trunk
Example:
ports.
Device# show running-config
Step 9 show vlan When the trunk links come up, Switch A
receives the VTP information from the other
Example:
switches. This command verifies that Switch
A has learned the VLAN configuration.
Device# show vlan
Step 11 interface interface-id Defines the interface on which to set the STP
cost, and enters interface configuration mode.
Example:
Device(config)# interface
gigabitethernet 1/0/1
Or
Device(config)# interface fastethernet
1/0/1
Step 12 spanning-tree vlan vlan-range cost cost-value Sets the spanning-tree path cost to 30 for
VLANs 2 through 4.
Example:
Device(config-if)# end
Device(config)# exit
Step 16 show running-config Verifies your entries. In the display, verify that
the path costs are set correctly for both trunk
Example:
interfaces.
Device# show running-config
Cisco IOS Release 15.2(7)E1 VLAN Trunks 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.
Use Cisco Feature Navigator to find information about platform and software image support. To access Cisco
Feature Navigator, go to http://www.cisco.com/go/cfn.