一、实验环境和要求![](https://i-blog.csdnimg.cn/direct/b66c089e3ad64bfa956e4b85efe2e3ef.png)
二、实验步骤
1、R1与R5间使用PPP的PAP认证,R5为主认证方;
R5(主认证方)的配置
[isp]aaa / /进入aaa进程
[isp-aaa]local-user hahaha password cipher 123456 / 设置用户 hahaha 及加密密码
[isp-aaa]local-user hahaha service-type ppp / 设置用户 hahaha 的服务类型ppp认证
进入与R1同公网网段的接口进行配置
[isp]int Serial 3/0/0
[isp-Serial3/0/0]ppp authentication-mode pap /身份认证为PPP的PAP协议
PPP的PAP认证配置完成
R1(被认证方)的配置
[r1-Serial4/0/0]ppp pap local-user hahaha password cipher 123456 /接口配置登录用 hahaha 和密码
NCP协商自动获取IP地址
[r1-Serial4/0/0]ip address ppp-negotiate / 通过PPP获取到R1公网接口的IP地址
2、R2与R5之间使用PPP的chap认证,R5为主认证方;
R5(主认证方):
[ISP]aaa / 进入aaa空间
[ISP-aaa]local-user haha password cipher 1234567 /创建账号以及密码
[ISP-aaa]local-user haha service-type ppp / 定义账号的服务对象
[ISP]interface Serial 3/0/1 / 端口
[ISP-Serial3/0/1]link-protocol ppp / 修改链路层协议为ppp
[ISP-Serial3/0/1]ppp authentication-mode chap /端口选择认证协议
R1(被认证方):
[AR2]interface Serial 4/0/0 / 进入端口
[AR2-Serial4/0/0]ppp chap user hahaha / 添加账号
[AR2-Serial4/0/0]ppp chap password cipher 1234567 /添加账号对应密码
3、R3与R5之间使用HDLC封装
AR3
[AR3]display interface Serial 4/0/0 /查看端口当前协议
..
Link layer protocol is PPP /协议显示为PPP
[AR3]interface Serial 4/0/0 /进入端口
[AR3-Serial4/0/0]link-protocol hdlc /修改端口默认二层协议为HDLC
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
[AR3]display interface Serial 4/0/0 /查看修改情况
...
Link layer protocol is nonstandard HDLC /结果显示当前端口协议为HDLC
AR5
[ISP]display interface Serial 4/0/0 /查看当前端口协议
...
Link layer protocol is PPP /结果显示当前端口协议为PPP
[ISP]interface Serial 4/0/0 /进入端口
[ISP-Serial4/0/0]link-protocol hdlc /修改端口协议
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
[ISP]display interface Serial 4/0/0 /查看修改后的端口协议
Link layer protocol is nonstandard HDLC /结果显示当前端口协议为HDLC
4、构建GRE环境
R1的配置
[r1]int Tunnel 0/0/0 /创建隧道接口
[r1-Tunnel0/0/0]ip address 192.168.20.1 24 /配置隧道IP地址(此地址为私网网段)
[r1-Tunnel0/0/0]tunnel-protocol gre /选择隧道接口的封装类型
[r1-Tunnel0/0/0]source 15.0.0.1 /定义源IP地址(信息出接口的IP地址)
[r1-Tunnel0/0/0]destination 45.0.0.2 /定义目标IP地址(信息入接口的IP地址)
R5的配置
[r4]int Tunnel 0/0/0 /创建隧道接口
[r4-Tunnel0/0/0]ip address 192.168.20.2 24 /配置隧道IP地址(此地址为私网网段)
[r4-Tunnel0/0/0]tunnel-protocol gre /选择隧道接口的封装类型
[r4-Tunnel0/0/0]source 45.0.0.2 /定义源IP地址(信息出接口的IP地址)
[r4-Tunnel0/0/0]destination 15.0.0.1 /定义目标IP地址(信息入接口的IP地址)
5、配置rip
R1
[R1]int t 0/0/0
[R1-Tunnel0/0/0]nhrp entry multicast dynamic /开启R1伪广播
[R1-Tunnel0/0/0]undo rip split-horizon /关闭RIP水平分割
[R1-Tunnel0/0/0]q
[R1]rip /开启RIP
[R1-rip-1]version 2 /RIP设置版本2
[R1-rip-1]network 192.168.1.0 /网络
[R1-rip-1]network 192.168.5.0
[R1-rip-1]network 192.168.6.0
R2
[R2]rip
[R2-rip-1]version 2
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 192.168.5.0
R3
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 192.168.5.0
R4
[R4]rip
[R4-rip-1]version 2
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.6.0