Transcript PPP

第十四章
PPP协议
© 1999, Cisco Systems, Inc.
8-1
本章目标
通过本章学习,您应该掌握以下内容:
•掌握CISCO HDLC帧格式及配置
•掌握PPP协议的组件:成帧方法、LCP、NCP
•掌握PPP帧格式及配置
•掌握PPP的验证过程(PAP、CHAP)及配置
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-2
串行点到点链路的封装格式
•最常用的两个点对点广域网封装协议是
HDLC、PPP
•PPP:用于在链路建立过程当中检查链路
质量;另外,还支持PAP和CHAP密码验证
HDLC:是思科串行线路的缺省协议,只允
许点对点的连接
•如果连接的是非CISCO设备,就需要使用
其他的数据封装类型。如FR,PPP
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-3
HDLC协议简介
SDLC:由IBM开发,后来提交给ANSI和ISO,希
望接受成为美国国家标准和国际标准。
ADCCP:ANSI修改SDLC后形成。
HDLC:ISO修改SDLC后形成。
CISCO HDLC实现基于ISO HDLC,但在帧格式中
做了修改,使其称为CISCO专有协议。
HDLC是CISCO串行线路的缺省封装协议,只允许
CISCO专用设备的连接,与其他的供应商的设备不
兼容。
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-4
HDLC 帧格式
Cisco HDLC
Flag
Address
Control
Proprietary
Data
FCS
Flag
• Cisco的 HDLC 具有proprietary 字节提供对多协议环境的支持
ISO HDLC
Flag
Address
Control
Data
FCS
Flag
• 支持单一的协议环境
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-5
配置HDLC
Router(config)# interface serial [slot_#/]port_#
Router(config-if)# encapsulation hdlc
• 进入某个串口配置模式
• 启用HDLC封装
• HDLC是CISCO同步串口的缺省封装格式
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-6
查看数据链路层封装
Router# show interfaces serial 1
Serial1 is up, line protocol is up
Hardware is MCI Serial
Internet address is 192.168.2.2 255.255.255.0
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255,
load 1/255
Encapsulation HDLC, loopback not set, keepalive set (10 sec)
Last input 0:00:02, output 0:00:00, output hang never
Last clearing of "show interface" counters never
Output queue 0/40, 0 drops; input queue 0/75, 0 drops
<--output omitted-->
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-7
PPP 综述
Multiple protocol
encapsulations using
NCPs in PPP
TCP/IP
Novell IPX
AppleTalk
PPP Encapsulation
Link setup and control
using LCP in PPP
•PPP 可以通过 NCP 携带多个网络层协议的数据包
•PPP 可以通过 LCP 建立和控制数据链路
•PPP 可以在异步或同步串口、HSSI、ISDN接口下工作
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-8
PPP协议作用
•能够控制数据链路的建立;
•能够配置和测试数据链路;
•允许认证
•能够对广域网的IP地址进行分配和管理;
•允许同时采用多种网络层协议;
•能够有效进行错误检测;
在80年代末,人们在SLIP协议基础上开发
PPP协议来解决远程互联网连接的问题。
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-9
PPP 组件
PPP: A data link with network layer services
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-10
LCP分组中的配置选项
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-11
PPP帧格式
Flag:01111110
© 1999, Cisco Systems, Inc.
Address:11111111
www.cisco.com
Flag:00000011
ICND—8-12
PPP 认证概述
Dialup or
Circuit-Switched
Network
PPP 会话建立的3个步骤
1. 链路建立(LCP完成)
2. 验证阶段(可选,LCP完成)
3. 网路层协议连接(NCP完成)
两种 PPP 认证协议: PAP 和 CHAP
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-13
PPP认证
在PPP会话中,验证是可选的。
如果需要验证,则须通信双方的路由器要交
换彼此的验证信息。
可以选择使用密码验证协议PAP或询问握手
验证协议CHAP;在一般情况下,CHAP是首
选协议。
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-14
选择 PPP 验证协议
Remote Router
(SantaCruz)
PAP
2-Way Handshake
Central-Site Router
(HQ)
“santacruz, boardwalk”
Accept/Reject
username santacruz
password boardwalk
Hostname: santacruz
Password: boardwalk
密码明文传输
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-15
密码验证协议PAP
PAP:两次握手,密码在链路上是明文传输
的;连接建立后,需要不停地在链路上反复
发送用户名和密码;远程节点受到登录尝试
的频率和定时的限制。
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-16
选择 PPP 验证协议
远程路由器
(SantaCruz)
CHAP
3-Way Handshake
中心路由器
(HQ)
质询
响应
Hostname: santacruz
Username: HQ
Password: boardwalk
接受/拒绝
Hostname: HQ
Username: santacruz
Password: boardwalk
密码没有直接在链路上传输
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-17
第一步 拔号者发起CHAP呼叫
User dials in
766-1
3640-1
user pass
3640-1 pc1
user
766-1
pass
pc1
ppp authentication CHAP
LCP协商CHAP认证方式和MD5算法
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-18
第二步 向拔号者发送质询信息
User dials in
766-1
3640-1
01 id random 3640-1
用于区别多个认证过程
分组标识:
01:质询
02:质询应答
03:允许PPP连接
04:拒绝PPP连接
© 1999, Cisco Systems, Inc.
1、建立质询数据包:随机数,认证名…
2、将id号和随机数保存在访问服务器中;
3、向呼叫方发送质询数据包;
www.cisco.com
ICND—8-19
第三步拔号者处理质询消息
User dials in
766-1
3640-1
user pass
3640-1 pc1
01 id random 3640-1
拔号者处理CHAP质询数据包;
1、将id号放入MD5散列生成器;
MD5
2、将随机数放入MD5散列生成器;
hash
3、用访问服务器的认证名匹配口令
4、将口令放入MD5散列生成器
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-20
第四步 拔号者向访问服务器发送
质询应答
User dials in
766-1
3640-1
user pass
3640-1 pc1
01 id random 3640-1
02 id
hash
766-1
MD5
hash
© 1999, Cisco Systems, Inc.
发送应答包给访问服务器;
www.cisco.com
ICND—8-21
第五步 访问服务器检查拔号者发过
来的应答数据包
User dials in
766-1
3640-1
user pass
3640-1 pc1
01 id random 3640-1
02 id
hash
user
766-1
pass
pc1
766-1
MD5
MD5
=?
hash
© 1999, Cisco Systems, Inc.
www.cisco.com
hash
ICND—8-22
第六步 访问服务器向
拔号者发送认证通过/失败的消息
User dials in
766-1
3640-1
user pass
3640-1 pc1
01 id random 3640-1
02 id
hash
user
766-1
pass
pc1
766-1
MD5
MD5
hash
© 1999, Cisco Systems, Inc.
03 id “Welcome in”
www.cisco.com
hash
ICND—8-23
PPP配置和认证总述
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-24
配置 PPP
Router(config-if)#encapsulation ppp
激活 PPP 封装
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-25
配置 PPP 验证
Router(config)#hostname name
• 给本地路由器命名
Router(config)#username name password password
• 提供需要验证的对方路由器的名称和密码
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-26
配置 PPP 验证
Router(config-if)#ppp authentication
{chap | chap pap | pap chap | pap}
激活 PAP 或 CHAP 验证
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-27
CHAP 配置举例
Left
router
PSTN/ISDN
hostname right
username left password sameone
!
int serial 0
ip address 10.0.1.2 255.255.255.0
encapsulation ppp
ppp authentication CHAP
hostname left
username right password sameone
!
int serial 0
ip address 10.0.1.1 255.255.255.0
encapsulation ppp
ppp authentication CHAP
© 1999, Cisco Systems, Inc.
Right
router
www.cisco.com
ICND—8-28
查看 HDLC 和 PPP 的封装
Router#show interface s0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 10.140.1.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)
LCP Open
Open: IPCP, CDPCP
Last input 00:00:05, output 00:00:05, output hang never
Last clearing of "show interface" counters never
Queueing strategy: fifo
Output queue 0/40, 0 drops; input queue 0/75, 0 drops
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
38021 packets input, 5656110 bytes, 0 no buffer
Received 23488 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
38097 packets output, 2135697 bytes, 0 underruns
0 output errors, 0 collisions, 6045 interface resets
0 output buffer failures, 0 output buffers swapped out
482 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-29
验证 PPP 认证
• debug ppp authentication shows successful CHAP output.
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-30
本章总结
完成本章的学习后,你应该能够掌握:
• 在广域网的串行口上配置PPP 协议
• 在一个 PPP 连接内配置PAP和CHAP验证
• 查看点到点的 PPP 协议配置情况
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-31
问题回顾
1. 在Cisco路由器上有哪三中广域网连接类型?
2. PPP有哪两种封装协议,它们有哪些优缺点?
© 1999, Cisco Systems, Inc.
www.cisco.com
ICND—8-32