实验拓扑
拓扑分析
R1、R2、R3和R5之间用的串口连接,R4和R5之间用的是以太网连接,根据要求,R5为ISP,R1-R4为边界路由器。
先配置IP地址:
公网由路由器名字互联组成,如图所示
私网网段用192.168.1.0/24 --- 192.168.4.0/24
虚拟链路MGRE用192.168.5.0/24 GRE用192.168.6.0/24
首先给所有路由器和PC配上IP地址
配置边界路由器指向ISP的缺省路由
在R1-R4上配置指向ISP的缺省路由
[R1]ip route-static 0.0.0.0 0 15.0.0.2
[R2]ip route-static 0.0.0.0 0 25.0.0.2
[R3]ip route-static 0.0.0.0 0 35.0.0.2
[R4]ip route-static 0.0.0.0 0 45.0.0.2
测试公网联通性
配置R1和R5的PPP的PAP认证
华为默认串口用的是PPP协议,所以串口协议类型不需要修改。
直接配置PAP认证:
在R5上设置3A认证,选择认证模式为PPP,在对应端口启用认证
[R5-aaa]local-user r1 password cipher 123456
[R5-aaa]local-user r1 service-type ppp
[R5-Serial3/0/0]ppp authentication-mode pap
在R1上配置相应用户
[R1-Serial4/0/0]ppp pap local-user r1 password cipher 123456
通过关闭接口再重启接口进行验证,配置认证是否生效
接口双UP,认证配置生效。
配置R2和R5之间的PPP的CHAP认证
R2可以直接使用已有用户进行验证,为了减少配置量,故不添加新用户
在R5接口上配置认证为CHAP认证
[R5-Serial3/0/1]ppp authentication-mode chap
在R2上添加用户
[R2-Serial4/0/0]ppp chap user r1
[R2-Serial4/0/0]ppp chap password cipher 123456
进行验证
配置R3和R5之间HDLC协议
修改R3接口链路的协议
[R3-Serial4/0/0]link-protocol hdlc
修改R5接口链路的协议
[R5-Serial4/0/0]link-protocol hdlc
R1-R2-R3构建MGRE环境,R1为中心站点
在R1上配置
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 15.0.0.1
[r1-Tunnel0/0/0]nhrp redirect // 开启nhrp重定向报文
在R2上配置
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source Serial 4/0/0
[R2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
[R2-Tunnel0/0/0]nhrp shortcut // 开启分支节点的NHRP地址解析请求
在R3上配置
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source s4/0/0
[R3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
[R3-Tunnel0/0/0]nhrp shortcut // 开启分支节点的NHRP地址解析请求
R1和R4配置GRE
R1配置
[r1-Tunnel0/0/1]tunnel-protocol gre
[r1-Tunnel0/0/1]source 15.0.0.1
[r1-Tunnel0/0/1]destination 45.0.0.1
R4配置
[R4-Tunnel0/0/0]tunnel-protocol gre
[R4-Tunnel0/0/0]source 45.0.0.1
[R4-Tunnel0/0/0]destination 15.0.0.1
全网基于RIP可达
R1配置
[r1]rip
[r1-rip-1]v 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
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]rip summary-address 192.168.0.0 255.255.248.0 // 配置这一条之后,所有的私网都会发送给R1中心
R2配置
[r2]rip
[r2-rip-1]v 2
[r2-rip-1]network 192.168.2.0
[r2-rip-1]network 192.168.5.0
R3配置
[r3]rip
[r3-rip-1]v 2
[r3-rip-1]network 192.168.3.0
[r3-rip-1]network 192.168.5.0
R4配置
[r4]rip
[r4-rip-1]v 2
[r4-rip-1]network 192.168.4.0
[r4-rip-1]network 192.168.6.0
PC可以访问R5环回,配置边界路由器NAT
R1配置
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1-Serial4/0/0]nat outbound 2000
R2配置
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R2-Serial4/0/0]nat outbound 2000
R3配置
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-Serial4/0/0]nat outbound 2000
R4配置
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-GigabitEthernet0/0/0]nat outbound 2000
最后测试PC1访问 ISP环回