网络 || PPP

什么是PPP?

点到点协议(Point to Point Protocol,PPP)是为在同等单元之间传输数据包这样的简单链路设计的链路层协议。

除了 IP 以外 PPP 还可以携带其它协议,包括 DECnet 和 Novell 的 Internet 网包交换(IPX)。

PPP功能

1.PPP具有动态分配IP地址的能力

2.PPP支持多种网络协议,比如TCP/IP

3.PPP具有错误检测能力,但不具备纠错能力,所以ppp是不可靠传输协议

4.无重传的机制,网络开销小,速度快

5.PPP具有身份验证功能

6.PPP可以用于多种类型的物理介质上,包括串口线、电话线、移动电话和光纤,PPP也用于Internet接入

工作流程

当用户拨号接入 ISP 时,路由器的调制解调器对拨号做出确认,并建立一条物理连接。PC 机向路由器发送一系列的 LCP 分组(封装成多个 PPP 帧)。

这些分组及其响应选择一些 PPP 参数,和进行网络层配置(此前如有PAP或CHAP验证先要通过验证),NCP 给新接入的 PC机分配一个临时的 IP 地址,使 PC 机成为因特网上的一个主机。

通信完毕时,NCP 释放网络层连接,收回原来分配出去的 IP 地址。接着,LCP 释放数据链路层连接。最后释放的是物理层的连接。

特点

PPP协议是一种点——点串行通信协议。

PPP具有处理错误检测、支持多个协议、允许在连接时刻协商IP地址、允许身份认证等功能。

PPP提供了3类功能:成帧;链路控制协议LCP;网络控制协议NCP。

PPP是面向字符类型的协议。

认证方式

一种是PAP,一种是CHAP。

相对来说PAP的认证方式安全性没有CHAP高。PAP在传输password是明文的,而CHAP在传输过程中不传输密码,取代密码的是hash(哈希值)。

PAP认证是通过两次握手实现的,而CHAP则是通过3次握手实现的。

PAP认证是被叫提出连接请求,主叫响应。而CHAP则是主叫发出请求,被叫回复一个数据包,这个包里面有主叫发送的随机的哈希值,主叫在数据库中确认无误后发送一个连接成功的数据包连接。

故障排查命令

debug ppp negotiation                 确定客户端是否可以通过PPP协商

debug ppp authentication            确定客户端是否可以通过验证

debug ppp error                           显示和PPP连接协商与操作相关的协议错误以及统计错误

debug aaa authentication            要确定在使用哪个方法进行验证,以及用户是否通过验证。

debug aaa authorization              要确定在使用哪个方法进行验证,并且用户是否通过验证。

debug aaa accounting                 查看发送的记录。

debug radius                                查看用户和服务器交换的属性。


案例1(认证方式使用PAP)

拓扑图

1.添加接口

 

2.配置ip地址

 

3.配置PAP认证

R1上操作

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R1
R1(config)#username R2 password 1234
R1(config)#interface Serial0/2/0
R1(config-if)#encapsulation ppp
R1(config-if)#ppp authentication pap
R1(config-if)#ppp pap sent-username R1 password 1234
R1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/2/0, changed state to up

R1(config-if)#exit
R1(config)#exit
R1#

R2上操作

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R2
R2(config)#username R1 password 1234
R2(config-if)#no shutdown
R2(config-if)#ip address 192.168.1.2 255.255.255.0

%LINK-5-CHANGED: Interface Serial0/2/0, changed state to up

R2(config-if)#encapsulation ppp
R2(config-if)#ppp authentication pap
R2(config-if)#clock rate 64000
R2(config-if)#ppp pap sent-username R2 password 1234

4.测试

R1#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 = 17/23/32 ms

R1#

案例2(认证方式使用CHAP)

拓扑图

 

1.添加接口

2.配置ip地址

3.配置CHAP认证

 r1上操作

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname r1
r1>en							//进入特权模式
r1#conf t						//进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
r1(config)#username r2 password 123456		//创建对方用户名和密码
r1(config)#interface Serial0/2/0			//Serial0/2/0
r1(config-if)#no shut			//开启Serial0/2/0
 
%LINK-5-CHANGED: Interface Serial0/2/0, changed state to down
r1(config-if)#ip add 192.168.2.1 255.255.255.0			//设置Serial0/2/0口ip
r1(config-if)#encap ppp			//给Serial0/2/0口封装PPP
r1(config-if)#ppp auth chap		//设置ppp验证方式为chap
r1(config-if)#end				//返回特权模式
r1#

r2上操作

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname r2
r2>en							//进入特权模式
r2#conf t						//进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
r2(config)#username r1 password 123456		//创建对方用户名和密码
r2(config)#interface Serial0/2/0			//Serial0/2/0
r2(config-if)#no shut			//开启Serial0/2/0
 
%LINK-5-CHANGED: Interface Serial0/2/0, changed state to down
r2(config-if)#ip add 192.168.2.2 255.255.255.0			//设置Serial0/2/0口ip
r2(config-if)#encap ppp			//给Serial0/2/0口封装PPP
r2(config-if)#ppp auth chap		//设置ppp验证方式为chap
r2(config-if)#clock rate 64000		//设置Serial0/2/0的时钟频率为64000

4.测试

r1#ping 192.168.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/26/32 ms

r1#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

韩未零

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

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

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

打赏作者

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

抵扣说明:

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

余额充值