1.R2为ISP,其上只能配置IP地址
2.R1-R2之间为HDLC封装
3.R2-R3之间为PPP封装,Pap认证,R2为主认证方
4.R2-R4之间为PPP封装,chap认证,R2为主认证方
5.R1、R2、R3构建MGRE环境,仅R1的ip地址固定
6.内网使用RIP获取路由,所有Pc可以互相访问,并且可访问R2的环回
在做实验之前保证内网环境PING通
R1~R4之间使用
[R1]ip route-static 0.0.0.0 0 14.1.1.2
[R3]ip route-static 0.0.0.0 0 24.1.1.1
[R4]ip route-static 0.0.0.0 0 34.1.1.1
一:R1-R2之间为HDLC封装
[R1]int s 4/0/0
[R1-Serial4/0/0]ip add 14.1.1.1 24
[R1-Serial4/0/0]link-protocol hdlc #将链路类型改为hdlc封装
[R2]int s 4/0/0
[R2-Serial4/0/0]ip add 14.1.1.2 24
[R2-Serial4/0/0]link-protocol hdlc #将链路类型改为hdlc封装
二:R2-R3之间为PPP封装,Pap认证,R2为主认证方,R2-R4之间为PPP封装,chap认证,R2为主认证方
ISP服务器(及R2)增添两个用户账号
[R2-Serial4/0/0]int s 4/0/1
[R2-Serial4/0/1]ip add 24.1.1.1 24
[R2-Serial4/0/1]int s 3/0/0
[R2-Serial3/0/0]ip add 34.1.1.1 24
[R2-Serial3/0/0]
1.增加用户账号a,提出建立连接需要pap验证
[R2]aaa
[R2-aaa]local-user a password cipher 123456
[R2-aaa]local-user a service-type ppp
R2在接口处调用,提出建立连接需要ppp验证类型,提出建立连接需要pap验证
[R2-aaa]int s 4/0/1
[R2-Serial4/0/1]ppp authentication-mode pap
shutdown关闭接口,undo shutdown取消关闭接口
dis ip int b 查看接口Serial4/0/1协议类型为down
对端路由器R3与R2直连接口处建立连接pap验证
[R3-Serial4/0/0]ip add 24.1.1.2 24
[R3-Serial4/0/0]ppp pap local-user a password cipher 123456
[R3-Serial4/0/0]
shutdown关闭接口,undo shutdown取消关闭接口
dis ip int b 查看接口Serial4/0/1协议类型为up
R2-R3之间为PPP封装,Pap认证完成。
2.增加用户账号b,提出建立连接需要验证chap认证
[R2]aaa
[R2-aaa]local-user b pa c 111111
[R2-aaa]local-user b service-type ppp
接口处调用,提出建立连接需要chap验证
[R2-aaa]int s 3/0/0
[R2-Serial3/0/0]ppp authentication-mode chap
shutdown关闭接口,undo shutdown取消关闭接口
dis ip int b 查看接口3/0/0协议类型为down
对端路由器R4与R2直连接口处建立连接chap验证
[R4]int s 4/0/0
[R4-Serial4/0/0]ip add 34.1.1.2 24
[R4-Serial4/0/0]ppp chap user b#提出连接的用户
[R4-Serial4/0/0]ppp chap password cipher 111111
[R4-Serial4/0/0]
shutdown关闭接口,undo shutdown取消关闭接口
dis ip int b 查看接口Serial4/0/0协议类型为up
R2-R4之间为PPP封装,chap认证完成。
三.R1、R3、R4构建MGRE环境,仅R1的ip地址固定
R1路由器建立栈道
1.以R1为中心,R2和R3扮演分支
R1的14.1.1.1ip固定
[R1]interface Tunnel 0/0/0#创建虚拟栈道接口
[R1-Tunnel0/0/0]ip add 192.168.4.1 24#配置IP地址
增添报头
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp #点到多点的封装加头(源IP知道,目的IP不知道)
[R1-Tunnel0/0/0]source 14.1.1.1 #源IP地址固定
[R1-Tunnel0/0/0]nhrp entry multicast dynamic #destination目的IP地址,客户端ip地址多个且可变,写不了。故交给nhrp服务器来确定目标
[R1-Tunnel0/0/0]nhrp network-id 100 #配置100编号
R3路由器建立栈道
[R3]interface Tunnel 0/0/0#创建虚拟栈道接口
[R3-Tunnel0/0/0]ip add 192.168.4.2 24#配置IP地址
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source Serial 0/0/0 由于R2的IP地址可变,无法确定源,使用接口
[R3-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1.1 register #目标去找服务器nhrp注册
[R3-Tunnel0/0/0]nhrp network-id 100 #配置100编号
R4路由器建立栈道
[R4]interface Tunnel 0/0/0#创建虚拟栈道接口
[R4-Tunnel0/0/0]ip add 192.168.4.3 24
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]source Serial 4/0/0 由于R3的IP地址可变,无法确定源,使用接口
[R4-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1.1 register #目标去找服务器nhrp注册
[R4-Tunnel0/0/0]nhrp network-id 100
四:内网使用RIP获取路由,所有Pc可以互相访问,并且可访问R2的环回
使用静态路由RIP进行全网ping通
R1上
[R1]rip 1
[R1-rip-1]ver 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.4.0
R3上
R3]rip
[R3-rip-1]v 2
[R3-rip-1]network 192.168.4.0
[R3-rip-1]network 192.168.2.0
R4上
[R4]rip
[R4-rip-1]v 2
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.3.0
R1~R4底下PC段为私有网段
PC1
PC2
PC3
使用PC端进行访问