1、实验四路由交换综合实验实验四 Packet Tracer路由交换综合实验实验要求:使用Packet Tracer模拟器搭建实验拓扑,并对交换机、路由器、PC和服务器进行相应配置,配置最后结果,能实现PC之间的ping互通,能通过PC的浏览器访问服务器网站。配置步骤如下:Stepl :搭建实验拓扑如下图所示:PC1-VLAH10 PC1-VLAN2Cr. 7 40. 2CO/24S&irvr-PTSei Ver 0LTZIT. 20.Step2 :规划各设备的IP地址,设备接口IP地址网关R1Fa0/0172. 17. 10. 1/24FaO/1172. 17. 20. 1/24Fal/0192
2、. 168. 12. 1/24R2Fa0/0172. 17. 30. 1/24FaO/1172. 17. 40. 1/24Fal/0192. 168. 12. 2/24Fal/1209. 165. 201. 1/24172.17. M. 200/2 八如下表所示:PCI快速以太网口172. 17. 10. 100/24172. 17. 10. 1PC2快速以太网口172. 17. 20. 100/24172. 17.20. 1PC3快速以太网口172. 17. 30. 200/24172. 17. 30. 1PC4快速以太网口172. 17. 40. 200/24172. 17. 40. 1S
3、ERVER快速以太网口209. 165. 201. 254/24209. 165. 201. 1请注意:在配置PC机的IP地址时,切记一定要配网关 IP地址。Step3 :路由器及交换机基本配置:一、配置路由器Rl、R2,交换机SI、S2的主机名分别为Routerl Router2、SwitchKSwitch2。Switche nableSwitch#c on figure terminalEnter con figurati on comma nds, one per line.Switch(config)#hostname Switch 1Switchl (config)#Switche
4、nableSwitch#c on figure terminalEnter con figurati on comma nds, one per line.Switch(config)#hostname Switch2Switch2(config)#Routere nableRouter #configure terminalEnter configurati on comma nds, one per line.Router (config)#hostname RouterlRouterl (config)#Routere nableRouter #configure terminalEnt
5、er configurati on comma nds, one per line.Router (config)#hostname Router2Router2 (config)#End with CNTL/Z.End with CNTL/Z.End with CNTL/Z.End with CNTL/Z.根据IP地址规划表配置各设备IP地址、掩码、网关。Routerl#Routerlconfigure terminal厂 , n. End with CNTL/Z.Enter configuration commands, one per lineRouterl (config)#inter
6、face FastEthernetO/ORouterl(config-if)#exitRouterl(config)#int f1/0Router 1 (conf ig-if)#ip add 192. 168. 12. 1 255. 255. 255. 0Routerl(config-if)#no shutRouter1(config-if)ttexitRouter1(config)#int f0/0Router 1 (conf ig-if)#ip add 172. 17. 10. 1 255. 255. 255. 0Routerl(config-if)#no shutRouterl(conf
7、ig-if)#exitRouterl(config)#int fO/1Router 1 (conf ig-if)#ip add 172. 17. 20. 1 255. 255. 255. 0Routerl(config-if)#no shutRouter1(config-if)#Router2# End with CNTL/Z.Router2#configure terminalEnter configuration commands, one per lineRouter2 (config冲interface FastEthernetO/0 Router2(config-if)ftexitR
8、outer2(config)#int f1/0Router2 (config-if) #ip add 192. 168. 12.2 255.255.255.0Router2(config-if)#no shutRouter2(config-if)#exitRouter2(config)Sint f0/0Router2 (config-if) #ip add 172. 17. 30. 1 255. 255. 255. 0Router2(config-if)#no shutRouter2(config-if)#exitRouter2(config)Sint f0/lRouted (config -
9、辻)#ip add 172. 17. 40. 1 255. 255. 255. 0Router2(config-if)#no shutRouter(config-if)#exitRouter (config)ttinterface FastEthernet1/1Router(config-if)#ip address 209 165.201 1 255255.255.0Router (conf ig-if) it no shutRouter2 (conf ig-if) #Step4 :交换机VLAN配置:一、在交换机S1上创建两个VLAN :1.VLAN 10 , VLAN 名称为 sales
10、。Switchl(config)#vlan 10Switchl(config-vlan)#name salesSwitchl(config-vlan)#exitSwitchl(config)#2.VLAN 20 , VLAN 名称为 faculty。Switchl(config)#vlan 20Switchl(config-vlan)#name facultySwitchl(config-vlan)#exitSwitchl(config)#3.将fa0/l、faO/23配置为access模式,并将它们划分为VLAN 10的成员。Switchl(config)ttinterface FastEt
11、hernetO. 1Switchl(config-if)ftswitchport access vlan 10Switchl(config-if)#Switchl(config)ttinterface FastEthernetO/23Switchl(config-if)#switchport access vlan 104.将faO/2、faO/24配置为access模式,并将它们划分为VLAN 20的成员。Switchl(config)ttinterface FastEthernetO/2Switchl(config-if)ftswitchport access vlan 20Switchl
12、(config)#interface FastEthernetO/24Switchl(config-if)ftswitchport access vlan 20二、在交换机S2上创建两个VLAN :1.VLAN 30 , VLAN 名称为 management。Switch2(config)ttvlan 30Switch2(config-vlan)#name managementSwitch2(config-vlan)#exitSwitch2(config)#2.VLAN 40 , VLAN 名称为 partner。Switch2(config)ttvlan 40Switch2(config-
13、vlan)ttname partnerSwitch2(config-vlan)#exitSwitch2(config)tt3.将fa0/l、faO/23配置为access模式,并将它们划分为VLAN 30的成员。Switch2(config)interface FastEthernetO/1Switch2(config-if)#switchport access vlan 30Switch2(config-if)#exitSwitch2(config)interface FastEthernetO/23Switch2(config-if)#switchport access vlan 30Sw
14、itch2(config-if)ttexit4.将faO/2、faO/24配置为access模式,并将它们划分为VLAN 40的成员。Switch2 (config) ttinterface FastEthernetO/2Switch2 (config-if)Sswitchport access vlan 40Switch2(config-if)#exitSwitch2 (config) ttinterface FastEthernetO,24Switch2 (config-if)#switchport access vlan 40Step5 :路由器动态路由协议配置在两个路由器上启动0SPF
15、协议,将各接口直连网络用network命令发布。配置0SPF协议的步骤如下:R1的配置:1.全局模式下启动OSPF协议R1 (co router ospf 1Router1(config)#route ospf 1Router1(config-router)#解释:命令格式上 1启动OSPF协议与启动RIP协议类似,但router OSPF后面多出了一个进程号(ID为1),该进程号仅具有本地意义,各路由器上的进程号可以不一样。回 车后进入路由配置模 Router (c on fig-router)。2.使用network命令发布网络。R1 (c on fig- 简写net 192. 168.
16、12. 0 0. 0. 0. 255 area 0 ; net 是 network 的R1 (c on fig- rniit pr) itnet 172. 17. 10. 0 0. 0. 0. 255 area 0R1 (c on fig-router)#net 172. 17. 20. 0 0. 0. 0. 255 area 0解释:OSPF协议在发布网络的时候可以做到精确发布,可以看到 netw ork 命令后面不止携带了网络地址, 还有如0. 0. 0. 255这样的通配符。从通配符的形式上可以看出, 它是子网掩码的反码形式,用 255. 255. 255. 255 减去子网掩码即可得到
17、通配符。另外,OSPF作为一个层次化的路由协议,还需要指明运行协议的区域。一个复杂的OSPF网络(自治系统)中会包含多个区域,它们之间用区域号来进行区分,每个区域中运 行各自的OSPF协议实例,区域之间通过 ABR连接主干区域进行交互,而主干区域总是area 0。本实验中我们只进行单区域的 OSPF配置,默认使用区域0在R2上进行相同的配置。R2(c on figrouter)#net 192. 168. 12. 0 0. 0. 0. 255 area 0net 209. 165. 201. 0 0. 0. 0. 255 area 03.在路由模式下配置路由器被动接口。解释:若路由器接口连接的
18、是终端设备诸如 PC、SERVER,则不用向该网络通告动态路由更新,只有与屮间设备(诸如路由器)交互路由更新才是有意义的。把路由器屮连接终 端设备的 接口配置为被动接口,将不会向接口直连网络通告路由更新,这样可以降低流量,提高性能。配置被动接口的方法是:在路由模式下使用 passive-i nterface in terface命 令。对于本实验拓扑中的两个路由器, 除了其互连的fal/O 口之外,其他接口均可配置为被动接口。R1上的被动接口配置如下:R1 (c on fig-router)#passivei nterface faO/OR1 (c on fig-router)#passive
19、i nterface faO/1根据拓扑,在R2上配置相应的被动接口。R2上的被动接口配置如下:R2 (c on fig-router)#passivei nterface faO/OR2(c on fig-router)#passivei nterface faO/1R2 (c on fig-router)#passivei nterface fal/1Step6 :验证配置结果。三、在各设备中使用show命令查看配置结果,可以使用的命令如:1.show run :查看运行配置。router ospf 1log-adjacency-changes passive-interface Fast
20、Ethernet0/0passive-interface FastEthernetO. 1 network 192. 168. 12. 0 0. 0. 0. 255 area 0 network 172. 17. 10. 0 0. 0. 0. 255 area 0network 172. 17. 210. 0 0. 0. 0. 255 area 0i2.show ip route : 查看路由表。RouterlSsho ip routCodes: C - connected, S - static, I - IGRP , R - RIP, M - mobile, B - BGPD - ElGR
21、P , EX - ElGRP external, 0 - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 El - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, LI - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U 一 per-user static rou
22、te, o - ODR P - periodic downloaded static routeGateway of last resort is not set172 17.0.0/24 is subnetted, 2 subnetsC 172 17. 10.0 is directly connected, FastEthernetO, 0C 172 17.20.0 is directly connected, FastEthernetO/1C 192.168.12. 0/24 is directly connected, FastEthernetl/0Router1#3.show vlan
23、 brief :查看 VLAN 分配情况。Routerlttsh vlan briefVLAN Name Status Portsactiveactive1 defauIt1002 fddi-defaultactiveactive1004 fddinet-default 1005 trnet一defauItRouterl#4.show ip int brief :查看接口 IP地址配置情况。Routerlttsh ip int briefInterfaceIP-AddressOK? Method StatusProtocoFastEthernetO/0172. 17. 10. 1YES man
24、ual upupFastEthernetO/1172. 17. 20. 1YES manual upupFastEthernet1/0192. 168. 12. 1YES manual upupFastEthernet1/1unassignedYES unset administratively down downVlanlunassignedYES unset administratively down downRouterl#四、使用ping命令验证连通性。5.show interface interface :查看单个接口配置情况。1.PC1与其他PC之间的连通性。在路由器上运行路由协议后,可以实现不同VLAN间的通信。2.各PC和网关、路由器接口、服务器之间的连通性。3.在PC的web browser中的地址栏键入SERVER的IP地址209. 165.201.254 , 可以访问SERVER网站(web browser中出现网页显示)。三、记录自己的配置步骤和结果。欢迎下载,谢谢观看!资料仅供参考学习