In VLAN configurations, trunking allows multiple VLANs to be transmitted over a single physical link between switches. Trunking can be set up using static trunking or dynamic trunking.


1. Static Trunking

Static trunking means manually configuring a switch port as a trunk. This ensures that the port remains in trunk mode, allowing multiple VLANs to pass through it.

Advantages of Static Trunking

✅ More secure (prevents unauthorized devices from negotiating trunks).
✅ No risk of dynamic negotiation failures.
✅ Preferred in enterprise networks for stability.

Configuration of Static Trunking (Cisco Switch Example)

bashCopyEditinterface GigabitEthernet0/1
  switchport mode trunk
  switchport trunk allowed vlan 10,20,30
  switchport trunk native vlan 99
  exit

👉 This command sets GigabitEthernet0/1 as a static trunk, allowing VLANs 10, 20, and 30, and setting VLAN 99 as the native VLAN.


2. Dynamic Trunking (DTP – Dynamic Trunking Protocol)

Dynamic trunking allows ports to negotiate whether to become a trunk or remain an access port. Cisco switches use DTP (Dynamic Trunking Protocol) to automate trunk formation.

DTP Modes

ModeBehavior
AccessForces the port into access mode (no trunking).
TrunkForces the port into trunk mode (like static trunking).
Dynamic AutoWaits for the other side to initiate trunking but does not actively negotiate.
Dynamic DesirableActively tries to negotiate trunking with the other device.

Configuration of Dynamic Trunking (Cisco Example)

interface GigabitEthernet0/2
switchport mode dynamic desirable
exit

👉 The desirable mode will actively try to establish a trunk if the other side supports it.

interface GigabitEthernet0/3
switchport mode dynamic auto
exit

👉 The auto mode waits for the other side to initiate trunking. If both sides are set to auto, the trunk will not form.


3. Key Differences: Static vs. Dynamic Trunking

FeatureStatic TrunkingDynamic Trunking (DTP)
ConfigurationManually set to trunk modeUses DTP to negotiate trunking
SecurityMore secureLess secure (vulnerable to VLAN hopping attacks)
StabilityAlways trunkMay fail to negotiate a trunk
Best Use CasesEnterprise networks, high-security environmentsSimple setups or mixed vendor environments

Best Practice Recommendation

🔹 Disable DTP on all trunk ports and configure static trunking for security.
🔹 Use switchport nonegotiate to prevent DTP from running:

interface GigabitEthernet0/4
switchport mode trunk
switchport nonegotiate
exit

Leave a comment

Hey there, fellow nerds and net-surfers!

Welcome to my corner of the internet where I talk about the holy trinity of tech: NetworkingLinux, and Security — or as I like to call it, “Ctrl+Alt+Fix-It”. If you’re into packet sniffing (the legal kind), hardening Linux boxes, or figuring out why your network is being as moody as a teenager, you’re in the right place.

This blog is where I dump useful knowledge, random tech rants, and occasional troubleshooting victories so future me (and hopefully you) can benefit. Expect bash scripts, firewall rules, sarcastic comments, and the occasional meme — because what’s IT without a little command-line chaos and caffeine?

Whether you’re a curious beginner or a battle-hardened sysadmin, I hope you’ll find something here to learn, laugh at, or copy-paste in desperation.

Welcome aboard — and may your logs always be verbose.

Let’s connect