Difference between revisions of "VLAN Pruning Trick"
(Created page with "Let's say you have a trunk port, and your sloppy coworkers never bothered to prune the unnecessary VLANs from the "switchport trunk allowed vlan" statement. It's trunking the...") |
|||
Line 2: | Line 2: | ||
Here's how to make the switch do the work for you. | Here's how to make the switch do the work for you. | ||
+ | |||
The list of VLANs that are supposed to be on the port is '''10,20,30,40,50,60,70,80,90,100''' | The list of VLANs that are supposed to be on the port is '''10,20,30,40,50,60,70,80,90,100''' | ||
− | |||
− | On that port, do this: | + | Find an available port that has no config on it. It doesn't need to be the same switch. On that port, do this: |
<PRE> | <PRE> | ||
Line 29: | Line 29: | ||
end | end | ||
</PRE> | </PRE> | ||
+ | |||
Copy that list to a text editor, remove the word "add" and put in the word "remove". | Copy that list to a text editor, remove the word "add" and put in the word "remove". | ||
Line 36: | Line 37: | ||
switchport trunk allowed vlan remove 81-89,91-99,101-4094 | switchport trunk allowed vlan remove 81-89,91-99,101-4094 | ||
</PRE> | </PRE> | ||
+ | |||
Paste that in to your switch, and you'll be left with a nice clean interface. | Paste that in to your switch, and you'll be left with a nice clean interface. |
Revision as of 15:13, 29 July 2013
Let's say you have a trunk port, and your sloppy coworkers never bothered to prune the unnecessary VLANs from the "switchport trunk allowed vlan" statement. It's trunking the entire 1-4094 range, even through they're not all supposed to be there. If there are a lot of VLANs, it will be time consuming to go through and "switch port trunk allowed vlan remove ##" every VLAN or group of VLANs from the list. And a single typo can knock out a bunch of VLANs.
Here's how to make the switch do the work for you.
The list of VLANs that are supposed to be on the port is 10,20,30,40,50,60,70,80,90,100
Find an available port that has no config on it. It doesn't need to be the same switch. On that port, do this:
switchport trunk allowed vlan remove 10,20,30,40,50,60,70,80,90,100
That will give you a list of the VLANs that aren't supposed to be on the real port:
SWITCH#show run int fa0/30 Building configuration... Current configuration : 227 bytes ! interface FastEthernet0/30 switchport trunk allowed vlan 1-9,11-19,21-29,31-39,41-49,51-59,61-69,71-79 switchport trunk allowed vlan add 81-89,91-99,101-4094 switchport mode dynamic desirable shutdown no cdp enable end
Copy that list to a text editor, remove the word "add" and put in the word "remove".
switchport trunk allowed vlan remove 1-9,11-19,21-29,31-39,41-49,51-59,61-69,71-79 switchport trunk allowed vlan remove 81-89,91-99,101-4094
Paste that in to your switch, and you'll be left with a nice clean interface.