PPP的两种验证方式(PAP、CHAP)

本文详细介绍了PPP协议,包括其基本功能、PPP的两种验证协议(PAP和CHAP)的工作原理、实验配置步骤以及它们在网络安全中的应用。特别关注了PAP的明文密码问题和CHAP的更安全的三次握手验证过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、PPP

        点到点协议(Point-to-Point Protocol,PPP)提供了一种在点到点链路上封装网络层协议信息的标准方法。PPP也定义了可扩展的链路控制协议(Link Control Protocol,LCP),使用验证协议协商在链路上传输网络层协议前验证链路的对端。

二、PPP的两种验证协议

        PPP支持两种验证协议:密码验证协议(Password Authentication Protocol,PAP)和挑战握手验证协议(Chanllenge Handshake Authentication Protocol,CHAP)。

三、PAP

        PAP提供了一种简单的方法,可以使对端(peer)使用两次握手建立身份验证,这个方法仅仅在链路初始化时使用。链路建立阶段完成后,对端不停地发送ID/Password对给验证者,一直到验证被响应或连接终止为止。

        PAP不是一个健全的身份验证方法。密码在线路上时明文发送的,并且对回送、重复验证和错误攻击没有保护措施。

四、PAP简单实验

        1.拓扑

        2.开启抓包

        在R1设备的s0/0/0口开启抓包,链路类型选择ppp

        3.配置认证方

        password选择simple选项时,密码将以明文形式保存在配置文件中,存在安全风险。建议使用cipher选项,将密码加密保存。

<Huawei>un t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]
[R1]int s0/0/0
[R1-Serial0/0/0]ppp authentication-mode pap 
[R1-Serial0/0/0]quit
[R1]
[R1]aaa
[R1-aaa]local-user admin password cipher 123456
[R1-aaa]local-user admin service-type ppp
[R1-aaa]quit

        4.配置被认证方

<Huawei>un t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int s0/0/0
[R2-Serial0/0/0]ppp pap local-user admin password cipher 123456
[R2-Serial0/0/0]quit

        5.重启接口

        注意:如果这里不重启接口,pap认证(验证)不会生效!

[R1]int s0/0/0
[R1-Serial0/0/0]shutdown 
[R1-Serial0/0/0]undo shutdown 
[R1-Serial0/0/0]quit
[R1]
[R2]int s0/0/0
[R2-Serial0/0/0]shutdown 
[R2-Serial0/0/0]undo shutdown 
[R2-Serial0/0/0]quit
[R2]

         6.观察到抓包结果

        观察到两次握手

 五、CHAP

        CHAP使用三次握手验证,这种验证可以在链路建立初始化时进行,也可以在链路建立后的任何时间内重复进行。

        在链路建立完成后,验证者向对端发送一个chanllenge信息,对端使用一个one-way-hash函数计算出的值响应这个信息。验证者使用相同的单向函数计算自己这一端对应的hash值校验响应值。如果两个值匹配,则验证通过;否则连接终止。

六、CHAP单向认证实验

        1.拓扑

        2.开启抓包

        与上述PAP实验同理(即对R1的s0/0/1接口进行抓包,链路类型选择ppp)

        3.配置认证方

<Huawei>
<Huawei>un t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]
[R1]int s0/0/1
[R1-Serial0/0/1]ppp authentication-mode chap 
[R1-Serial0/0/1]ppp chap user admin
[R1-Serial0/0/1]quit
[R1]
[R1]aaa
[R1-aaa]local-user admin password cipher 123456
[R1-aaa]local-user admin service-type ppp
[R1-aaa]quit

         4.配置被认证方

<Huawei>
<Huawei>un t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]
[R2]int s0/0/1
[R2-Serial0/0/1]ppp chap user admin
[R2-Serial0/0/1]quit
[R2]
[R2]aaa
[R2-aaa]local-user admin password cipher 123456
[R2-aaa]local-user admin service-type ppp
[R2-aaa]quit

        5.重启接口

        注意:如果这里不重启接口,chap认证(验证)同样不会生效!!

[R1]int s0/0/1
[R1-Serial0/0/1]shutdown 
[R1-Serial0/0/1]undo shutdown 
[R1-Serial0/0/1]quit
[R1]
[R2]int s0/0/1
[R2-Serial0/0/1]shutdown 
[R2-Serial0/0/1]undo shutdown 
[R2-Serial0/0/1]quit
[R2]

        6.观察到抓包结果

        观察到三次握手

七、CHAP双向认证实验

        1.拓扑

        2.开启抓包

        同理

        3.配置R1

        R1既作为认证方,也作为被认证方

<Huawei>un t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int s0/0/2
[R1-Serial0/0/2]ppp authentication-mode chap 
[R1-Serial0/0/2]ppp chap user admin
[R1-Serial0/0/2]quit
[R1]
[R1]aaa
[R1-aaa]local-user admin password cipher 123456
[R1-aaa]local-user admin service-type ppp
[R1-aaa]quit

        4.配置R2

        R2同样既作为认证方,也作为被认证方

<Huawei>un t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]
[R2]int s0/0/2
[R2-Serial0/0/2]ppp authentication-mode chap
[R2-Serial0/0/2]ppp chap user admin
[R2-Serial0/0/2]quit
[R2]
[R2]aaa
[R2-aaa]local-user admin password cipher 123456
[R2-aaa]local-user admin service-type ppp
[R2-aaa]quit

        5.重启接口

        注意:如果这里不重启接口,chap认证(验证)不会生效!!!

[R1]int s0/0/2
[R1-Serial0/0/2]shutdown 
[R1-Serial0/0/2]undo shutdown 
[R1-Serial0/0/2]quit
[R1]
[R2]int s0/0/2
[R2-Serial0/0/2]shutdown 
[R2-Serial0/0/2]undo shutdown 
[R2-Serial0/0/2]quit
[R2]

         6.观察抓包结果

        同样观察到三次握手

八、参考文献

        [1] 朱小平.网络规划设计师5天修炼[M]. 北京:中国水利水电出版社,2018.

        [2] 华为.Hedex Lite文档

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Beau_Will

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值