Chapter 1: Configuring VLANs On A Cisco Switch Part Two (Preview)

The VLANs we create are stored in the VLAN database. This is a file labelled vlan.dat which resides in the flash memory of the switch. Each Ethernet VLAN in the VLAN database has a unique, 4-digit ID that can be a number from 1 to 1001. VLAN IDs 1002 to 1005 are reserved for Token Ring and FDDI VLANs.

Normal-range VLANs are VLANs with IDs from 1 to 1005. These VLANs are always stored in the VLAN database. Extended-range VLANs are VLANs with IDs from 1006 to 4094 and these are not stored in the VLAN database.

 

Configure a new VLAN

SUMMARY STEPS

  1. enable
  2. configure terminal
  3. vlan vlan-id
  4. name vlan-name
  5. end

 

Let’s create VLAN 10 and assign it a name of “LAB”

 

WS-2960>enable
!---Step 1. Enter the Privileged Exec mode---!
WS-2960#
WS-2960#configure terminal
!---Step 2. Enter the Global Configuration mode---!
Enter configuration commands, one per line. End with CNTL/Z. 
WS-2960(config)#vlan 10
!---Step 3. Create VLAN 10---!
WS-2960(config-vlan)#name LAB 
!---Step 4. Assign VLAN 10 a name of "LAB"---!
WS-2960(config-vlan)#end
!---Step 5. Exit VLAN Configuration---! 
WS-2960#

Assigning Static-Access Ports to a VLAN

SUMMARY STEPS

  1. enable
  2. configure terminal
  3. interface interface-id
  4. switchport mode access
  5. switchport access vlan vlan-id
  6. end

 

Now we will go ahead and assign ports fa0/1 and fa0/4 to VLAN 10 and configure the switchports as access ports.

 

WS-2960>enable
!---Step 1. Enter the Privileged Exec mode---!
WS-2960#
WS-2960#configure terminal
!---Step 2. Enter the Global Configuration mode---!
WS-2960(config)#interface fastethernet 0/1
!---Step 3. Enter the Subinterface Configuration mode---!
WS-2960(config-if)#switchport mode access
!---Step 4. Set the switchport mode to access---!
WS-2960(config-if)#switchport access vlan 10
!---Step 5. Assign the interface to VLAN 10---!
WS-2960(config-if)#end
!---Step 6. Exit the subinterface Configuration mode---!
WS-2960#
*Mar  1 00:24:24.785: %SYS-5-CONFIG_I: Configured from console by console
WS-2960#
!---Beginning of fa0/4 configuration---!
WS-2960#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
WS-2960(config)#interface fastethernet 0/4
WS-2960(config-if)#switchport mode access
WS-2960(config-if)#switchport access vlan 10
WS-2960(config-if)#end
WS-2960#

Example assigning fa0/1 and fa0/4 static access ports to VLAN

 

NOTE: If you assign an interface to a VLAN that does not exist, the new VLAN is created automatically for you.

WS-2960#conf t
WS-2960(config)#interface fastEthernet 0/10
WS-2960(config-if)#switchport mode access 
WS-2960(config-if)#switchport access vlan 100
% Access VLAN does not exist. Creating vlan 100
WS-2960(config-if)#end
WS-2960#

Configuration verification

Let’s first verify that the interface fa0/1 and fa0/4 has been assigned to VLAN 10 and the name for VLAN 10 is LAB by issuing the show vlan command on the switch.

 

 

WS-2960#show vlan  

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/2, Fa0/3, 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, Gi0/1, Gi0/2
10   LAB                              active    Fa0/1, Fa0/4
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0   
10   enet  100010     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

Example show vlan command output

 

WS-2960#show vlan id 10

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
10   LAB                              active    Fa0/1, Fa0/4

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
10   enet  100010     1500  -      -      -        -    -        0      0   

Remote SPAN VLAN
----------------
Disabled

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

Example show vlan id command output

 

Our configuration looks good. We can see VLAN 10 has been created and has a label of “LAB”. Also, Fa0/1 and Fa0/4 are assigned to VLAN 10.

 

Now let’s verify the VLAN configuration using the show interfaces switchport command.

From the command outputs below we can observe that Fa0/1  & Fa0/4

  1. Operational mode is static access
  2. The administrative mode is now set to access as we manually specified it is an access port.
  3. Ports are assigned to VLAN 10

 

 

WS-2960#show interfaces fastEthernet 0/1 switchport 
Name: Fa0/1
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: 10 (LAB)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none 
Administrative private-vlan mapping: none 
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk associations: none
Administrative private-vlan trunk mappings: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL

Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none

Example show interfaces fastethernet 0/1 switchport command output

WS-2960#show interfaces fastEthernet 0/4 switchport 
Name: Fa0/4
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: 10 (LAB)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none 
Administrative private-vlan mapping: none 
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk associations: none
Administrative private-vlan trunk mappings: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL

Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none

Example show interfaces fastethernet 0/4 switchport command output

 

Finally, let’s examine the running configuration of the two interfaces by issuing the command  show running-config fastethernet 0/1 and show running-config fastethernet 0/4.

 

WS-2960#show running-config interface fastEthernet 0/1
Building configuration...

Current configuration : 84 bytes
!
interface FastEthernet0/1
 switchport access vlan 10
 switchport mode access
end

WS-2960#show running-config interface fastEthernet 0/4
Building configuration...

Current configuration : 84 bytes
!
interface FastEthernet0/4
 switchport access vlan 10
 switchport mode access
end

Example show running-config interface fastEthernet 0/1 and show running-config interface fastEthernet 0/4 command output

 

We have seen using many show commands that the configuration is as we want it to be. So lets test the configuration by pinging 192.168.1.104. We should get a successful ping.

 

ping-192-168-1-104-output

Example ping 192.168.1.104 output

 

 

Back to: CCNA Routing and Switching 200-125 > Ethernet LAN Switching