实验目的:

1、掌握跨交换机同VLAN的通信实现。

2、理解跨交换机同VLAN的通信原理。

实验拓扑:

实验步骤:

1、依据图中拓扑配置4台主机的IP地址,其中PC通过路由器模拟,配置如下:

PC1(config)#int f0/0

PC1(config-if)#no shutdown

PC1(config-if)#ip address 192.168.1.1 255.255.255.0

PC1(config-if)#exit

PC2(config)#int f0/0

PC2(config-if)#no shutdown

PC2(config-if)#ip address 192.168.1.2 255.255.255.0

PC2(config-if)#exit

PC3(config)#int f0/0

PC3(config-if)#no shutdown

PC3(config-if)#ip address 192.168.2.3 255.255.255.0

PC3(config-if)#exit

PC4(config)#int f0/0

PC4(config-if)#no shutdown

PC4(config-if)#ip address 192.168.2.4 255.255.255.0

PC4(config-if)#exit

2、根据图中拓扑,在交换机SW1和SW2上创建VLAN,然后将接口放置到对应VLAN中,如下=>

SW1上配置:

SW1#vlan database

SW1(vlan)#vlan 10 name VLAN_10

SW1(vlan)#vlan 20 name VLAN_20

SW1(vlan)#exit

SW1(config)#int range f0/0 , f0/2 

SW1(config-if-range)#switchport mode access

SW1(config-if-range)#switchport access vlan 10

SW1(config-if-range)#exit

SW1(config)#int range f0/1 , f0/3

SW1(config-if-range)#switchport mode access

SW1(config-if-range)#switchport access vlan 20

SW1(config-if-range)#exit

SW2上配置:

SW2#vlan database

SW2(vlan)#vlan 10 name VLAN_10

SW2(vlan)#vlan 20 name VLAN_20

SW2(vlan)#exit

SW2(config)#int range f0/0 , f0/2

SW2(config-if-range)#switchport mode access

SW2(config-if-range)#switchport access vlan 10

SW2(config-if-range)#exit

SW2(config)#int range f0/1 , f0/3

SW2(config-if-range)#switchport mode access

SW2(config-if-range)#switchport access vlan 20

SW2(config-if-range)#exit

查看VLAN信息,如下:

SW1#show vlan-switch brief


VLAN Name                      Status    Ports

---- -------------------------------- --------- -------------------------------

1    default                       active    Fa0/4, Fa0/5, Fa0/6, Fa0/7

                                           Fa0/8, Fa0/9, Fa0/10, Fa0/11

                                         Fa0/12, Fa0/13, Fa0/14, Fa0/15

10   VLAN_10                    active    Fa0/0, Fa0/2

20   VLAN_20                    active    Fa0/1, Fa0/3

1002 fddi-default                    active   

1003 token-ring-default               active   

1004 fddinet-default                  active   

1005 trnet-default                    active 

SW2#show vlan-switch brief


VLAN Name                       Status    Ports

---- -------------------------------- --------- -------------------------------

1    default                       active    Fa0/4, Fa0/5, Fa0/6, Fa0/7

                                           Fa0/8, Fa0/9, Fa0/10, Fa0/11

                                         Fa0/12, Fa0/13, Fa0/14, Fa0/15

10   VLAN0010                    active    Fa0/0, Fa0/2

20   VLAN0020                    active    Fa0/1, Fa0/3

1002  fddi-default                    active   

1003 token-ring-default               active   

1004 fddinet-default                  active   

1005 trnet-default                    active  

此时,SW1和SW2上不同交换机已经创建,并且不同接口放置在对应VLAN中。

3、进行跨交换机同VLAN间的连通性测试,如下:

PC1#ping 192.168.1.2


Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 36/52/64 ms

PC3#ping 192.168.2.4


Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.2.4, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 32/43/60 ms

此时可以看出,同VLAN跨交换机通信成功!这个实验可以验证出,交换机之间承载多个VLAN流量可以通过多根网线划分到对应VLAN,从而实现通信。在VLAN数比较少的情况下,这是一种简洁的解决方案,但是若VLAN数目比较多,则交换机之间需要连接的网线相应增多,此时则非常消耗交换机的端口资源,解决这个问题则需要引入接下来的Trunk技术。此实验完成。