VLAN Switch division

GNS3 icon

How switch into VLAN? This experiment is very simple, that is by VLANdivision, so that different VLANunable to communicate, but the same VLANis not affected.


Lab topology

Topology

A switch connected in three VPCdivided VLANaddress planned as follows:

name interface VLAN address
PC1 f1 / 0 vlan 10 192.168.10.10/24
PC2 f1 / 1 vlan 20 192.168.10.20/24
PC3 f1 / 2 vlan 20 192.168.10.30/24

Configuration

Creating vlan

1.vlan database configuration mode. (Not recommended)

SW#vlan database 
SW(vlan)#vlan 10 name caiwu
SW(vlan)#exit 

2. Global Configuration Mode.

SW(config)#vlan 20
SW(config-vlan)#name renshi 
SW(config-vlan)#end

Port to vlan

SW(config)#interface fastEthernet 1/0
SW(config-if)#switchport mode access 
SW(config-if)#switchport access vlan 10
SW(config-if)#exit 

Configuration process

Before configuring interoperability testing

  • PC1
PC1> ip 192.168.10.10
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0

PC1> ping 192.168.10.20 
84 bytes from 192.168.10.20 icmp_seq=1 ttl=64 time=0.989 ms
84 bytes from 192.168.10.20 icmp_seq=2 ttl=64 time=0.998 ms
84 bytes from 192.168.10.20 icmp_seq=3 ttl=64 time=0.960 ms
84 bytes from 192.168.10.20 icmp_seq=4 ttl=64 time=0.971 ms
84 bytes from 192.168.10.20 icmp_seq=5 ttl=64 time=0.999 ms


PC1> ping 192.168.10.30
84 bytes from 192.168.10.30 icmp_seq=1 ttl=64 time=1.036 ms
84 bytes from 192.168.10.30 icmp_seq=2 ttl=64 time=0.997 ms
84 bytes from 192.168.10.30 icmp_seq=3 ttl=64 time=0.963 ms
84 bytes from 192.168.10.30 icmp_seq=4 ttl=64 time=0.849 ms
84 bytes from 192.168.10.30 icmp_seq=5 ttl=64 time=0.868 ms
  • PC2
PC2> ip 192.168.10.20
Checking for duplicate address...
PC1 : 192.168.10.20 255.255.255.0

PC2> ping 192.168.10.10
84 bytes from 192.168.10.10 icmp_seq=1 ttl=64 time=0.845 ms
84 bytes from 192.168.10.10 icmp_seq=2 ttl=64 time=0.995 ms
84 bytes from 192.168.10.10 icmp_seq=3 ttl=64 time=0.861 ms
84 bytes from 192.168.10.10 icmp_seq=4 ttl=64 time=0.877 ms
84 bytes from 192.168.10.10 icmp_seq=5 ttl=64 time=0.859 ms

PC2> ping 192.168.10.30
84 bytes from 192.168.10.30 icmp_seq=1 ttl=64 time=0.995 ms
84 bytes from 192.168.10.30 icmp_seq=2 ttl=64 time=0.892 ms
84 bytes from 192.168.10.30 icmp_seq=3 ttl=64 time=0.958 ms
84 bytes from 192.168.10.30 icmp_seq=4 ttl=64 time=0.863 ms
84 bytes from 192.168.10.30 icmp_seq=5 ttl=64 time=0.865 ms
  • PC3
PC3> ip 192.168.10.30
Checking for duplicate address...
PC1 : 192.168.10.30 255.255.255.0

PC3> ping 192.168.10.10
84 bytes from 192.168.10.10 icmp_seq=1 ttl=64 time=0.877 ms
84 bytes from 192.168.10.10 icmp_seq=2 ttl=64 time=0.965 ms
84 bytes from 192.168.10.10 icmp_seq=3 ttl=64 time=0.844 ms
84 bytes from 192.168.10.10 icmp_seq=4 ttl=64 time=0.876 ms
84 bytes from 192.168.10.10 icmp_seq=5 ttl=64 time=0.852 ms

PC3> ping 192.168.10.20
84 bytes from 192.168.10.20 icmp_seq=1 ttl=64 time=0.863 ms
84 bytes from 192.168.10.20 icmp_seq=2 ttl=64 time=0.963 ms
84 bytes from 192.168.10.20 icmp_seq=3 ttl=64 time=0.855 ms
84 bytes from 192.168.10.20 icmp_seq=4 ttl=64 time=1.004 ms
84 bytes from 192.168.10.20 icmp_seq=5 ttl=64 time=0.000 ms

Official Configuration

  • SWClose routing
SW#configure terminal 
SW(config)#no ip routing 
SW(config)#end
  • vlan databasecreatevlan 10
SW#vlan database 
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

SW(vlan)#vlan 10 name caiwu
VLAN 10 added:
    Name: caiwu
SW(vlan)#exit 
APPLY completed.
Exiting....
  • Create a global configurationvlan 20
SW#configure terminal 
SW(config)#vlan 20
SW(config-vlan)#name renshi 
SW(config-vlan)#end
  • ViewVLAN
SW#show vlan-switch brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/1, Fa1/2, 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   caiwu                            active    
20   renshi                           active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 
  • The interface f1/0is added to vlan 10and view
SW#configure terminal 
SW(config)#interface fastEthernet 1/0
SW(config-if)#switchport mode access 
SW(config-if)#switchport access vlan 10
SW(config-if)#exit 
SW(config)#do show vlan-sw b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/1, Fa1/2, 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   caiwu                            active    Fa1/0
20   renshi                           active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 
  • The interface f1/1and f1/2added to vlan 20and view
SW(config)#interface range fastEthernet 1/1 - 2
SW(config-if-range)#switchport mode access 
SW(config-if-range)#switchport access vlan 20
SW(config-if-range)#exit 
SW(config)#do show vlan-sw b

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   caiwu                            active    Fa1/0
20   renshi                           active    Fa1/1, Fa1/2
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

PING test

PC1> ping 192.168.10.20
host (192.168.10.20) not reachable

PC1> ping 192.168.10.30
host (192.168.10.30) not reachable
PC2> ping 192.168.10.10
host (192.168.10.10) not reachable

PC2> ping 192.168.10.30
84 bytes from 192.168.10.30 icmp_seq=1 ttl=64 time=0.971 ms
84 bytes from 192.168.10.30 icmp_seq=2 ttl=64 time=0.877 ms
84 bytes from 192.168.10.30 icmp_seq=3 ttl=64 time=0.844 ms
84 bytes from 192.168.10.30 icmp_seq=4 ttl=64 time=0.954 ms
84 bytes from 192.168.10.30 icmp_seq=5 ttl=64 time=0.869 ms
PC3> ping 192.168.10.10
host (192.168.10.10) not reachable

PC3> ping 192.168.10.20
84 bytes from 192.168.10.20 icmp_seq=1 ttl=64 time=0.866 ms
84 bytes from 192.168.10.20 icmp_seq=2 ttl=64 time=0.962 ms
84 bytes from 192.168.10.20 icmp_seq=3 ttl=64 time=0.855 ms
84 bytes from 192.168.10.20 icmp_seq=4 ttl=64 time=0.868 ms
84 bytes from 192.168.10.20 icmp_seq=5 ttl=64 time=0.965 ms

PC1And PC2can not communicate, PC1and PC3can not communicate, but PC2with PC3between can communicate, experiment a success.


At last

Benpian is divided on a switch in VLANthe experiment, write next about the inter-switch VLANcommunication.

Guess you like

Origin www.cnblogs.com/llife/p/11329114.html