A-A+

第二篇:配置静态路由、基本IP通讯、ping测试、查看路由表的方法

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

建立如下图所示的机架模型,我这里用到的是GNS3模拟器!以后我也将利用这款模拟器来完成我们的学习教程!

第一步:基本IP通讯配置!

  1. R1>en                          -------------进入特权模式  
  2. R1#conf t                      ---------------进入全局模式   
  3. Enter configuration commands, one per line.  End with CNTL/Z.  
  4. R1(config)#int s0/0                -----------------------进入接口  
  5. R1(config-if)#no sh                  -----------------------激活接口  
  6. R1(config-if)#ip add 192.168.12.1 255.255.255.0             ---------------------配置IP   
  7. R1(config-if)#clock rate 64000                                    -----------------------配置时钟  
  8. R1(config-if)#exit  
  9. R1(config)#int s0/1  
  10. R1(config-if)#no sh  
  11. R1(config-if)#ip add 192.168.13.1 255.255.255.0  
  12. R1(config-if)#clock rate 64000  
  13. R1(config-if)#end  
  14. R1#  
  15. ----------------  
  16.   
  17. R2>en  
  18. R2#conf t  
  19. Enter configuration commands, one per line.  End with CNTL/Z.  
  20. R2(config)#int s0/0  
  21. R2(config-if)#no sh  
  22. R2(config-if)#ip add 192.168.12.2 255.255.255.0  
  23. R2(config-if)#exit  
  24. R2(config)#end  
  25. R2#  
  26.   
  27. R3>en  
  28. R3#conf t  
  29. Enter configuration commands, one per line.  End with CNTL/Z.  
  30. R3(config)#int s0/1  
  31. R3(config-if)#no sh  
  32. R3(config-if)#ip add 192.168.13.3 255.255.255.0  
  33. R3(config-if)#end  
  34. R3#  

第二步:ping测试!

  1. R3#ping 192.168.12.2  
  2.   
  3. Type escape sequence to abort.  
  4. Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:  
  5. .....  
  6. Success rate is 0 percent (0/5)  
  7. R3#  
  8.   
  9. -----------  
  10.   
  11. R2#ping 192.168.13.1  
  12.   
  13. Type escape sequence to abort.  
  14. Sending 5, 100-byte ICMP Echos to 192.168.13.1, timeout is 2 seconds:  
  15. .....  
  16. Success rate is 0 percent (0/5)  
  17. R2#  

从上面可以看出,R2路由器 与 R3路由器互相ping测试未能ping通!出现“!”才算ping通!

第三步:查看路由表!

  1. R1#sh ip route  
  2. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  5.        E1 - OSPF external type 1, E2 - OSPF external type 2  
  6.        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  
  7.        ia - IS-IS inter area, * - candidate default, U - per-user static route  
  8.        o - ODR, P - periodic downloaded static route  
  9.   
  10. Gateway of last resort is not set  
  11.   
  12. C    192.168.12.0/24 is directly connected, Serial0/0  
  13. C    192.168.13.0/24 is directly connected, Serial0/1             --------两条直连路由  
  14. R1#  
  15.   
  16. R2#sh ip route  
  17. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  18.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  19.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  20.        E1 - OSPF external type 1, E2 - OSPF external type 2  
  21.        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  
  22.        ia - IS-IS inter area, * - candidate default, U - per-user static route  
  23.        o - ODR, P - periodic downloaded static route  
  24.   
  25. Gateway of last resort is not set  
  26.   
  27. C    192.168.12.0/24 is directly connected, Serial0/0  
  28. R2#  
  29.   
  30. R3#sh ip route  
  31. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  32.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  33.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  34.        E1 - OSPF external type 1, E2 - OSPF external type 2  
  35.        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  
  36.        ia - IS-IS inter area, * - candidate default, U - per-user static route  
  37.        o - ODR, P - periodic downloaded static route  
  38.   
  39. Gateway of last resort is not set  
  40.   
  41. C    192.168.13.0/24 is directly connected, Serial0/1  
  42. R3#  

第四步:配置静态路由!

  1. R2#conf t  
  2. Enter configuration commands, one per line.  End with CNTL/Z.  
  3. R2(config)#ip route 192.168.13.0 255.255.255.0 192.168.12.1  
  4. R2(config)#end  
  5.   
  6. ----------------------  
  7.   
  8. R3#conf t  
  9. Enter configuration commands, one per line.  End with CNTL/Z.  
  10. R3(config)#ip route 192.168.12.0 255.255.255.0 192.168.13.1  
  11. R3(config)#end  
  12. R3#  

第五步:查看路由表!

  1. R1#sh ip route  
  2. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  5.        E1 - OSPF external type 1, E2 - OSPF external type 2  
  6.        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  
  7.        ia - IS-IS inter area, * - candidate default, U - per-user static route  
  8.        o - ODR, P - periodic downloaded static route  
  9.   
  10. Gateway of last resort is not set  
  11.   
  12. C    192.168.12.0/24 is directly connected, Serial0/0  
  13. C    192.168.13.0/24 is directly connected, Serial0/1  
  14. R1#  
  15.   
  16. R2#sh ip route  
  17. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  18.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  19.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  20.        E1 - OSPF external type 1, E2 - OSPF external type 2  
  21.        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  
  22.        ia - IS-IS inter area, * - candidate default, U - per-user static route  
  23.        o - ODR, P - periodic downloaded static route  
  24.   
  25. Gateway of last resort is not set  
  26.   
  27. C    192.168.12.0/24 is directly connected, Serial0/0  
  28. S    192.168.13.0/24 [1/0] via 192.168.12.1                         ---------------配置的静态路由  
  29. R2#  
  30. R3#sh ip route  
  31. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  32.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  33.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  34.   
  35.   
  36.        E1 - OSPF external type 1, E2 - OSPF external type 2  
  37.        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  
  38.        ia - IS-IS inter area, * - candidate default, U - per-user static route  
  39.        o - ODR, P - periodic downloaded static route  
  40. Gateway of last resort is not set  
  41.   
  42. S    192.168.12.0/24 [1/0] via 192.168.13.1  
  43. C    192.168.13.0/24 is directly connected, Serial0/1  
  44. R3#  

第六步:再次ping测试!

  1. R3#ping 192.168.12.2  
  2.   
  3. Type escape sequence to abort.  
  4. Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:  
  5. !!!!!  
  6. Success rate is 100 percent (5/5), round-trip min/avg/max = 12/33/68 ms  
  7. R3#  
  8.   
  9. R2#ping 192.168.13.3  
  10.   
  11. Type escape sequence to abort.  
  12. Sending 5, 100-byte ICMP Echos to 192.168.13.3, timeout is 2 seconds:  
  13. !!!!!  
  14. Success rate is 100 percent (5/5), round-trip min/avg/max = 8/43/80 ms  
  15. R2#  

此教程到这里就结束了!如有什么问题请留言!我会尽快回复大家的!谢谢……

标签:

给我留言