《三层交换机实现不同vlan间通信(共7页).doc》由会员分享,可在线阅读,更多相关《三层交换机实现不同vlan间通信(共7页).doc(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上案例10 利用三层交换机实现不同vlan间通信【背景描述】某企业有两个主要部门:销售部和技术部,其中销售部的个人计算机系统分散连接在两台交换机上,他们之间需要相互进行通信,销售部和技术部也需要进行相互通信,现要在交换机上做适当配置来实现这一目标。【实现功能】 使在同一VLAN里的计算机系统能跨交换机进行通信,而在不同VLAN里的计算机系统也能进行相互通信。【使用设备】设备类型设备名称设备数量交换机Switch01路由器三层交换机Switch11双绞线4计算机pc3【实验拓扑】表1 设备基本信息设备名端口及所属VLANIP信息IP地址网关Switch1 3560Fa 0
2、/24 默认VLANSwitch0 2960Fa 0/24 默认VLANPC0Fa 0/5 VLAN 10192.168.10.10/24192.168.10.254/24PC1Fa 0/15 VLAN 20192.168.20.20/24192.168.20.254/24PC2Fa 0/5 VLAN 10192.168.10.30/24192.168.10.254/24【实现步骤】步骤1.在交换机Switch1上创建vlan 10 ,并将0/5端口划分到vlan 10 中.Switch1enableSwitch1#configure terminalSwitch1(config)#vlan
3、10Switch1(config-vlan)#name salesSwitch1(config-vlan)#exitSwitch1(config)#interface fastEthernet 0/5Switch1(config-if)#switchport access vlan 10Switch1(config-if)#exitSwitch1(config)#vlan 20Switch1(config-vlan)#name technicalSwitch1(config-vlan)#exitSwitch1(config)#interface vlan 20Switch1(config-if
4、)#exitSwitch1(config)#interface fastEthernet 0/15Switch1(config-if)#switchport access vlan 20Switch1(config-if)#exit步骤2.把交换机Swich0和Swich1相连的端口定义为tag vlan模式SwitchA(config)#interface fastEthernet 0/24SwitchA(config-if)#switchport mode trunk!将F0/24端口定义为tag vlan模式验证测试:验证F0/24端口已被设为tag vlan模式SwitchA#show
5、 interfaces fastEthernet 0/24 switchportInterface Switchport Mode Access Native Protected VLAN lists- - - - - - -Fa0/24 Enabled Trunk 1 1 Disabled All步骤3.在交换机Swich1上创建vlan 10,并将0/5端口划分到vlan 10中.SwichB(config)#vlan 10SwichB(config-vlan)#name salseSwichB(config-vlan)#exitSwichB(config)#interface fastE
6、thernet 0/5SwichB(config-if)#switchport access vlan 10步骤4.把交换机Swich0和Swich1相连的端口定义为tag vlan模式SwichB(config)#interface fastEthernet 0/24SwichB(config-if)#switchport mode trunk验证测试:验证F0/24端口已被设置为tag vlan模式SwichB#show interfaces fastEthernet 0/24 switchportInterface Switchport Mode Access Native Protec
7、ted VLAN lists- - - - - - -Fa0/24 Enabled Trunk 1 1 Disabled All步骤5.验证PC0与PC2能相互通信,但PC0和PC1不能相互通信。C:Documents and SettingsAdministratorping 192.168.10.30 !在PC1的命令行方式下能ping通PC3Pinging 192.168.10.30 with 32 bytes of data:Reply from 192.168.10.30: bytes=32 time1ms TTL=128Reply from 192.168.10.30: bytes
8、=32 time1ms TTL=128Reply from 192.168.10.30: bytes=32 time1ms TTL=128Reply from 192.168.10.30: bytes=32 timeping 192.168.10.30 !在PC1的命令行方式下验证不能ping通PC2Pinging 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
9、: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),步骤6.设置三层交换机VLAN间通信Switch1(config)#interface vlan 10 !创建虚拟接口vlan 10Switch1(config-if)#ip address 192.168.10.254 255.255.255.0 !配置虚拟接口vlan 10 的地址为192.168.10.254Switch1(config-if)#no shutdown !开启端口2009-05-23 16:42:39 5-CONFIG:Configured from outba
10、ndSwitch1(config-if)#exit2009-05-23 16:42:42 5-CONFIG:Configured from outbandSwitch1(config)#interface vlan 20 !创建虚拟接口vlan 202009-05-23 16:42:46 5-CONFIG:Configured from outbandSwitch1(config-if)#ip address 192.168.20.254 255.255.255.0 !配置虚拟接口的地址为192.168.20.2542009-05-23 16:43:06 5-CONFIG:Configured
11、 from outbandSwitch1(config-if)#no shutdown !开启端口2009-05-23 16:43:09 5-CONFIG:Configured from outbandSwitch1(config-if)#exit2009-05-23 16:43:15 5-CONFIG:Configured from outband验证测试:查看S3550路由器的状态Switch1#show ip interface !查看IP接口的状态Interface : VL10Description : Vlan 10OperStatus : upManagementStatus :
12、 EnabledPrimary Internet address: 192.168.10.254/24Broadcast address : 255.255.255.255PhysAddress : 00d0.f8b8.289cInterface : VL20Description : Vlan 20OperStatus : upManagementStatus : EnabledPrimary Internet address: 192.168.20.254/24Broadcast address : 255.255.255.255PhysAddress : 00d0.f8b8.289b步骤
13、7.将PC0和PC2的网关设置为192.168.10.254,将PC1的默认网关设置成192.168.20.254测试结果:不同vlan间的主机可以相互ping通参考配置Swich1#show running-config !显示交换机Swich1的全部配置System software version : 2.41(4) Build Nov 23 2005 ReleaseBuilding configuration.Current configuration : 413 bytes!version 1.0!hostname Swich1vlan 1!vlan 10 name sales!vl
14、an 20 name technical!interface 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 255.255.255.0!interface Vlan 20 ip address 192.168.20.254 255.255.255.0!endSwi
15、ch0#show running-config !显示交换机Swich0的全部配置System software version : 1.61(2) Build Aug 31 2005 ReleaseBuilding configuration.Current configuration : 194 bytesversion 1.0!hostname Swich0vlan 1!vlan 10 name salse!interface fastEthernet 0/5 switchport access vlan 10!interface fastEthernet 0/24 switchport
16、 mode trunk!End验证:PC0 ping PC1【注意事项】1.两台交换机之间相连的端口应该设置为tag vlan模式2.需要设置PC的网关若拓扑结构改成如下:表2 设备基本信息设备名端口及所属VLANIP信息IP地址网关Switch 3560Fa 0/24 默认VLANSwitch0 2960Fa 0/24 默认VLANSwitch1 2960Fa 0/23 默认VLANPC0Fa 0/5 VLAN 10192.168.10.10/24192.168.10.254/24PC1Fa 0/15 VLAN 20192.168.20.20/24192.168.20.254/24PC2Fa 0/5 VLAN 10192.168.10.30/24192.168.10.254/24PC3Fa 0/15 VLAN 20192.168.20.40/24192.168.20.254/24Laptop0Fa 0/5 VLAN 10192.168.10.50/24192.168.10.254/24Laptop1Fa 0/15 VLAN 30192.168.30.60/24192.168.30.254/24专心-专注-专业