目录
拓扑设计
搭建拓扑
配置
底层
路由
测试
排错
1、拓扑设计
R1、R2、R3的环回为私网,R4所在的环境为公网环境,通过搭建mgre环境,让内网之间通信。
1)ip地址规划
#各接口所在网段
R1—R4 14.1.1.0/24
R2—R4 24.1.1.0/24
R3—R4 34.1.1.0/24
#隧道地址
R1: 10.1.1.1 /24
R2: 10.1.1.2/24
R3: 10.1.1.3/24
#环回地址(模拟的内网)
R1: 192.168.1.1/24
R2: 192.168.2.1/24
R3: 192.168.3.1/24
2.拓扑搭建
3.配置
1)底层ip
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 14.1.1.1 24
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.1 24
2)路由
#公网环境
[r1]ip route-static 0.0.0.0 0 14.1.1.2
[r2]ip route-static 0.0.0.0 0 24.1.1.2
[r3]ip route-static 0.0.0.0 0 34.1.1.2
测试公网路由:
#配置MGRE环境-----隧道
R1---中心
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 14.1.1.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp authentication cipher hcip
R2---分支
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip address 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 14.1.1.1 register
[r2-Tunnel0/0/0]nhrp authentication cipher hcip
R3---分支
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 14.1.1.1 register
[r3-Tunnel0/0/0]nhrp authentication cipher hcip
测试mgre环境:
#内网至内网的路由---(引流)
[r1]ip route-static 192.168.2.0 24 10.1.1.2
[r1]ip route-static 192.168.3.0 24 10.1.1.3
R3/R2去访问别的分支,即使自己有公网ip,和其它分支不能通信,必须找中心要路由表,所以分支去别的分支下一跳是中心,有了路由表,内网通过公网才能互访
[r3]ip route-static 192.168.1.0 24 10.1.1.1
[r3]ip route-static 192.168.2.0 24 10.1.1.1
[r2]ip route-static 192.168.1.0 24 10.1.1.1
[r2]ip route-static 192.168.3.0 24 10.1.1.1
查分支站点注册表:
3)测试