实验要求:
R5 为ISP,直连网段为公网IP,其余为私有网段
R1 和 R5 之间使用PPP协议的PAP认证,R5 为主认证方
R2 和 R5 之间使用PPP协议的CHAP认证,R5 为主认证方
R3 和 R5 之间使用HDLC协议封装
R1、R2、R3之间构建 MGRE 环境、R1为中心站点;
R1、R4之间构建点到点的GRE环境
使用RIP获取路由
私有地址要访问公有地址,所以在R1-R5上配置 NAT
配置如下:
1.配置地址(如图):
PC1~PC4 192.168.X.1/24 相应网关:192.168.X.254/24
AR1:
GE0/0/0 192.168.1.254/24
Serial 4/0/0 15.0.0.1/24
AR2:
GE0/0/0 192.168.2.254/24
Serial 4/0/0 25.0.0.1/24
AR3:
GE0/0/0 192.168.3.254/24
Serial 4/0/0 35.0.0.1/24
AR4:
GE0/0/0 192.168.4.254/24
GE0/0/1 45.0.0.1/24
AR5(ISP):
Serial 3/0/0 15.0.0.2/24
Serial 3/0/1 25.0.0.2/24
Serial 4/0/0 35.0.0.2/24
GE0/0/0 45.0.0.2/24
环回:5.5.5.5/24
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0]int s 4/0/0
[R1-Serial4/0/0]ip add 15.0.0.1 24
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24
[R2-GigabitEthernet0/0/0]int s 4/0/0
[R2-Serial4/0/0]ip add 25.0.0.1 24
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.254 24
[R3-GigabitEthernet0/0/0]int s 4/0/0
[R3-Serial4/0/0]ip add 35.0.0.1 24
[R4]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip add 45.0.0.1 24
[R4-GigabitEthernet0/0/1]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.4.254 24
[R5]int s 3/0/0
[R5-Serial3/0/0]ip add 15.0.0.2 24
[R5-Serial3/0/0]int s 3/0/1
[R5-Serial3/0/1]ip add 25.0.0.2 24
[R5-Serial3/0/1]int s 4/0/0
[R5-Serial4/0/0]ip add 35.0.0.2 24
[R5-Serial4/0/0]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.0.0.2 24
[R5-GigabitEthernet0/0/0]int l 0
[R5-LoopBack0]ip add 5.5.5.5 24
2.完成R1 和 R5 之间使用PPP协议的PAP认证,R5 为主认证方
做认证之前R1与R5默认ping通,配置要双方都配置才可以认证成功
R5配置:
[R5]aaa
[R5-aaa]local-user r1r5 password cipher 123456
[R5-aaa]local-user r1r5 service-type ppp
[R5-aaa]int s 3/0/0
[R5-Serial3/0/0]ppp authentication-mode pap
R1配置:
[R1]int s 4/0/0
[R1-Serial4/0/0]ppp pap local-user r1r5 password cipher 123456
3.完成R2 和 R5 之间使用PPP协议的CHAP认证,R5 为主认证方
R5配置
[R5]aaa
[R5-aaa]local-user r2r5 password cipher 123456
[R5-aaa]local-user r2r5 service-type ppp
[R5-aaa]int s 3/0/1
[R5-Serial3/0/1]ppp authentication-mode chap
R2配置
[R2]int s 4/0/0
[R2-Serial4/0/0]ppp chap user r2r5
[R2-Serial4/0/0]ppp chap password cipher 123456
4.完成R3 和 R5 之间使用HDLC协议封装
华为设备默认为ppp,所以要修改为hdlc
[R3]int s 4/0/0
[R3-Serial4/0/0]link-protocol hdlc
[R5]int s 4/0/0
[R5-Serial4/0/0]link-protocol hdlc
5.R1、R4之间构建点到点的GRE环境
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.5.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 15.0.0.1
[R1-Tunnel0/0/0]destination 45.0.0.1
[R4]int Tunnel 0/0/0
[R4-Tunnel0/0/0]ip add 192.168.5.4 24
[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
6.R1、R2、R3之间构建 MGRE 环境、R1为中心站点
R1配置
[R1]int t 0/0/1
[R1-Tunnel0/0/1]ip add 192.168.6.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
[R1-Tunnel0/0/1]source 15.0.0.1
[R1-Tunnel0/0/1]nhrp network-id 100
R2配置
[R2]int t 0/0/1
[R2-Tunnel0/0/1]ip add 192.168.6.2 24
[R2-Tunnel0/0/1]tunnel-protocol gre p2mp
[R2-Tunnel0/0/1]source Serial 4/0/0
[R2-Tunnel0/0/1]nhrp network-id 100
[R2-Tunnel0/0/1]nhrp entry 192.168.6.1 15.0.0.1 register
R3配置
[R3]int t 0/0/1
[R3-Tunnel0/0/1]ip add 192.168.6.3 24
[R3-Tunnel0/0/1]tunnel-protocol gre p2mp
[R3-Tunnel0/0/1]source s 4/0/0
[R3-Tunnel0/0/1]nhrp network-id 100
[R3-Tunnel0/0/1]nhrp entry 192.168.6.1 15.0.0.1 register
7.开启RIP获取路由
[R1]ip route-static 0.0.0.0 0 15.0.0.2
[R1]rip 1
[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-rip-1]q
[R1]int t 0/0/1
[R1-Tunnel0/0/1]nhrp entry multicast dynamic //开启伪广播功能
[R1-Tunnel0/0/1]undo rip split-horizon //关闭水平分割机制
[R2]ip route-static 0.0.0.0 0 25.0.0.2
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 192.168.6.0
[R3]ip route-static 0.0.0.0 0 35.0.0.2
[R3]rip 1
[R3-rip-1]v 2
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 192.168.6.0
[R4]ip route-static 0.0.0.0 0 45.0.0.2
[R4]rip 1
[R4-rip-1]v 2
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.5.0
R2的路由信息
R1的路由信息
测试:
8.在R1-R5上配置 NAT
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255 //抓流量
[R1-acl-basic-2000]q
[R1]int Serial 4/0/0
[R1-Serial4/0/0]nat outbound 2000 //调用acl2000
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R2-acl-basic-2000]q
[R2]int s 4/0/0
[R2-Serial4/0/0]nat outbound 2000
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]int s 4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-acl-basic-2000]q
[R4]int g 0/0/1
[R4-GigabitEthernet0/0/1]nat outbound 2000
测试:
实验结束