A-A+

把一台Cisco思科路由器配置成静态路由的实验

2015年11月20日 站长资讯 暂无评论

今天要做的实验,是把一台Cisco思科路由器配置成静态路由,通过这次动手操作,可以熟悉和了解不少内容,包括DCE端时钟设置、ip router命令使用、路由表的概念,还可以对正确的配置一台路由更加熟练。

这次实验的拓扑图如下所示:

实验步骤如下:

我们要使PC0跟PC1网络能够相互通信,按如下所述操作。

步骤1:在各个路由器上配置IP地址,保证直连链路的连通性。

R0设置ip地址

  1. Router>en  
  2.   
  3. Router#conf t  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#hostname R0  
  8.   
  9. R0(config)#interface f0/0  
  10.   
  11. R0(config-if)#ip add 192.168.1.1 255.255.255.0  
  12.   
  13. R0(config-if)#no shutdown   
  14.   
  15. %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up  
  16.   
  17. R0(config-if)#exit  
  18.   
  19. R0(config)#interface serial 0/1/0  
  20.   
  21. R0(config-if)#ip add 10.1.0.1 255.255.255.0  
  22.   
  23. R0(config-if)#no shutdown   
  24.   
  25. %LINK-5-CHANGED: Interface Serial0/1/0, changed state to down  
  26.   
  27. R0(config-if)#end  
  28.   
  29. R0#show controllers serial0/1/0         (查看DCE端命令)  
  30.   
  31. Interface Serial0/1/0  
  32.   
  33. Hardware is PowerQUICC MPC860  
  34.   
  35. DCE V.35, TX and RX clocks detected    (红色表示为DCE端)  
  36.   
  37. idb at 0x81081AC4, driver data structure at 0x81084AC0  
  38.   
  39. SCC Registers:  
  40.   
  41. General [GSMR]=0x2:0x00000000, Protocol-specific [PSMR]=0x8  
  42.   
  43. Events [SCCE]=0x0000, Mask [SCCM]=0x0000, Status [SCCS]=0x00  
  44.   
  45. Transmit on Demand [TODR]=0x0, Data Sync [DSR]=0x7E7E  
  46.   
  47. Interrupt Registers:  
  48.   
  49. ......  
  50.   
  51. R0(config)#interface serial 0/1/0  
  52.   
  53. R0(config-if)#clock rate 4800           (在DCE端配置时钟)  

R1配置如下

  1. R1(config)#interface serial 0/1/0  
  2.   
  3. R1(config-if)#ip add 10.1.0.2 255.255.255.0  
  4.   
  5. R1(config-if)#no shutdown  
  6.   
  7. R1(config-if)#exit  
  8.   
  9. R1(config)#interface serial 0/1/1  
  10.   
  11. R1(config-if)#ip add 10.2.0.1 255.255.255.0  
  12.   
  13. R1(config-if)#no shutdown  

R2配置如下

  1. R2(config)#interface serial 0/1/1  
  2.   
  3. R2(config-if)#ip add 10.2.0.2 255.255.255.0  
  4.   
  5. R2(config-if)#no shutdown  
  6.   
  7. R2(config-if)#exit  
  8.   
  9. R2(config)#interface serial 0/1/0  
  10.   
  11. R2(config-if)#clock rate 4800    
  12.   
  13. R2(config-if)#ip add 192.168.2.1 255.255.255.0  
  14.   
  15. 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上查看路由表

  1. R2#show ip route   
  2.   
  3. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  4.   
  5.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  6.   
  7.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  8.   
  9.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  10.   
  11.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area  
  12.   
  13.        * - candidate default, U - per-user static route, o - ODR  
  14.   
  15.        P - periodic downloaded static route  
  16.   
  17. Gateway of last resort is not set  
  18.   
  19.      10.0.0.0/24 is subnetted, 2 subnets  
  20.   
  21. S       10.1.0.0 [1/0] via 10.2.0.1           (S表示静态路由,C表示直连网络)  
  22.   
  23. C       10.2.0.0 is directly connected, Serial0/3/0  
  24.   
  25. S    192.168.1.0/24 is directly connected, Serial0/3/0  
  26.   
  27. C    192.168.2.0/24 is directly connected, FastEthernet0/0  

在R1上查看路由表

  1. http://www.xiaoxiongboke.com   
  2.   
  3. R1#show ip route   
  4.   
  5. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  6.   
  7.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  8.   
  9.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  10.   
  11.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  12.   
  13.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area  
  14.   
  15.        * - candidate default, U - per-user static route, o - ODR  
  16.   
  17.        P - periodic downloaded static route  
  18.   
  19. Gateway of last resort is not set  
  20.   
  21.      10.0.0.0/24 is subnetted, 2 subnets  
  22.   
  23. C       10.1.0.0 is directly connected, Serial0/1/0  
  24.   
  25. C       10.2.0.0 is directly connected, Serial0/1/1  
  26.   
  27. S    192.168.1.0/24 [1/0] via 10.1.0.1  
  28.   
  29. S    192.168.2.0/24 [1/0] via 10.2.0.2  

在R0上查看路由表

  1. R0#show ip route   
  2.   
  3. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  4.   
  5.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  6.   
  7.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  8.   
  9.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  10.   
  11.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area  
  12.   
  13.        * - candidate default, U - per-user static route, o - ODR  
  14.   
  15.        P - periodic downloaded static route  
  16.   
  17. Gateway of last resort is not set  
  18.   
  19.      10.0.0.0/24 is subnetted, 2 subnets  
  20.   
  21. C       10.1.0.0 is directly connected, Serial0/1/0  
  22.   
  23. S       10.2.0.0 [1/0] via 10.1.0.2  
  24.   
  25. C    192.168.1.0/24 is directly connected, FastEthernet0/0  
  26.   
  27. 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

<3>实验总结:

1.在写静态路由时,如果是点对点链路(如PPP封装的链路)采用网关地址和接口都是可以的

2.注意:如果是链路多路访问链路(如以太网)只可采用网关地址,即不能用

R2(config)#ip route 192.168.1.0 255.255.255.0 Serial0/3/0

标签:

给我留言