Be careful when deleting VLANs.

VLANs are created by configuration and can of course be deleted. Be careful when deleting VLANs. This is because the access port assigned to the deleted VLAN will no longer be available.

An access port is a port that is assigned to one VLAN and used to forward Ethernet frames for that VLAN. If the assigned VLAN is deleted, it will be assigned to a VLAN that does not exist. The access port would then be unusable.

In the figure below, the Layer 2 switch has a default VLAN1 and an additional VLAN2. Port Fa0/2 is the access port assigned to VLAN2.

Figure VLAN assignment example
Figure VLAN assignment example

And just because VLAN2 is deleted does not mean that the Fa0/2 assignment automatically becomes VLAN1. Even if VLAN2 is deleted, the configuration to assign Fa0/2 to VLAN2 remains. In other words, Fa0/2 remains assigned to VLAN2, which does not exist. Fa0/2 will then be unavailable.

Figure Ports assigned to a nonexistent VLAN cannot be used.
Figure Ports assigned to a nonexistent VLAN cannot be used.

When you delete a VLAN, you should also properly change the configuration of the ports assigned to the deleted VLAN.

Example of assigning to a VLAN that does not exist

Let’s look at an example of assigning to a VLAN that does not exist on a Cisco Catalyst switch. Consider the network diagram described earlier.

The following configuration is applied to SW1.

SW1

vlan 2
!
interface FastEthernet0/1
 switchport access vlan 1
!
interface FastEthernet0/2
 switchport access vlan 2

Fa0/1のThe switchport access vlan 1 is the default configuration, so nothing special is normally shown on show running-config.

The correspondence between VLANs and access ports in the show vlan breif command is shown below.

SW1#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24, Gig0/1
                                                Gig0/2
2    VLAN0002                         active    Fa0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

Also, show interface fa0/2 switchport displays the following.

SW1#show int fa 0/2 switchport 
Name: Fa0/2
Switchport: Enabled
Administrative Mode: static access
Operational Mode: static access
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: native
Negotiation of Trunking: Off
Access Mode VLAN: 2 (VLAN0002)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
-- omitted --

Delete VLAN2

Delete VLAN2 from the state verified so far.

SW1

no vlan 2

Deleting VLAN 2 does not delete the switchport access vlan 2 command that assigns Fa0/2 to VLAN 2. Looking at show running-config, “switchport access vlan 2” on Fa0/2 remains.

SW1

SW1#show running-config interface fa0/2
Building configuration...

Current configuration : 83 bytes
!
interface FastEthernet1/2
 switchport access vlan 2
 duplex full
 speed 100
end

If you verify the correspondence between VLANs and access ports, VLAN 2 has been removed, so Fa0/2 will no longer appear either.

SW1

SW1#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24, Gig0/1
                                                Gig0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

And if you look at show interface Fa0/2 switchport, you can clearly see that it is still assigned to a VLAN that does not exist.

SW1

SW1#show int fa 0/2 switchport 
Name: Fa0/2
Switchport: Enabled
Administrative Mode: static access
Operational Mode: static access
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: native
Negotiation of Trunking: Off
Access Mode VLAN: 2 (Inactive)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
~省略~

In the show interface command, Fa0/2 appears to be up/up and normal, but the link LED is orange and cannot be used.

Figure Deleting a VLAN but the configuration to assign it to a port remains
Figure Deleting a VLAN but the configuration to assign it to a port remains

Thus, when a VLAN is deleted, the ports still assigned to the deleted VLAN are no longer available; once a VLAN is deleted, the configuration of the ports that were assigned to the corresponding VLAN must also be properly changed.