A-A+

cisco路由器基本实验之六 CHAP and RIP (Boson NetSim)

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

昨天下午做了这个实验,在实验过程中,也第一次用到了Dynamips这个软件(由众博友推荐),它确实是可以模拟出cisco路由器的硬件环境,然后直接在这个环境下运行cisco的IOS,呵呵,初次使用,不是很灵活,但经过整整一下午,也掌握了它的使用方法(以后有些实验估计boson netsim会有些命令没有),但是今天的实验还是贴出在boson netsim上配置的情况,但会贴一张Dynamips下的图。

先说说ppp和chap,ppp(point to point protocol)是点到点型线路的数据链路层协议, 它支持在各种物理类型的点到点串行线路上传输上层协议报文,而chap则是ppp可选的身份认证协议之一,另外一种叫pap,好像安全性不及chap。下面看实验。

在配置的时候需要注意的是:要分别在r1和r2上的全局模式下用username ** password ##来为本地口令数据库添加记录,而此处的**应该是对端路由器的名字,##则为设定的密码,两个路由器的该命令要写同一密码。如下所示:

r1(config)#username r2 password cisco

r2(config)#username r1 password cisco;

接下来看详细的配置情况:

1.1 在r1上show run

  1. r1#show run  
  2. Building configuration...  
  3. !  
  4. Version 12.1  
  5. service timestamps debug uptime  
  6. service timestamps log uptime  
  7. no service password-encryption  
  8. !  
  9. hostname r1  
  10. !  
  11. username r2 password cisco  
  12. !  
  13. !  
  14. !  
  15. ip subnet-zero  
  16. !  
  17. !  
  18. !  
  19. !  
  20. !  
  21. !  
  22. !  
  23. !  
  24. !  
  25. !  
  26. interface Serial0  
  27.  ip address 192.168.2.1 255.255.255.0  
  28.  no ip directed-broadcast  
  29.  clock rate 64000  
  30.   
  31.   
  32.  encapsulation ppp  
  33.  ppp authentication chap  
  34. !  
  35. interface Ethernet0  
  36.  ip address 192.168.1.2 255.255.255.0  
  37.  no ip directed-broadcast  
  38. !  
  39. !  
  40. router rip  
  41.  network 192.168.1.0  
  42.  network 192.168.2.0  
  43. !  
  44. ip classless  
  45. no ip http server  
  46. !  
  47. !  
  48. !  
  49. line con 0  
  50.  transport input none  
  51. line aux 0  
  52. line vty 0 4  
  53. !  
  54. no scheduler allocate  
  55. end  

1.2 在r1上show ip route

  1. r1#show ip route  
  2. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  5.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default  
  6.        U - per-user static route   
  7. Gateway of last resort is not set  
  8.      192.168.1.0/24 is subnetted, 1 subnets  
  9. C       192.168.1.0 is directly connected, Ethernet0  
  10.      192.168.2.0/24 is subnetted, 1 subnets  
  11. C       192.168.2.0 is directly connected, Serial0  
  12.      192.168.3.0/24 is subnetted, 1 subnets  
  13. R       192.168.3.0 [120/1] via 192.168.2.2, 00:05:25, Serial0  

1.3在r1上show ip pro

  1. r1#show ip pro  
  2. Routing Protocol is "rip"   
  3.   Sending updates every 30 seconds, next due in 17 seconds  
  4.   Invalid after 180 seconds, hold down 180, flushed after 240  
  5.   Outgoing update filter list for all interfaces is  
  6.   Incoming update filter list for all interfaces is  
  7.   Redistributing:   rip  
  8.   Default version control: send version 1, receive any version   
  9.     Interface        Send  Recv   Key-chain  
  10.     Serial0            1    1 2  
  11.     Ethernet0          1    1 2  
  12.   Routing for Networks:  
  13.     192.168.1.0  
  14.     192.168.2.0  
  15.   Routing Information Sources:  
  16.     192.168.2.2           120      00:00:09  
  17.   Distance: (default is 120)  

2.1 在r2上show run

  1. r2# show run  
  2. Building configuration...  
  3. !  
  4. Version 12.1  
  5. service timestamps debug uptime  
  6. service timestamps log uptime  
  7. no service password-encryption  
  8. !  
  9. hostname r2  
  10. !  
  11. username r1 password cisco  
  12. !  
  13. !  
  14. !  
  15. ip subnet-zero  
  16. !  
  17. !  
  18. !  
  19. !  
  20. !  
  21. !  
  22. !  
  23. !  
  24. !  
  25. !  
  26. interface Serial0  
  27.  ip address 192.168.2.2 255.255.255.0  
  28.  no ip directed-broadcast  
  29.  encapsulation ppp  
  30.  ppp authentication chap  
  31. !  
  32. interface Ethernet0  
  33.  ip address 192.168.3.1 255.255.255.0  
  34.  no ip directed-broadcast  
  35. !  
  36. !  
  37. router rip  
  38.  network 192.168.2.0  
  39.  network 192.168.3.0  
  40. !  
  41. ip classless  
  42. no ip http server  
  43. !  
  44. !  
  45. !  
  46. line con 0  
  47.  transport input none  
  48. line aux 0  
  49. line vty 0 4  
  50. !  
  51. no scheduler allocate   
  52. end  

2.2 在r2上show ip route

  1. r2# show ip route  
  2. Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP  
  3.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area  
  4.        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP  
  5.        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default  
  6.        U - per-user static route  
  7. Gateway of last resort is not set  
  8.      192.168.2.0/24 is subnetted, 1 subnets  
  9. C       192.168.2.0 is directly connected, Serial0  
  10.      192.168.1.0/24 is subnetted, 1 subnets  
  11. R       192.168.1.0 [120/1] via 192.168.2.1, 00:07:18, Serial0  
  12.      192.168.3.0/24 is subnetted, 1 subnets  
  13. C       192.168.3.0 is directly connected, Ethernet0   

2.3 在r2上show pro

  1. r2#show ip pro  
  2. Routing Protocol is "rip"   
  3.   Sending updates every 30 seconds, next due in 17 seconds  
  4.   Invalid after 180 seconds, hold down 180, flushed after 240  
  5.   Outgoing update filter list for all interfaces is  
  6.   Incoming update filter list for all interfaces is  
  7.   Redistributing:   rip  
  8.   Default version control: send version 1, receive any version  
  9.     Interface        Send  Recv   Key-chain  
  10.     Serial0            1    1 2  
  11.     Ethernet0          1    1 2  
  12.   Routing for Networks:  
  13.     192.168.2.0  
  14.     192.168.3.0  
  15.   Routing Information Sources:  
  16.     192.168.2.2           120      00:00:09  
  17.   
  18.   
  19.   Distance: (default is 120)  

在这样配置之后,本来是可以用debug ppp authentication 这个命令来看到r1和r2之间发送数据包来进行身份认证过程的,但是在boson netsim上输入该命令之后,并不报错,但也没有任何的反应,我想这可能是boson 的bug吧,于是我就换用了Dynamips,在正确配置之后,我也输入了debug ppp authentication 这个命令,但是它就只出现了一条 ppp authentication debug is on之后也就没反应了,难道是由于二者一次性的就认证成功了,所以不现出来了?(希望博友们给予指点)。我在Dynamips下用debug ip rip命令并截了一张图,如下所示:

从这个图可以看到RIP协议的路由学习过程,它通过接收邻居路由器发来的udp包对路由进行学习和更新,如上图中的:

network 192.168.2.0 metric 1

network 192.168.2.0 metric 2

就是R1学习到的关于192.168.2.0和192.168.3.0这两个网络的路由信息。

从pc2上使用 tracert 192.168.1.1也可以清楚的看出从pc2到pc1的路由情况,如下所示:

以前只是从书上知道RIP的工作原理,但这次通过实验亲眼见到了其学习的过程,感觉还是受益匪浅的。

标签:

给我留言