PPP协议支持两种认证协议:
1.PAP(Password Authentication Protocol,口令认证协议)
2.CHAP(Challenge Handshake Authentication Protocol,质询握手认证协议)
PAP是两次握手认证协议,口令以明文传送,被认证方首先发起认证请求。
CHAP是三次握手认证协议,不发送口令,主认证方首先发起认证请求,安全性比PAP高
详细配置过程:
拓扑图:
.net文件以下:
autostart = false
[localhost]
`3640`
p_w_picpath = c:\Program Files\Dynamips\p_w_picpaths\C3640-IS.BIN
confreg = 0x2102
idlepc = 0x604feb34
ram = 64
`ROUTER R1`
model = 3640
console = 2001
s1/0 = R2 s1/1
`ROUTER R2`
model = 3640
console = 2002
1、单向验证
1:R1启动pap(R1为主验证方,R2为被验证方)
R1(config)#int s1/0
R1(config-if)#no shut
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#encapsulation ppp #修改封装协议为PPP
R1(config-if)#ppp authentication pap #认证协议为pap
R1(config-if)#exi
R1(config)#username
test password
test #设置验证用户名及密码
R2(config)#int s1/1
R2(config-if)#no shut
R2(config-if)#ip add 1.1.1.2 255.255.255.0
R2(config-if)#encapsulation ppp
R2(config-if)#ppp pap sent-username
test password
test #发送验证用户名及密码
2:R1启动chap(R1为主验证方,R2为被验证方)
R1(config)#int s1/0
R1(config-if)#no shut
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#encapsulation ppp #修改封装协议为PPP
R1(config-if)#ppp authentication chap #认证协议为pap
R1(config-if)#exi
R1(config)#username R2 password
test # 发送被验证方用户名及密码,R2为被验证方hostname
R2(config)#int s1/1
R2(config-if)#no shut
R2(config-if)#ip add 1.1.1.2 255.255.255.0
R2(config-if)#encapsulation ppp
R2(config-if)#ppp chap password
test #设置用户名及密码,用户名默认为hostname,用户名可更改,但必须两边一致
2、双向验证
一、R1跟R2同时启动pap
R1(config)#int s1/0
R1(config-if)#no shut
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#encapsulation ppp
R1(config-if)#ppp authentication pap
R1(config-if)#ppp pap sent-username
test password
test
R1(config-if)#exi
R1(config)#username
test password
test
R2(config)#int s1/1
R2(config-if)#no shut
R2(config-if)#ip add 1.1.1.2 255.255.255.0
R2(config-if)#encapsulation ppp
R2(config-if)#ppp authentication pap
R2(config-if)#ppp pap sent-username
test password
test
R2(config-if)#exi
R2(config)#username
test password
test
二、R1跟R2同时启动chap
R1(config)#int s1/0
R1(config-if)#no shut
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#encapsulation ppp
R1(config-if)#ppp authentication chap
R1(config-if)#exi
R1(config)#username R2 password
test # R2为对方hostname
R2(config)#int s1/1
R2(config-if)#no shut
R2(config-if)#ip add 1.1.1.2 255.255.255.0
R2(config-if)#encapsulation ppp
R2(config-if)#ppp authentication chap
R2(config-if)#exi
R2(config)#username R1 password
test # R1为对方hostname
三、R1启动pap,R2启动chap
R1(config)#int s1/0
R1(config-if)#no shut
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#encapsulation ppp
R1(config-if)#ppp authentication pap
R1(config-if)#ppp chap password
test
R1(config-if)#exi
R1(config)#username
test password
test
R2(config)#int s1/1
R2(config-if)#no shut
R2(config-if)#ip add 1.1.1.2 255.255.255.0
R2(config-if)#encapsulation ppp
R2(config-if)#ppp authentication chap
R2(config-if)#ppp pap sent-username
test password
test
R2(config-if)#exi
R2(config)#username R1 password
test # R1为对方hostname
验证:ping
debug ppp authentication