Cisco VLAN & Trunk Generator
Generate Cisco IOS VLAN, access port, trunk and SVI configuration with the safety settings that keep a switched network stable.
Result
vlan 100
name USERS
!
vlan 999
name NATIVE-UNUSED
shutdown
!
interface Vlan100
description USERS gateway
ip address 10.100.0.1 255.255.255.0
no shutdown
!
interface range Gi1/0/1-24
description USERS access
switchport mode access
switchport access vlan 100
switchport nonegotiate
spanning-tree portfast
spanning-tree bpduguard enable
storm-control broadcast level 5.00
no shutdown
!
interface range Gi1/0/47-48
description 802.1Q trunk
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk native vlan 999
switchport trunk allowed vlan 100,200,300
switchport nonegotiate
spanning-tree guard loop
no shutdown
!show vlan brief
show interfaces trunk
show spanning-tree vlan 100
show ip interface brief | include Vlan100
show interfaces status | include USERSAbout Cisco VLAN & Trunk Generator
VLAN configuration is easy to write and easy to write badly. This generates the full set - VLAN definition, access ports, trunk with a pruned allowed list, an unused native VLAN, and an SVI - with the spanning-tree and storm-control settings that keep an access layer out of trouble.
Spanning tree on an access layer
Enable PortFast on access ports so a host does not wait 30 seconds through listening and learning, and pair it with BPDU Guard so a switch plugged into that port is shut down rather than allowed to influence the topology. Use Root Guard on ports facing other switches you do not control, and set the root bridge priority explicitly on your distribution pair — leaving root election to default priorities and MAC addresses means the oldest access switch in the building can end up as root.
Why the native VLAN matters
Frames on the native VLAN cross a trunk untagged. If two switches disagree about which VLAN that is, traffic leaks between broadcast domains with no error message. Worse, leaving it as VLAN 1 alongside untagged access ports enables double-tagging attacks. Define an unused VLAN, set it as native on every trunk, and shut it down.
Common use cases
- Provisioning a new access switch to a standard build.
- Adding a VLAN across an existing switched estate consistently.
- Producing configuration a reviewer can check line by line before a change window.
Edge cases and gotchas
- Do not enable BPDU guard on ports facing another switch - it will disable the port on the first BPDU.
- VLANs 1002-1005 are reserved on legacy platforms; the extended range above 1005 requires VTP transparent or off mode on older IOS.