PPP的配置

本篇文档介绍的是PPP协议的PAP和CHAP认证在Cisco路由器上的配置,配置中涉及的简单命令在这里就不再重复注释了……


图1


一、在路由器Router-A和Router-B上配置、验证并测试PPP PAP(请参考图1的拓扑)

1、在路由器Router-A上配置PAP

Router-A>en
Router-A #conf t
Router-A (config)#username RTB password netscene-B(在Router-A中创建用户名RTB,密码为netscene-B,这组用户名和密码是Router-B与Router-A进行PAP协商时使用的凭据,需要在Router-A中为Router-B事先创建好。)
Router-A (config)#int s 0/0
Router-A (config-if)#ip add 192.168.1.1 255.255.255.0
Router-A (config-if)#no shut
Router-A (config-if)#clock rate 64000(因为两台路由器是串口连接,需要将其中一台路由器的串口配置为DCE,这里我们选择RTA的串口s0/0上配置时钟速率64000)
Router-A (config-if)#encapsulation ppp (在串行接口上封装PPP协议)
Router-A (config-if)#ppp authentication pap (双方进行PPP协商都使用PAP进行验证)
Router-A (config-if)#ppp pap sent-username RTA password netscene-A (在与Router-B协商时,Router-A会向Router-B发送用户名为RTA,密码为netscene-A的这组验证凭据,这组凭据需要事先在Router-B上创建好。)
Router-A (config-if)#end
Router-A#

2、在路由器Router-B上配置PAP

Router-B>en
Router-B#conf t
Router-B(config)#username RTA password netscene-A (在Router-B中创建用户名RTA,密码为netscene-A,这组用户名和密码是Router-A与Router-B进行PAP协商时使用的凭据,所以也需要在Router-B中为Router-A事先创建好。)
Router-B(config)#interface s 0/1
Router-B(config-if)#ip add 192.168.1.2 255.255.255.0
Router-B(config-if)#encapsulation ppp (在串行接口上封装PPP协议)
Router-B(config-if)#ppp authentication pap (双方进行PPP协商时都使用PAP进行验证)
Router-B(config-if)#ppp pap sent-username RTB password netscene-B (在与Router-A协商时,Router-B会向Router-A发送用户名为RTB,密码为netscene-B的这组验证凭据,当然这组凭据也已经事先在Router-A上配置好了。)
Router-B(config-if)#end
Router-B#

3、验证PPP

Router-A#show interface s0/0

Serial0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 192.168.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)
LCP Open
Open: IPCP,CDPCP
……
……

为了方便描述,我已将以上Router-A的s0/0端口输出的一部分PPP信息隐去,加粗的信息部分很重要:“Serial0/0 isup表明物理端口s0/0已开启,这也证明该设备的第一层——物理层已为PPP协商做好了准备;“line protocol is up(connected)表明第二层——数据链路层也已经搭建完毕;“Internet address is 192.168.1.1/24”表时该端口已具有了第三层标识——IP地址;以上的输出信息表明TCP/IP协议栈的下三层均已搭建完成。“EncapsulationPPP说明该接口封装了PPP协议;“LCP OpenOpen: IPCP说明PPP协商的两个重要阶段——LCP与NCP(IPCP)已协商成功,LCP和NCP(IPCP)这两个子层已处于“open(打开)”状态(具体协商过程和原理请参考本站的PPP协议原理的文档)。
注:路由器Router-B的s0/1端口的PPP输出信息同Router-A的s0/0端口的输出信息大同小异,这里就不再重复了……

4、测试PPP连通性

Router-A#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 31/31/32 ms

输出信息中的5个“感叹号”证明Router-A能够ping通Router-B,双方PPP PAP的协商和验证是成功的。


图2


二、在路由器Router-A和Router-B上配置、验证并测试PPP CHAP(请参考图2的拓扑)

1、在路由器Router-A上配置CHAP

Router-A(config)#username RTB password netscene.net(该指令中设置的密码必须与Router-B中设置的密码一致,否则通信两端通过哈希函数计算出的应答值是无法匹配的,相关原理请参考本站PPP协议运行原理的文档。)
Router-A(config)#interface s1/1
Router-A(config-if)#ip address 192.168.1.1 255.255.255.0
Router-A (config-if)#no shut
Router-A (config-if)#clock rate 64000
Router-A(config-if)#encapsulation ppp
Router-A(config-if)#ppp authentication chap (双方进行PPP协商时都使用CHAP进行验证)
Router-A(config-if)#ppp chap hostname RTA (在与Router-B协商时,Router-A会向Router-B发送用户名为RTA的凭据,该凭据已在Router-B中创建并会以明文在网络上传送,但是所需密码是不会在网络上以明文传送的。)
Router-A(config-if)#end
Router-A#

2、在路由器Router-B上配置CHAP

Router-B(config)#username RTA password netscene.net(该指令中设置的密码必须与Router-A中设置的密码一致,否则通信两端通过哈希函数计算出的应答值是无法匹配的,相关原理请参考博文中的PPP协议运行原理的文档。)
Router-B(config)#interface s1/0
Router-B(config-if)#ip address 192.168.1.2 255.255.255.0
Router-B(config-if)#no shut
Router-B(config-if)#encapsulation ppp
Router-B(config-if)#ppp authentication chap(双方进行PPP协商时都使用CHAP进行验证)
Router-B(config-if)#ppp chap hostname RTB(在与Router-A协商时,Router-B会向Router-A发送用户名为RTB的凭据,该凭据已在Router-A中创建并会以明文在网络上传送,但是所需密码是不会在网络上以明文传送的。)
Router-B(config-if)#end
Router-B#

3、测试PPP连通性

Router-A#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 31/31/32 ms

输出的信息表明Router-A能够ping通Router-B,双方PPP CHAP的协商和验证也是成功的。 

猜你喜欢

转载自blog.csdn.net/lnboxue/article/details/79486307
ppp
今日推荐