Configure allowed VLANs on trunk

By default, all VLANs are allowed across the trunk link. We can verify that using the show interfaces trunk command:

show interfaces trunk

You can prevent traffic from certain VLANs from traversing a trunked link using the following interface mode command:

switchport trunk allowed vlan {add | all | except | remove} vlan-list

For example, to prevent traffic from VLAN 5 to traverse the trunk link, you can use the following command:

switchport trunk allowed vlan remove command

To verify that the traffic from VLAN 5 will indeed be blocked from traversing a trunked link, use the show interfaces trunk command again:

show interfaces trunk command

The all option in the switchport trunk allowed vlan command means all VLANs, so you can use it to reset the switch to its original default setting (permitting all VLANs on the trunk).
Geek University 2021