Introduction to VLAN configuration

Requirements

  • GNS3
  • Cisco IOS image(Cisco 3640 in this example)
  • NM-16ESW switching module

Topology and Goals

basic-typology

  • Allocate PC1 and PC3 to VLAN 10 while PC2 and PC4 in VLAN 20
  • Communicability in same VLAN

Set Up PC

On PC1

Router# configure terminal
Router(config)# hostname PC1
PC1(config)# no ip routing
PC1(config)# ip default-gateway 192.168.10.254
PC1(config)# interface fastethernet 0/0
PC1(config-if)# ip address 192.168.10.1 255.255.255.0
PC1(config-if)# no shutdown

Similar operations can be done on the rest of PCs.

Set Up Switch

On SW1

SW1#configure terminal
SW1(config)#vlan 10
SW1(config-vlan)#exit
SW1(config)#vlan 20
SW1(config-vlan)#exit
SW1(config)#interface fastEthernet 1/0
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#exit
SW1(config)#interface fastEthernet 1/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#exit
SW1(config)#interface fastEthernet 1/2
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#exit
SW1(config)#exit

Check VLAN switching configuration

SW1#show vlan-switch

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/3, Fa1/4, Fa1/5, Fa1/6
                                                Fa1/7, Fa1/8, Fa1/9, Fa1/10
                                                Fa1/11, Fa1/12, Fa1/13, Fa1/14
                                                Fa1/15
10   VLAN0010                         active    Fa1/0
20   VLAN0020                         active    Fa1/1
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  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0
1005 trnet 101005     1500  -      -      1        ibm  -        0      0

Check VLAN trunking configuration

SW1#show interfaces trunk

Port      Mode         Encapsulation  Status        Native vlan
Fa1/2     on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/2     1-4094

Port      Vlans allowed and active in management domain
Fa1/2     1,10,20

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/2     1,10,20

On SW2

SW2#configure terminal
SW2(config)#vlan 10
SW2(config-vlan)#exit
SW2(config)#vlan 20
SW2(config-vlan)#exit
SW2(config)#interface fastEthernet 1/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 10
SW2(config-if)#exit
SW2(config)#interface fastEthernet 1/1
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20
SW2(config-if)#exit
SW2(config)#interface fastEthernet 1/2
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#exit
SW2(config)#exit

Check VLAN switching configuration

SW2#show vlan-switch

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/3, Fa1/4, Fa1/5, Fa1/6
                                                Fa1/7, Fa1/8, Fa1/9, Fa1/10
                                                Fa1/11, Fa1/12, Fa1/13, Fa1/14
                                                Fa1/15
10   VLAN0010                         active    Fa1/0
20   VLAN0020                         active    Fa1/1
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  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0
1005 trnet 101005     1500  -      -      1        ibm  -        0      0

Check VLAN trunking configuration

SW2#show interfaces trunk

Port      Mode         Encapsulation  Status        Native vlan
Fa1/2     on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa1/2     1-4094

Port      Vlans allowed and active in management domain
Fa1/2     1,10,20

Port      Vlans in spanning tree forwarding state and not pruned
Fa1/2     1,10,20

Testing

On PC1

PC1#ping 192.168.10.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 44/55/60 ms

On PC2

PC2#ping 192.168.20.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 60/60/60 ms
Show Comments