资源描述
网络工程教学案例基于 PT 广东韶关学院 王为群编 1 案例 33:单臂路由实现 VLAN 间路由 1.案例目标 通过本案例,你可以掌握如下技能:1)路由器以太网接口上的子接口 2)单臂路由实现 VLAN 间路由的配置 2.设备与拓扑 设备:1 台 2960 交换机,1 台 1841 路由器,2 台 PC。拓扑:如下图。3.操作步骤 步骤 1:按拓扑图配置好交换机和路由器的主机名和显示名,注意按照拓扑图的接口编号连接各接口,并配置好主机的 IP 地址。步骤 2:将交换机与路由器之间的链路设置为 trunk 网络工程教学案例基于 PT 广东韶关学院 王为群编 2 S1(config)#int range f0/1 S1(config-if)#switchport mode trunk S2(config-if)#步骤 3:创建和划分 VLAN 1)创建 VLAN S1#conf t Enter configuration commands,one per line.End with CNTL/Z.S1(config)#vlan 2 S1(config-vlan)#exit S1(config)#vlan 3 S1(config-vlan)#end S1#2)划分 VLAN 端口 S1#conf t Enter configuration commands,one per line.End with CNTL/Z.S1(config)#int f0/5 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 2 S1(config-if)#int f0/6 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 3 S1(config-if)#end S1#步骤 4:验证连通性 可测试 PC0 与 PC1 之间的连通性,由于路由器尚未配置,ping 应失败。步骤 5:配置路由器 1)为 VLAN 2 和 VLAN3 配置子接口 R1#conf t Enter configuration commands,one per line.End with CNTL/Z.R1(config)#int f0/0 网络工程教学案例基于 PT 广东韶关学院 王为群编 3 R1(config-if)#no shut R1(config-if)#exit R1(config)#int f0/0.2 R1(config-subif)#encapsulation dot1Q 2 R1(config-subif)#ip addr 172.16.1.1 255.255.255.0 R1(config-subif)#int f0/0.3 R1(config-subif)#encapsulation dot1Q 3 R1(config-subif)#ip addr 172.16.2.1 255.255.255.0 R1(config-subif)#end R1#2)验证 R1 的路由表 R1#sh ip ro 172.16.0.0/24 is subnetted,2 subnets C 172.16.1.0 is directly connected,FastEthernet0/0.2 C 172.16.2.0 is directly connected,FastEthernet0/0.3 R1#步骤 6:再次验证连通性 在 PC0 上 ping PC1,应如下 ping 通。PCping 172.16.2.2 Pinging 172.16.2.2 with 32 bytes of data:Reply from 172.16.2.2:bytes=32 time=125ms TTL=127 Reply from 172.16.2.2:bytes=32 time=125ms TTL=127 Reply from 172.16.2.2:bytes=32 time=125ms TTL=127 Reply from 172.16.2.2:bytes=32 time=109ms TTL=127 Ping statistics for 172.16.2.2:Packets:Sent=4,Received=4,Lost=0(0%loss),Approximate round trip times in milli-seconds:Minimum=109ms,Maximum=125ms,Average=121ms PC
展开阅读全文