When does VLAN pruning occur?

sgtcasey over on networking-forum.com recently posed in an interesting question: what triggers VLAN pruning? Specifically, will a switch only allow pruning of a VLAN from a trunk if it has no access ports configured for that VLAN? Or is it enough to have merely no active ports?

Consider a simple trunking scenario:

vtp_pruning_lab.png

Switch 1 is the VTP server, and has propagated VLANs 10, 20, and 30 to switch 2. The interfaces to which hosts A and B attach are configured as access ports in VLAN 10, and an 802.1Q trunk is formed between the two switches. By examining the trunk status on either switch we can verify that VLANs 1 and 10 are being passed while the others are pruned in both directions.

S1# show interface trunk

Port        Mode         Encapsulation  Status        Native vlan
Gi0/1       on           802.1q         trunking      1

Port      Vlans allowed on trunk
Gi0/1       1-4094

Port        Vlans allowed and active in management domain
Gi0/1       1,10,20,30

Port        Vlans in spanning tree forwarding state and not pruned
Gi0/1       1,10

Switch 2:

S2# show interface trunk
...
Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1,10

When host B is disconnected, its interface on switch 2 becomes inactive. As switch 2 has no remaining active ports in VLAN 10, VLAN 10 becomes eligible for pruning. After roughly 30 seconds pass, we can see that switch 1 is now pruning VLAN 10 from the trunk (VLAN 10 is absent from the last line of the output):

S1# show interface trunk
...
Port        Vlans in spanning tree forwarding state and not pruned
Gi0/1       1

The VLAN remains unpruned on switch 2's end of the trunk, because it knows switch 1 still has at least one active port in VLAN 10:

S2# show interface trunk
...
Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1,10

About the Author

Jeremy Stretch is a networking engineer and the maintainer of PacketLife.net. He currently lives in the Raleigh-Durham area of North Carolina. Although employed full-time out of necessity, his true passion lies in improving the field of network engineering around the world. You can contact him by email or follow him on Twitter.

Comments

Hey !

A little bit confused. I have tryed this example using GNS3, and I couldn't grasp the idea if host b is shutdown, should not be pruned it in the switch 2 ???

Thanks for your excellent material

So when does SW1 stop pruning that VLAN exactly? Once the port show a link, up and up? (I would hope)
I have seen a situation where we kept losing connectivity to two devices that would communicate very little. When the problem would occur, I could see that the VLAN was pruned. The ports were active and connected, however I am guessing we had no communications and that is what led the switch to prune them.

Any Ideas?

Hi DanDman,

One way to end that problem is to remove that VLAN from the Pruning Eligible list using 'switchport trunk pruning remove' command.

Regards,
Angela

PS: Maybe, the rough 30 seconds transition is due to STP (Max Age Timer)?

Leave a Comment


Register to comment as a member. You'll look cooler.

Optional; will not be displayed publicly or given out.

No commercial links. Only personal (e.g. blog, Twitter, or LinkedIn) and/or on-topic links, please.
How long is an IPv6 address, in bits?