第18讲 hdlc和ppp
TRANSCRIPT
第 18 讲HDLC和 PPP
第 18 讲HDLC和 PPP
www.cisco.com
HDLCHDLC
HDLC :是在同步数据链路控制封装协议发展而来的数据链路层协议。HDLC 是 CISCO 串行线路的缺省封装协议,只允许 CISCO 专用设备的连接,与其他的供应商的设备不兼容。如果与没有运行 CISCO IOS 的设备连接应当使用 PPP 。
www.cisco.com
Flag Address Control Data FCS Flag
标准 HDLC
• 支持单一的协议环境
Flag Address Control Proprietary Data FCS Flag
Cisco HDLC
HDLC 帧格式
• Cisco 的 HDLC 具有 proprietary 字节提供对多协议环境的支持
www.cisco.com
HDLC 命令
Router(config-if)#encapsulation hdlc
• 启用 HDLC 封装• HDLC 是 CSICO 同步串口的缺省封装格式
www.cisco.com
PPP EncapsulationTCP/IPNovell IPXAppleTalk
Multiple protocol encapsulations using
NCPs in PPP
PPP 可以通过 NCP 携带多个协议的数据包PPP 可以通过 LCP 建立和控制连接
Link setup and control using LCP in PPP
PPP 综述
www.cisco.com
Synchronous or AsynchronousPhysical Media
Link Control Protocol
Authentication, other options
Network Control Protocol PPP
Data LinkLayer
PhysicalLayer
NetworkLayer
IPCP IPXCP Many Others
IP IPX Layer 3 Protocols
PPP 分层结构
www.cisco.com
Feature How It Operates Protocol
Authentication PAP
CHAPPerform Challenge Handshake
Require a password
CompressionCompress data at source; reproduce data at destination
Stacker orPredictor
Error Detection
Avoid frame looping
Monitor data dropped on link Magic Number
Multilink Load balancing across multiple links
Multilink Protocol (MP)
PPP LCP 配置选项
www.cisco.com
PPP 协议的组成• NCP— 负责上层协议的选择和配置• LCP— 负责链路建立、配置和测试
www.cisco.com
PPP 协议作用PPP 协议作用
能够控制数据链路的建立; 能够对广域网的 IP 地址进行分配和管理; 允许同时采用多种网络层路由协议; 能够配置和测试数据链路; 能够有效进行错误检测; 使用回拨的功能来进一步提高安全性
www.cisco.com
PPP 帧格式
Flag Address Control Protocol Data FCS
• 标志域( Flag ):指示一个域的开始或结束,该域包含 01111110
• 地址域( Address ):该域包含 11111111 ,是标准的广播地址。 PPP 不指定单个工作站的地址
• 控制域( Control ):长度为一个字节,该域包含00000011 ,表示用户数据采用无序帧方式传输。它提供的无连接链路服务类似于逻辑链路控制( LLC )类型 SAP 提供的方法
1 1 1 2 0-1500 2
www.cisco.com
• 协议字段( Protocol ):长度为两个字节,用于说明封装在数据域 的协议类型 • 数据字段( Data ):长度为零个或多个字节,它包含符
合协议域中指定协议的数据报。通过确定帧序列的结尾,为 FCS 域留出 2 个字 节,便可确定数据域的结尾。该域最大长度的默认值为 1500 字节 • 帧检测时序( FCS ):通常为 16 位。用来进行差错控制
www.cisco.com
PPP 会话建立过程PPP 会话建立过程
链路的建立和配置协商• 通信的发起方发送 LCP 帧来配置和检测数据链路
链路质量检测• 链路将被检测 , 从而判断链路的质量是否能够携带
网络层信息网络层协议的配置协商• 通信的发起方发送 NCP 帧 , 用以选择和配置网络
协议链路终止
www.cisco.com
PPP 验证概述
两种 PPP 验证协议 : PAP 和 CHAP
PPP 会话的建立1. 链路建立2. 验证阶段(可选)3. 网路层协议连接
Dialup or Circuit-Switched
Network
www.cisco.com
PPP 验证PPP 验证
在 PPP 会话中,验证是可选的。如果需要验证,则须通信双方的路由器要交换彼此的验证信息。可以选择使用密码验证协议 PAP 或询问握手验证协议 CHAP ;在一般情况下, CHAP 是首选协议。
www.cisco.com
密码明文传输验证两端是同等的
选择 PPP 验证协议
Remote Router(SantaCruz)
Central-Site Router (HQ)
Hostname: santacruzPassword: boardwalk
username santacruzpassword boardwalk
PAP 2-Way Handshake
“ santacruz, boardwalk”“ santacruz, boardwalk”
Accept/RejectAccept/Reject
www.cisco.com
密码验证协议 PAP密码验证协议 PAP
PAP :两次握手,密码在链路上是明文传输的;连接建立后,需要不停地在链路上反复发送用户名和密码直到身份验证通过或连接被终止;远程节点受到登录尝试的频率和定时的即制。
www.cisco.com
选择 PPP 验证协议
远程路由器(SantaCruz)
中心路由器(HQ)
Hostname: santacruzPassword: boardwalk
Username: santacruzPassword: boardwalk
CHAP3-Way Handshake
询问询问
响应响应
接受 /拒绝接受 /拒绝
密码是加密的
www.cisco.com
密码验证协议 CHAP
username johnpassword urbiz
Remote userJohn
Access serverCiscoRun PPP
Use CHAP
Response
Accept or reject
Challenge
Request for challenge
Local userdatabase
Name: johnPassword: urbiz
• 单向 CHAP 认证
www.cisco.com
第一步 拔号者发起 CHAP呼叫
766-13640-1
User dials in
ppp authentication CHAPLCP 协商 CHAP 认证方式和 MD5算法
www.cisco.com
第二步 向拔号者发送挑战信息
01 random 3640-1id
User dials in766-1
3640-1
1,建立挑战数据包 ;随机数 ,认证名…
2,将序列号保存在访问服务器中 ;
3,向呼叫方发送挑战数据包 ;
www.cisco.com
第三步拔号者处理挑战消息
MD5
hash
01 random 3640-1iduser pass3640-1 pc1
User dials in766-1
3640-1
拔号者处理 CHAP挑战数据包 ;
1,将序列号放入MD5散列生成器 ;
2,将随机数放入MD5散列生成器 ;
3,用访问服务器的认证名比较口令
4,将密码放入MD5散列生成器
www.cisco.com
第四步 拔号者向访问服务器发送挑战应答
01
02
random 3640-1id
id hash 766-1
user pass3640-1 pc1
User dials in766-1
3640-1
MD5
hash发送应答包给访问服务器;
www.cisco.com
第五步 访问服务器检查拔号者发过来的应答数据包
01
02
random 3640-1id
id hash 766-1
user pass766-1 pc1
user pass3640-1 pc1
=?
User dials in766-1
3640-1
MD5
hash
MD5
hash
www.cisco.com
第六步 访问服务器向拔号者发送认证通过消息(一)
01
02
03
random 3640-1id
id hash 766-1
id “ Welcome in”
user pass766-1 pc1
user pass3640-1 pc1
User dials in766-1
3640-1
MD5
hash
MD5
hash
www.cisco.com
第六步 访问服务器向拔号者发送认证失败的消息(二)
01
02
04
random 3640-1id
id hash 766-1
id “Authentication failure”
user pass766-1 pc1
user pass3640-1 pc1
User dials in766-1
3640-1
MD5
hash
MD5
hash
www.cisco.com
ü
配置 PPP 验证总述
ServiceProvider
Verify who you are.
Router to Be Authenticated(The router that initiated the call.)
ppp encapsulation
hostname username / password ppp authentication CHAP/PAP
Authenticating Router(The router that received the call.)
ppp encapsulation
hostname username / password ppp authentication CHAP/PAP
Enabling PPP
Enabling PPP Authentication
Enabling PPP
Enabling PPP Authentication
üüü
üüüü
www.cisco.com
配置 PPP
Router(config-if)#encapsulation ppp
激活 PPP 验证
www.cisco.com
配置 PPP 验证
Router(config)#hostname name
• 给路由器命名
Router(config)#username name password password
• 提供需要验证的对方路由器的名称和密码
www.cisco.com
配置 PPP 验证
Router(config-if)#ppp authentication{chap | chap pap | pap chap | pap}
激活 PAP 或 CHAP 验证
www.cisco.com
CHAP 配置举例
hostname leftusername right password sameone!int serial 0
ip address 10.0.1.1 255.255.255.0
encapsulation ppp ppp authentication CHAP
hostname leftusername right password sameone!int serial 0
ip address 10.0.1.1 255.255.255.0
encapsulation ppp ppp authentication CHAP
hostname rightusername left password sameone!int serial 0 ip address 10.0.1.2 255.255.255.0 encapsulation ppp ppp authentication CHAP
hostname rightusername left password sameone!int serial 0 ip address 10.0.1.2 255.255.255.0 encapsulation ppp ppp authentication CHAP
Leftrouter
Rightrouter
PSTN/ISDN
www.cisco.com
查看 HDLC 和 PPP 的封装Router#show interface s0Serial0 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
www.cisco.com
完成本章的学习后,你应该能够掌握:• 在广域网的串行口上配置 PPP 协议• 在一个 PPP 连接内配置 PAP 和 CHAP 验
证•查看点到点的 PPP 协议配置情况
本章总结