实验拓扑
![](https://i-blog.csdnimg.cn/blog_migrate/c484e7a667a14941c2256035f208f2c6.png)
实验要求:
1、左边三台设备配置OSPF 10,区域0;
2、右边为OSPF 1 中间是Area0,下挂Area1和Area2;
3、两个进程之间有ISP设备,需要访问公网。
4、OSPF 1区域零中,中心设备不启动动态路由协议,配置MGRE。
实验分析:
首先分配IP地址。
在左边启动OSPF,并宣告,配置R3指向ISP的缺省,并下放缺省,配置NAT
在右边,先配置MGRE环境,配置mgre环境之间的路由,然后再将各路由器(除R7)启动OSPF,在r5上配置指向ISP的缺省,并下放,在R5上配置NAT
在R3和R5之间配置VPN,并选择配置左右两边需要通信的路由。
实验配置
IP配置按图上所示
在左侧区域启动OSPF
![](https://i-blog.csdnimg.cn/blog_migrate/38fa83ebbb878fb351a961e462c95512.png)
在R3配置缺省并下放
![](https://i-blog.csdnimg.cn/blog_migrate/fc6641d39097df5b6f1e9e1c525b742e.png)
![](https://i-blog.csdnimg.cn/blog_migrate/8b1ad0a63f9693acb4123074ab3a6b4a.png)
在R3上配置NAT
![](https://i-blog.csdnimg.cn/blog_migrate/8d8248cdfc5bdcd585e996ef6eefb8c3.png)
![](https://i-blog.csdnimg.cn/blog_migrate/a2244b897a7f1cfaa288285cc192067b.png)
在R6、R8、R10、R12上配置MGRE环境
修改tunnel接口的网络类型为broadcast或者p2mp。broadcast需要进行DR和BDR的选举,hello时间为10S,P2MP不需要进行DR和BDR选举,hello时间为30S。MGRE环境下,broadcast可以能因为DR和BDR身份认知不同,导致缺失路由,所以选择P2MP,并将hello时间改回10S。
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source 192.168.4.2
[r6-Tunnel0/0/0]nhrp entry multicast dynamic
[r6-Tunnel0/0/0]ospf network-type p2mp
[r6-Tunnel0/0/0]ospf timer hello 10
[r8-Tunnel0/0/0]tunnel-protocol gre p2mp
[r8-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r8-Tunnel0/0/0]nhrp entry 192.168.16.1 192.168.4.1 register
[r8-Tunnel0/0/0]ospf network-type p2mp
[r8-Tunnel0/0/0]ospf timer hello 10
[r10-Tunnel0/0/0]tunnel-protocol gre p2mp
[r10-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r10-Tunnel0/0/0]nhrp entry 192.168.16.1 192.168.4.1 register
[r10-Tunnel0/0/0]ospf network-type p2mp
[r8-Tunnel0/0/0]ospf timer hello 10
[r12-Tunnel0/0/0]tunnel-protocol gre p2mp
[r12-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r12-Tunnel0/0/0]nhrp entry 192.168.16.1 192.168.4.1 register
[r12-Tunnel0/0/0]ospf network-type p2mp
[r12-Tunnel0/0/0]ospf timer hello 10
因为需要在边界下放缺省,所以MGRE之间的路由选择使用静态。
![](https://i-blog.csdnimg.cn/blog_migrate/1b40439d2a5101f786000d230088a3d2.png)
在各路由器上启动OSPF
![](https://i-blog.csdnimg.cn/blog_migrate/7ceed47bbc158a78a15054c38fba962f.png)
在R5上配置指向ISP的缺省,并下放
![](https://i-blog.csdnimg.cn/blog_migrate/574324c9ce6998f14f5106e05b4a26d7.png)
![](https://i-blog.csdnimg.cn/blog_migrate/225a4c1403a1e94659b4a0c87570ff4c.png)
在R5上配置NAT
![](https://i-blog.csdnimg.cn/blog_migrate/5c704e8efb51021d469f806d70d5f30f.png)
![](https://i-blog.csdnimg.cn/blog_migrate/43b16e5efffcd09608c8ad33905cf81a.png)
在R3和R5上配置VPN
[r3-Tunnel0/0/0]ip add 192.168.15.1 24
[r3-Tunnel0/0/0]tunnel-protocol gre
[r3-Tunnel0/0/0]source 4.4.1.1
[r3-Tunnel0/0/0]destination 4.4.2.2
[r5-Tunnel0/0/0]ip add 192.168.15.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre
[r5-Tunnel0/0/0]source 4.4.2.2
[r5-Tunnel0/0/0]destination 4.4.1.2
最后选择需要开放的配置静态路由,下一跳写VPN隧道。