PacketLab
Switching · VLANs and Trunking

Trunk configuration

Carry exactly the intended VLANs over one inter-switch link.

Independent lab examples; selected output and frame summaries are illustrative. Port naming and command support vary by switch and software release.

Network and objective

Use 802.1Q-only-capable lab switches. Older models supporting multiple encapsulations may require an additional encapsulation command.

Use two fresh lab switches: H1 on SW1 Gi1/0/1, H2 on SW2 Gi1/0/1, and Gi1/0/24 between the switches. No other production links are connected. H1 and H2 belong to VLAN 10; a second host pair can use VLAN 20.

Ethernet switchingIllustrative topology
Physical links are solid; device roles and relevant links are labeled.
Physical links are solid; device roles and relevant links are labeled.

How it works

Create VLANs on both switches, configure the inter-switch link as an explicit trunk, and set an allowed list. Static trunk mode and disabling DTP negotiation are separate settings on platforms supporting DTP.

The operational trunk view separates allowed VLANs, allowed-and-active VLANs, and forwarding/non-pruned VLANs. A VLAN in the first list is not proof it exists locally or is forwarding. Access ports remain access ports; the trunk configuration belongs on the uplink.

Configure or inspect

vlan 10
vlan 20
interface GigabitEthernet1/0/1
 switchport mode access
 switchport access vlan 10
 no shutdown
interface GigabitEthernet1/0/24
 switchport mode trunk
 switchport trunk allowed vlan 10,20
 switchport nonegotiate
 no shutdown

Verify the result

Illustrative output · selected lines
SW1#show interfaces trunk
Port      Mode  Encapsulation Status    Native vlan
Gi1/0/24  on    802.1q        trunking  1
Port      Vlans allowed on trunk
Gi1/0/24  10,20
Port      Vlans allowed and active in management domain
Gi1/0/24  10,20
Port      Vlans in spanning tree forwarding state and not pruned
Gi1/0/24  10,20

Apply the same configuration to SW2. The VLAN 10 access hosts can now be tested across the trunk; independent VLAN 20 traffic uses the same wire with separate forwarding context.

Failure and recovery

If VLAN 20 is missing from the allowed list, adding it with the plain command can replace the whole list. Use the add form when preserving existing permitted VLANs is intended.

interface GigabitEthernet1/0/24
 switchport trunk allowed vlan add 20
end
show interfaces trunk

Further reading

Key Takeaways

  • Configure trunk intent explicitly at both ends.
  • Allowed does not mean active or forwarding.
  • DTP suppression is separate from trunk mode.
  • The add form preserves other allowed VLANs.
  • Test each VLAN rather than one generic uplink ping.

Trunk configuration Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. Which interface is the trunk in this lab?
2. Does allowed alone prove forwarding?
3. Which keyword preserves the existing list?
4. Does static trunk mode necessarily suppress DTP?
5. Where must VLAN 10 exist?
6. What demonstrates VLAN 20 carriage?