一、实验要求
1、R5为ISP,只能进行IP地址配置,其所有地址均配为公有IP地址;
2、R1和R5间使用PPP的PAP认证,R5为主认证方;
R2与R5之间使用ppp的CHAP认证,R5为主认证方;
R3与R5之间使用HDLC封装;
3、R1、R2、R3构建一个MGRE环境,R1为中心站点,R1、R4间为点到点的GRE;
4、整个私有网络基本RIP全网可达;
5、所有PC设置私有IP为源IP,可以访问R5环回,达到全网通。
二、实验拓扑
三、实验思路
1、配置IP地址,
2、公私网边界路由器配置出口缺省路由,实现公网全网通
3、配置PPP的PAP和CHAP的认证,修改R3和R5的接口链路类型为HDLC
4、配置R1、R2、R3为MGRE,R1为中心站点
5、配置R1与R2为点到点GRE
6、配置RIP协议,宣告隧道和私网IP,实现私网互通
7、配置NAT技术,实现公私网互通
四、实验步骤
1)配置IP地址,出接口设备配置缺省路由
R1:
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[r1-GigabitEthernet0/0/0]int s4/0/0
[r1-Serial4/0/0]ip add 15.1.1.1 24
R2:
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[r2-GigabitEthernet0/0/0]int s4/0/0
[r2-Serial4/0/0]ip add 25.1.1.1 24
R3:
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.3.1 24
[r3-GigabitEthernet0/0/0]int s4/0/0
[r3-Serial4/0/0]ip add 35.1.1.1 24
R4:
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.4.1 24
[r4-GigabitEthernet0/0/1]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 45.1.1.1 24
R5:
[ISP]int s4/0/0
[ISP-Serial4/0/0]ip add 15.1.1.5 24
[ISP-Serial4/0/0]int s4/0/1
[ISP-Serial4/0/1]ip add 25.1.1.5 24
[ISP-Serial4/0/1]int s3/0/0
[ISP-Serial3/0/0]ip add 35.1.1.5 24
[ISP-Serial3/0/0]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 45.1.1.5 24
[ISP]int l0
[ISP-LoopBack0]ip add 5.5.5.5 24
# 配置出接口设备缺省路由
[r1]ip route-static 0.0.0.0 0 15.1.1.5
[r2]ip route-static 0.0.0.0 0 25.1.1.5
[r3]ip route-static 0.0.0.0 0 35.1.1.5
[r4]ip route-static 0.0.0.0 0 45.1.1.5
2)完成R1和R5之间的PAP认证,R5为主认证方。
需要在主认证方上创建用于认证的用户名和密码,pap认证方式会以明文方式传输用户、密码
# 主认证方
[ISP]aaa
[ISP-aaa]local-user long password cipher 123456 privilege level 15
[ISP-aaa]local-user long service-type ppp # 定义服务类型为ppp协议
[ISP-aaa]int s4/0/0
[ISP-Serial4/0/0]ppp authentication-mode pap # 对应接口的ppp协议认证方式为pap
# 被认证方
[r1]int s4/0/0
[r1-Serial4/0/0]ppp pap local-user long password cipher 123456 #用于认证的用户名和密码
3)完成R2与R5之间的chap认证,R5为主认证方
需要在R5上创建用于验证的用户,且chap认证方式会密文传递用户名和密码。
# 主认证方
[ISP]aaa
[ISP-aaa]local-user dragon password cipher 123456 privilege level 15
[ISP-aaa]local-user dragon service-type ppp
[ISP-aaa]int s4/0/1
[ISP-Serial4/0/1]ppp authentication-mode chap # 对应接口的ppp协议认证方式为pap
# 被认证方
[r2]int s4/0/0
[r2-Serial4/0/0]ppp chap user dragon
[r2-Serial4/0/0]ppp chap password cipher 123456
4)完成R3与R5之间为HDLC封装。
[r3]int s4/0/0
[r3-Serial4/0/0]link-protocol hdlc
[ISP]int s3/0/0
[ISP-Serial3/0/0]link-protocol hdlc
5)完成R1与R4为点到点GRE
分析:GRE,一种简单的VPN技术,属于点到点网络类型,让两个网络穿越中间网络来直接通讯,逻辑的在两个网络间建立了一条新的点到点直连链路。
[r1]interface Tunnel 0/0/1 # 创建隧道接口
[r1-Tunnel0/0/1]ip add 10.1.1.1 24 # 隧道IP地址
[r1-Tunnel0/0/1]tunnel-protocol gre # 隧道封装的协议类型
[r1-Tunnel0/0/1]source 15.1.1.1 # 封装源公网IP
[r1-Tunnel0/0/1]destination 45.1.1.1 # 封装目标公网IP
# 注释同上
[r4]int Tunnel 0/0/1
[r4-Tunnel0/0/1]ip add 10.1.1.2 24
[r4-Tunnel0/0/1]tunnel-protocol gre
[r4-Tunnel0/0/1]source 45.1.1.1
[r4-Tunnel0/0/1]destination 15.1.1.1
查看接口是否双UP
6)完成R1、R2、R3的MGRE配置,R1为中心站点
结构为中心到站点结构;站点可以基于NHRP实现ip地址不固定,主动到固定IP的中心站点注册;中心成MAP映射—tunnel口IP与公有ip地址的对应;
若分支到分支,那么将在中心站点下载map来实现直接通讯。
提前做好RIP的动态多播,和关闭水平分割机制,为RIP做准备
# 中心站点
[r1]int Tunnel 0/0/0 # 创建隧道接口
[r1-Tunnel0/0/0]ip add 10.1.2.1 24 # 隧道接口IP地址
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp # 定义接口为MGRE隧道
[r1-Tunnel0/0/0]source 15.1.2.1 # 隧道加封装的报头源IP
[r1-Tunnel0/0/0]nhrp network-id 100 # NHRP的工作编号,该网段所有设备必须在同一id
[r1-Tunnel0/0/0]nhrp entry multicast dynamic # 开启伪广播,为RIP做准备
[r1-Tunnel0/0/0]undo rip split-horizon # 取消RIP的水平分割机制,为RIP的宣告做准备
# 分支站点
[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]ip add 10.1.2.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source Serial 4/0/0 # 隧道加封装的报头源IP为该接口下的IP地址
[r2-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register # 隧道加封装的报头目标IP到中心站点下载
[r2-Tunnel0/0/0]nhrp network-id 100 # 域ID为100
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 10.1.2.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source Serial 4/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
[r3-Tunnel0/0/0]nhrp network-id 100
7)配置RIP.,实现宣告直连网段
分析:这里能不能也宣告公网地址呢?多宣告多知道些路由不是更好吗?公网的地址不能被私网学到,宣告了也没用
[r1]rip 1
[r1-rip-1]undo summary
[r1-rip-1]v 2
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 10.0.0.0
[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]undo summary
[r2-rip-1]network 192.168.2.0
[r2-rip-1]network 10.0.0.0
[r3]rip 1
[r3-rip-1]version 2
[r3-rip-1]undo summary
[r3-rip-1]network 192.168.3.0
[r3-rip-1]network 10.0.0.0
[r4]rip 1
[r4-rip-1]version 2
[r4-rip-1]undo summary
[r4-rip-1]network 192.168.4.0
[r4-rip-1]network 10.0.0.0
8)私网完成NAT技术,实现私网访问公网
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1]int Serial 4/0/0
[r1-Serial4/0/0]nat outbound 2000
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[r2]int Serial 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]int Serial 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]int g0/0/0
[r4-GigabitEthernet0/0/0]nat outbound 2000