今天要做的实验,是把一台Cisco思科路由器配置成静态路由,通过这次动手操作,可以熟悉和了解不少内容,包括DCE端时钟设置、ip router命令使用、路由表的概念,还可以对正确的配置一台路由更加熟练。 这次实验的拓扑图如下所示:
实验步骤如下: 我们要使PC0跟PC1网络能够相互通信,按如下所述操作。 步骤1:在各个路由器上配置IP地址,保证直连链路的连通性。 R0设置ip地址 Router>en Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R0 R0(config)#interface f0/0 R0(config-if)#ip add 192.168.1.1 255.255.255.0 R0(config-if)#no shutdown %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up R0(config-if)#exit R0(config)#interface serial 0/1/0 R0(config-if)#ip add 10.1.0.1 255.255.255.0 R0(config-if)#no shutdown %LINK-5-CHANGED: Interface Serial0/1/0, changed state to down R0(config-if)#end R0#show controllers serial0/1/0 (查看DCE端命令) Interface Serial0/1/0 Hardware is PowerQUICC MPC860 DCE V.35, TX and RX clocks detected (红色表示为DCE端) idb at 0x81081AC4, driver data structure at 0x81084AC0 SCC Registers: General [GSMR]=0x2:0x00000000, Protocol-specific [PSMR]=0x8 Events [SCCE]=0x0000, Mask [SCCM]=0x0000, Status [SCCS]=0x00 Transmit on Demand [TODR]=0x0, Data Sync [DSR]=0x7E7E Interrupt Registers: ...... R0(config)#interface serial 0/1/0 R0(config-if)#clock rate 4800 (在DCE端配置时钟) R1配置如下 R1(config)#interface serial 0/1/0 R1(config-if)#ip add 10.1.0.2 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface serial 0/1/1 R1(config-if)#ip add 10.2.0.1 255.255.255.0 R1(config-if)#no shutdown R2配置如下 R2(config)#interface serial 0/1/1 R2(config-if)#ip add 10.2.0.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface serial 0/1/0 R2(config-if)#clock rate 4800 R2(config-if)#ip add 192.168.2.1 255.255.255.0 R2(config-if)#no shutdown 步骤2:在R0路由器上配置静态路由 R0(config)#ip route 10.2.0.0 255.255.255.0 10.1.0.2 (这里是指R0路由器访问10.2.0.0网段,下一跳IP地址是10.1.0.2) R0(config)#ip route 192.168.2.0 255.255.255.0 Serial0/1/0 (这里是指R0路由器访问 192.168.2.0网段,下一跳接口是R0的Serial0/1/0) 步骤3:R1上配置静态路由 R1(config)#ip route 192.168.1.0 255.255.255.0 10.1.0.1 R1(config)#ip route 192.168.2.0 255.255.255.0 10.2.0.2 步骤4:R2上配置静态路由 R2(config)#ip route 10.1.0.0 255.255.255.0 10.2.0.1 R2(config)#ip route 192.168.1.0 255.255.255.0 Serial0/3/0
试验调试
在R2上查看路由表 R2#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 2 subnets S 10.1.0.0 [1/0] via 10.2.0.1 (S表示静态路由,C表示直连网络) C 10.2.0.0 is directly connected, Serial0/3/0 S 192.168.1.0/24 is directly connected, Serial0/3/0 C 192.168.2.0/24 is directly connected, FastEthernet0/0 在R1上查看路由表 http://www.luyouqiwang.com/14900/ R1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 2 subnets C 10.1.0.0 is directly connected, Serial0/1/0 C 10.2.0.0 is directly connected, Serial0/1/1 S 192.168.1.0/24 [1/0] via 10.1.0.1 S 192.168.2.0/24 [1/0] via 10.2.0.2 在R0上查看路由表 R0#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 2 subnets C 10.1.0.0 is directly connected, Serial0/1/0 S 10.2.0.0 [1/0] via 10.1.0.2 C 192.168.1.0/24 is directly connected, FastEthernet0/0 S 192.168.2.0/24 is directly connected, Serial0/1/0 从PC0上pingPC1地址192.168.2.2
在PC1上ping PC0地址 192.168.1.1
实验总结 1.在写静态路由时,如果是点对点链路(如PPP封装的链路)采用网关地址和接口都是可以的 2.注意:如果是链路多路访问链路(如以太网)只可采用网关地址,即不能用 R2(config)#ip route 192.168.1.0 255.255.255.0 Serial0/3/0 |
不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流
GMT+8, 2025-8-21 01:06 , Processed in 0.072898 second(s), 15 queries .
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.