一、实验目的
⑴ 掌握交换机在网络中的作用、组成以及交换机设备选型;
⑵ 掌握PacketTrace 仿真软件的使用方法;
⑶ 练掌握交换机的基本配置命令,包括交换机名称设定、保护口令设定、口令封装、接口描述、查看命令等。
二、实验条件
Cisco2620、Cisco 3560 交换机、PacketTrace仿真软件、具备Windows操作系统的PC机
三、实验原理及相关知识
掌握PacketTrace路由仿真软件的使用、交换机基本配置
四、实验步骤
网络拓扑结构如下图所示。
实现在同一子网中的PC机可跨交换机相互ping通。
1. Switch0配置过程
Switch>en
Switch#configure t
s1(config)#vlan 10
s1(config-vlan)#exit
s1(config)#vlan 20
s1(config-vlan)#exit
s1(config-if)#int range f0/1-9
s1(config-if-range)#switchport mode access
s1(config-if-range)#switchport access vlan 10
s1(config-if-range)#int range f0/10-19
s1(config-if-range)#switchport mode access
s1(config-if-range)#switchport access vlan 20
s1(config-if-range)#int f0/23
s1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
s1(config-if)#exit
2. Switch1配置过程
Switch>en
Switch#configure t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname s2
s2(config)#vlan 10
s2(config-vlan)#exit
s2(config)#vlan 20
s2(config-vlan)#exit
s2(config)#int range f0/1-9
s2(config-if-range)#switchport mode access
s2(config-if-range)#switchport access vlan 10
s2(config-if-range)#int range f0/10-19
s2(config-if-range)#switchport mode access
s2(config-if-range)#switchport access vlan 20
s2(config-if-range)#int f0/23
s2(config-if)#switchport mode trunk
s2(config-if)#exit
3. 测试连通性
同交换机ping相同vlan结果如图
同交换机ping不同vlan 结果如图:
不同交换机ping相同vlan结果如图:
不同交换机ping 不同vlan结果如图:
为实现不同VLAN间主机相互通信,增加一台三层交换机,网络拓扑结构如下图所示。请写出相应的配置过程,并测试连通性。
1、S0配置命令:
Switch>en
Switch#configure t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host s1
s1(config)#exit
s1#vlan database
s1(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
s1(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
s1(vlan)#exit
APPLY completed.
Exiting....
s1#configure t
Enter configuration commands, one per line. End with CNTL/Z.
s1(config)#int f0/1
s1(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
s1(config-if)#switchport trunk encapsulation dot1q
s1(config-if)#int f0/2
s1(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
s1(config-if)#switchport trunk encapsulation dot1q
s1(config)#int vlan 10
s1(config-if)#ip add 192.168.1.1 255.255.255.0
s1(config-if)#no sh
s1(config-if)#int vlan 20
s1(config-if)#ip add 192.168.5.1 255.255.255.0
s1(config-if)#no sh
s1(config-if)#exit
1、S1配置命令:
Switch>
Switch>en
Switch#configure t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host s2
s2(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
s2(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
s2(vlan)#exit
APPLY completed.
Exiting....
s2#configure t
Enter configuration commands, one per line. End with CNTL/Z.
s2(config)#int f0/23
s2(config-if)#switchport mode trunk
s2(config-if)#switchport trunk encapsulation dot1q
s2(config-if)#int range f0/1-9
s2(config-if-range)#switchport mode access
s2(config-if-range)#switchport access vlan 10
s2(config-if-range)#int range f0/10-19
s2(config-if-range)#switchport mode access
s2(config-if-range)#switchport access vlan 20
1、S2配置命令:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname s3
s3(config)#exit
s3#vlan database
s3(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
s3(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
s3(vlan)#exit
APPLY completed.
Exiting....
s3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
s3(config)#int f0/23
s3(config-if)#switchport mode trunk
s3(config-if)#int range f0/1-9
s3(config-if-range)#switchport mode access
s3(config-if-range)#switchport access vlan 10
s3(config-if-range)#int range f0/10-19
s3(config-if-range)#switchport mode access
s3(config-if-range)#switchport access vlan 20
同交换机同vlan ping结果如图:
同交换机不同vlan ping结果如图:
不同交换机同vlan ping结果如图:
不同交换机不同vlan ping结果如图:
五、思考题及其它
⑴ 二层交换机与三层交换机的区别是什么?
三层交换机解决了局域网不同vlan之间互相访问必须依赖路由器进行转发,解决了传统路由器性能低、价格昂贵的网络瓶颈问题。