《计算机网络课程设计实验指导2012.doc》由会员分享,可在线阅读,更多相关《计算机网络课程设计实验指导2012.doc(35页珍藏版)》请在金锄头文库上搜索。
1、计算机网络课程设计实验指导实验一通过三层交换机实现VLAN间路由【实验名称】 通过三层交换机实现VLAN间路由【实验目的】 掌握如何通过三层交换机实现VLAN间路由。【背景描述】 假设某企业有2个主要部门:销售部和技术部,其中销售部门的个人计算机系统分散连接在2台交换机上,他们之间需要相互进行通信,销售部和技术部也需要进行相互通讯,现要在交换机上做适当配置来实现这一目标。【实现功能】使在同一VLAN里的计算机系统能跨交换机进行相互通信,而在不同VLAN里的计算机系统也能进行相互通信。【实验拓扑】PC1PC3SwitchAPC2SwitchB【实验设备】 S3550-24(2台)【实验步骤】第一
2、步:在交换机SwitchA上创建Vlan 10,并将0/5端口划分到Vlan 10中。SwitchA # configure terminal !进入全局配置模式。SwitchA(config)# vlan 10 !创建Vlan 10。SwitchA(config-vlan)# name sales !将Vlan 10命名为sales。SwitchA(config-vlan)#exitSwitchA(config)#interface fastethernet 0/5 !进入接口配置模式。SwitchA(config-if)#switchport access vlan 10 !将0/5端口划
3、分到Vlan 10。验证测试:验证已创建了Vlan 10,并将0/5端口已划分到Vlan 10中。SwitchA#show vlan id 10VLAN Name Status Ports- - - -10 sales active Fa0/5第二步:在交换机SwitchA上创建Vlan 20,并将0/15端口划分到Vlan 20中。SwitchA(config)# vlan 20 !创建Vlan 20。SwitchA(config-vlan)# name technical !将Vlan 20命名为technical。SwitchA(config-vlan)#exitSwitchA(conf
4、ig)#interface fastethernet 0/15 !进入接口配置模式。SwitchA(config-if)#switchport access vlan 20 !将0/15端口划分到Vlan 20。验证测试:验证已创建了Vlan 20,并将0/15端口已划分到Vlan 20中。SwitchA#show vlan id 20VLAN Name Status Ports- - - -20 technical active Fa0/15第三步:在交换机SwitchA上将与SwitchB相连的端口(假设为0/24端口)定义为tag vlan模式。SwitchA(config)#inter
5、face fastethernet 0/24 !进入接口配置模式。SwitchA(config-if)#switchport mode trunk !将fastethernet 0/24端口设为tag vlan模式。验证测试:验证fastethernet 0/24端口已被设置为tag vlan模式。SwitchA#show interfaces fastEthernet 0/24 switchportInterface Switchport Mode Access Native Protected VLAN lists- - - - - - -Fa0/24 Enabled Trunk 1 1
6、Disabled All第四步:在交换机SwitchB上创建Vlan 10,并将0/5端口划分到Vlan 10中。SwitchB # configure terminal !进入全局配置模式。SwitchB(config)# vlan 10 !创建Vlan 10。SwitchB(config-vlan)# name sales !将Vlan 10命名为sales。SwitchB(config-vlan)#exitSwitchB(config)#interface fastethernet 0/5 !进入接口配置模式。SwitchB(config-if)#switchport access vl
7、an 10 !将0/5端口划分到Vlan 10。验证测试:验证已在SwitchB上创建了Vlan 10,并将0/5端口已划分到Vlan 10中。SwitchB#show vlan id 10VLAN Name Status Ports- - - -10 sales active Fa0/5第五步:在交换机SwitchB上将与SwitchA相连的端口(假设为0/24端口)定义为tag vlan模式。SwitchB(config)#interface fastethernet 0/24 !进入接口配置模式。SwitchB(config-if)#switchport mode trunk !将fas
8、tethernet 0/24端口设为tag vlan模式。验证测试:验证fastethernet 0/24端口已被设置为tag vlan模式。SwitchB#show interfaces fastEthernet 0/24 switchportInterface Switchport Mode Access Native Protected VLAN lists- - - - - - -Fa0/24 Enabled Trunk 1 1 Disabled All第六步:验证PC1与PC3能互相通信,但PC2与PC3不能互相通信。C:ping 192.168.10.30 !在PC1的命令行方式下
9、验证能Ping通PC3 。Pinging 192.168.10.30 with 32 bytes of data:Reply from 192.168.10.30: bytes=32 time10ms TTL=128Reply from 192.168.10.30: bytes=32 time10ms TTL=128Reply from 192.168.10.30: bytes=32 time10ms TTL=128Reply from 192.168.10.30: bytes=32 timeping 192.168.10.30 !在PC2的命令行方式下验证不能Ping通PC3 。Pingin
10、g 192.168.10.30 with 32 bytes of data:Request timed out.Request timed out.Request timed out.Request timed out.Ping statistics for 192.168.10.30: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms第七步:设置三层交换机
11、VLAN间通讯。SwitchA(config)# int vlan 10 ! 创建虚拟接口vlan 10SwitchA(config-if)#ip address 192.168.10.254 255.255.255.0! 配置虚拟接口vlan 10的地址为192.168.10.254SwitchA(config-if)#exit ! 返回到全局配置模式SwitchA(config)# int vlan 20 ! 创建虚拟接口vlan 20SwitchA(config-if)#ip address 192.168.20.254 255.255.255.0! 配置虚拟接口vlan 20的地址为1
12、92.168.20.254第八步:将PC1和PC3的默认网关设置为192.168.10.254,将PC2的默认网关设置为192.168.20.254第九步:测试结果不同VLAN内的主机可以互相PING通【注意事项】l 两台交换机之间相连的端口应该设置为tag vlan模式。l 需要设置PC的网关【参考配置】SwitchA#show running-config ! 显示交换机SwitchA的全部配置。Building configuration.Current configuration : 349 bytes!version 1.0!hostname SwitchAinterface FastEthernet 0/5 switchport access vlan 10!interface FastEthernet 0/15 switchport access vlan 20!interface FastEthernet 0/24 switchport mode trunk!interface Vlan 10 ip address 192.168.10.254