Named VLAN Assignment :: The Alternative Way?

In Campus designs, where VLAN distribution is needed to provide enough IP space to the access-layer, bulk editing VLAN assignments to access-ports can be a troublesome job.


Let’s say you have one functional VLAN called “Guest”. The distribution-switch act as the gateway for 50 access-switches and their VLAN’s. You will need to install 50 VLAN-id’s on the distribution-layer for the function of “Guest” to divide the connected the IP space.
On the access-layer you need to assign ports to this functional VLAN, resulting in manual port configuration with different VLAN variables over all switches. Excel can help, even python scripting can relief some of this burden. But it needs to be developed.


Since Cisco IOS 15.2(3)E3 Cisco has introduced VLAN assignment via VLAN name instead of VLAN-id.

The syntax under the Interface level:

switchport access vlan name {name-of-vlan}

Let’s give it a try!

ACCESS#sh vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/1, Gi0/2, Gi1/0, Gi1/1
                                                Gi1/2, Gi1/3
100  userlan                          active    Gi0/3
200  OFFICE                           active    
300  TO_DC                            active    
400  PUBLIC                           active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 
3000 QUARANTINE                       active    
ACCESS#
ACCESS#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
ACCESS(config)#vlan 2000
ACCESS(config-vlan)#name GUEST
ACCESS(config-vlan)#exit
ACCESS(config)#
ACCESS(config)#
ACCESS(config)#
ACCESS(config)#exit
ACCESS#
*Jan  9 21:21:16 CET: %SYS-5-CONFIG_I: Configured from console by console
ACCESS#sh vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/1, Gi0/2, Gi1/0, Gi1/1
                                                Gi1/2, Gi1/3
100  userlan                          active    Gi0/3
200  OFFICE                           active    
300  TO_DC                            active    
400  PUBLIC                           active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 
2000 GUEST                            active    
3000 QUARANTINE                       active    
ACCESS#
ACCESS#
ACCESS#sh ip int brief
Interface              IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0     unassigned      YES unset  up                    up      
GigabitEthernet0/1     unassigned      YES unset  down                  down    
GigabitEthernet0/2     unassigned      YES unset  down                  down    
GigabitEthernet0/3     unassigned      YES unset  up                    up      
GigabitEthernet1/0     unassigned      YES unset  down                  down    
GigabitEthernet1/1     unassigned      YES unset  down                  down    
GigabitEthernet1/2     unassigned      YES unset  down                  down    
GigabitEthernet1/3     unassigned      YES unset  down                  down    
Vlan100                172.16.100.250  YES NVRAM  up                    up      
ACCESS#
ACCESS#
ACCESS#sh int trunk

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

Port        Vlans allowed on trunk
Gi0/0       100,200,400,3000

Port        Vlans allowed and active in management domain
Gi0/0       100,200,400,3000

Port        Vlans in spanning tree forwarding state and not pruned
Gi0/0       100,200,400,3000
ACCESS#conf t
Enter configuration commands, one per line.  End with CNTL/Z.     
ACCESS(config)#int range gigabitEthernet 1/0 - 3
ACCESS(config-if-range)#switchport access ?
  vlan  Set VLAN when interface is in access mode

ACCESS(config-if-range)#switchport access vlan ?
  <1-4094>  VLAN ID of the VLAN when this port is in access mode
  name      Set VLAN when interface is in access mode

ACCESS(config-if-range)#switchport access vlan name GUEST ?
  <cr>

ACCESS(config-if-range)#switchport access vlan name GUEST 
ACCESS(config-if-range)#
ACCESS(config-if-range)#
ACCESS(config-if-range)#do sh run int g1/0
Building configuration...

Current configuration : 83 bytes
!
interface GigabitEthernet1/0
 switchport access vlan 2000
 negotiation auto
end

Now you can perform this task just with one syntax on all switches. The name will make a match in the VLAN Database and will assign the associated VLAN-id to the port.
What about trunk links to end devices??

ACCESS(config)#int range gigabitEthernet 1/0 - 3
ACCESS(config-if-range)#switchport trunk encapsulation dot1q 
ACCESS(config-if-range)#switchport mode trunk                
ACCESS(config-if-range)#switchport trunk allowed vlan ?
WORD    VLAN IDs of the allowed VLANs when this port is in trunking mode
add     add VLANs to the current list
all     all VLANs
except  all VLANs except the following
none    no VLANs
remove  remove VLANs from the current list
ACCESS(config-if-range)#switchport trunk allowed vlan GUEST               
Command rejected: Bad VLAN list - character #1 is a non-numeric
character ('G').
% Range command terminated because it failed on GigabitEthernet1/0

Bad luck, but we can speed up the change for our access-ports. Nice feature. If I would give this points, it would be 42.

Leave a Reply