30-广域网——PPP协议和安全认证

1. PPP协议

虽然在广域网中点对点通信的技术有很多,但是HDLC技术已经很少使用了,目前使用最广泛的还是PPP协议。ppp协议通过在以太网上提供点到点连接,建立PPP会话,可以让一个主机接入远端的因特网,并通过PPP协议对每个接入的主机进行控制,具有更高的安全性。

PPP协议早在1994年就成为了因特网的正式标准,不同厂商的网络设备都支持PPP协议,可以实现不同厂商的网络设备点对点通信,PPP协议也是工作在链路层,它主要有以下几个功能:

  1. 点对点数据封装成帧
  2. 用户认证
  3. 链路捆绑
  4. 数据压缩

2. 封装成帧

点对点通信中,链路层是封装PPP协议进行通信的。

R1设备配置IP地址并开启PPP协议封装:

R1#conf t
R1(config)#int s0/0
//开启PPP协议封装
R1(config-if)#encapsulation ppp 
R1(config-if)#ip address 12.1.1.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit
R1(config)#

 

R2设备配置IP地址并开启PPP协议封装:

扫描二维码关注公众号,回复: 11157499 查看本文章
R2#conf t
R2(config)#int s0/0
//开启PPP协议封装
R2(config-if)#encapsulation ppp 
R2(config-if)#no shutdown 
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#exit
R2(config)#exit

通过wireshark抓取R1和R2设备的PPP协议:

默认情况下,R1和R2每10秒就会发送一个基于LCP协议的PPP协议数据包,通常是一个请求包对应一个响应包,用于维护这条链路的通信。也就是说,通过这个基于LCP的PPP协议包也可以来判断这条链路是否出现通信故障。

 

PPP协议主要由LCP协议和NCP协议组成:

  1. LCP协议(Link Control Protocol):链路控制协议,用来建立,配置和维护数据链路层通信的,实现通信双方的链路协商。
  2. NCP协议(Network Control Protocol):网络控制协议,NCP协议中的每一个协议支持不同的网络层协议,例如:IP,IPv6,AppleTalk等,简单来讲就是用于支持不同网络层协议。

3. PPP安全认证

PPP协议通过安全认证协议对每个接入因特网的主机设备进行控制,具有更高的安全性,PPP的安全认证技术主要有以下两种:

  1. PAP认证
  2. CHAP认证

3.1 PAP认证

PAP(Password Authentication Protocol,简称PAP)协议在PPP链路的基础上利用2次握手的简单方法进行认证,源节点会在ppp连路上反复发送用户名和密码,直到验证通过。但是在实际的网络环境中是不推荐使用PAP进行用户安全认证的,因为PAP认证的用户名和密码在链路上是以明文的形式传输,由于是源节点控制验证的频率和次数,因此PAP认证不能防范一些重复性的网络攻击。

总之PAP认证的特点就是:明文认证,两次握手,单向认证。

 

 

PAP认证实验步骤:

1. 首先client和server部署ppp协议,建立ppp链路

2. 然后Server设置PAP认证用户名和密码,Client进行PAP验证

3. wireshark抓取PAP认证协议包

Server配置ip地址并部署ppp协议,以建立ppp链路,配置如下:

Server#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Server(config)#int s0/0
Server(config-if)#no shutdown 
Server(config-if)#ip address 12.1.1.2 255.255.255.0
Server(config-if)#encapsulation ppp 
Server(config-if)#

Client配置如下:
 

Client#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Client(config)#int s0/0
Client(config-if)#no shutdown 
*Mar  1 00:03:06.323: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up12
*Mar  1 00:03:07.327: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
Client(config-if)#ip address 12.1.1.1 255.255.255.0
Client(config-if)#encapsulation ppp 
Client(config-if)#

Serve设置PAP认证并设置用户名和密码,配置如下:

Server(config)#username test password 123456
Server(config)#int s0/0
Server(config-if)#ppp authentication pap
Server(config-if)#
*Mar  1 00:04:51.751: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
Server(config-if)#

由于此时Client还没有向Server进行PAP认证,所以Client和Server是无法通信的:

Client#ping 12.1.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

然后Client向Server进行PAP认证,配置如下:

Client#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Client(config)#int s0/0
//发送认证的用户名和密码
Client(config-if)#ppp pap sent-username test pass
Client(config-if)#end
Client#
Client#ping 12.1.1.2

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

当Client向Server进行PAP认证通过后,Client和Server之间就可以进行点对点通信了。
 

 

 

wireshark抓取Client和Server认证的PAP数据包:

从wireshark中可以看到Client向Server验证时发送的PAP协议的两次握手过程,并且在数据包中携带的用户名和密码是以明文传输的(PAP认证是明文传输),这对于网络安全问题越来越突出的情况下,PAP认证是非常不安全的,不推荐使用。

 

3.2 CHAP认证

CHAP(Challenge Handshake Authentication Protocol,简称CHAP)协议中文为询问握手验证协议 ,CHAP协议也是基于PPP链路的,在建立PPP链路后利用3次握手周期性的进行验证,CHAP协议不允许连接发起方在没有收到任何询问消息(hello包)下进行验证尝试。CHAP协议每次使用不同的询问消息,每个消息都是不可预测的唯一的值,并且该询问消息经过MD5加密运算后的加密值提高了安全性,可以防止一些网络攻击,因此CHAP比PAP具有更高的安全性。

CHAP认证的特点:

  1. 比PAP认证更加安全
  2. 三次握手
  3. 双向认证

R1和R2开启CHAP认证之前,先配置ip地址,部署PPP协议。

 

 

R1开启CHAP认证,用户名为R2,密码为cisco,配置如下:

R1(config)#username R2 password cisco
R1(config)#int s0/0
R1(config-if)#ppp authentication chap
R1(config-if)#exit

R2开启CHAP认证,配置如下:

R2(config)#username R1 password cisco
R2(config)#int s0/0
R2(config-if)#ppp authentication chap
R2(config-if)#exit 

Wireshark抓取R1和R2的CHAP认证包:

4. 链路捆绑

PPP协议里的链路捆绑跟Etherchannel技术中的链路捆绑是类似相通的,这里直接开始PPP链路捆绑的配置。

 

 

R1设备设置S0/0口和s0/1口的PPP链路捆绑,配置如下:

R1(config)#int s0/0
R1(config-if)#no shutdown 
R1(config-if)#encapsulation ppp
R1(config-if)#ppp multilink 
R1(config-if)#ppp multilink group 1
R1(config-if)#
R1(config)#int s0/1
R1(config-if)#no shutdown 
R1(config-if)#encapsulation ppp
R1(config-if)#
*Mar  1 00:11:25.147: %LINK-3-UPDOWN: Interface Serial0/1, changed state to up   
R1(config-if)#ppp multilink 
R1(config-if)#ppp multilink group 1

将接口放入捆绑组group 1当中,这里的group用于区分本地多个捆绑组,是本地标识,把s0/0和s0/1接口放入group 1组当中

 

 

 

R2设备设置S0/0口和s0/1口的PPP链路捆绑,配置如下:

R2(config)#int s0/0
R2(config-if)#no shutdown 
R2(config-if)#encapsulation ppp
R2(config-if)#ppp multilink 
*Mar  1 00:11:34.491: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, chang                
R2(config-if)#ppp multilink group 1
R2(config-if)#
R2(config)#int s0/1
R2(config-if)#no shutdown 
R2(config-if)#encapsulation ppp
R2(config-if)#ppp multilink 
R2(config-if)#ppp multilink group 1
R2(config-if)#

给R1设备的逻辑链路捆绑的接口配置IP地址:

R1(config)#int multilink 1       
R1(config-if)#ip address 12.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#

给R2设备的逻辑链路捆绑的接口配置IP地址:

R2(config)#int multilink 1
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#exit
R2(config)#

查看R1设备的PPP链路捆绑状态:

R1#show interfaces multilink 1
Multilink1 is up, line protocol is up 
  Hardware is multilink group interface
  Internet address is 12.1.1.1/24
//可以看到R1设备的s0/0口和s0/1口捆绑成一条链路了
  MTU 1500 bytes, BW 3088 Kbit, DLY 100000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation PPP, LCP Open, multilink Open
  Open: IPCP, CDPCP, loopback not set
  Keepalive set (10 sec)
  DTR is pulsed for 2 seconds on reset
  Last input 00:00:40, output never, output hang never
  Last clearing of "show interface" counters 00:02:11
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     7 packets input, 676 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     7 packets output, 728 bytes, 0 underruns
     0 output errors, 0 collisions, 1 interface resets
     0 output buffer failures, 0 output buffers swapped out
     0 carrier transitions
R1#

查看R1设备的逻辑捆绑链路接口信息:

R1#show ip interface brief 
Interface                  IP-Address      OK? Method Status                Protocol
Serial0/0                  unassigned      YES TFTP   up                    up      
Serial0/1                  unassigned      YES NVRAM  up                    up      
Serial0/2                  unassigned      YES NVRAM  administratively down down    
Serial0/3                  unassigned      YES NVRAM  administratively down down    
Multilink1                 12.1.1.1        YES manual up                    up      
R1#

测试R1和R2的网络连通性:

R1#ping 12.1.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/65/72 ms
R1#

到此,说明PPP协议链路捆绑实验完成。

原创文章 317 获赞 280 访问量 24万+

猜你喜欢

转载自blog.csdn.net/qq_35733751/article/details/101230754