文章目录
CCNP实验:OSPF综合、MGRE、特殊区域、减少LSA的更新量
关于此次实验不懂的可以参考我这两篇博客:
CCNP4:OSPF(数据包、状态机、工作过程、接口网络类型、建立邻接关系的条件)
CCNP5:OSPF的【不规则、末梢、NSSA】区域、【1、2、3、4、5、7】类LSA、【3、5、7】缺省
这是此次实验的拓扑:
实验要求: |
---|
①R4为ISP,其上只能配置IP地址,R4与其他所有直连设备间使用公有IP |
②R3、R5-7为MGRE环境,R3为中心站点 |
③整个OSPF环境IP地址为172.16.0.0/16 |
④所有设备均可访问R4的环回 |
⑤减少LSA的更新量,加快收敛,保障更新安全 |
⑥全网可达 |
1、规划IP:
我们发现该拓扑中即存在OSPF,又存在EIGRP。标准的做法是将所给地址一分为二,一半跑EIGRP,一半跑OSPF。但是这张图中,EIGRP没有邻居,只有R12上的俩环回,因此我们就不按一分为二的思路进行划分。我们把EIGRP当做一个区域,这样总共6个区域,我们可以划分8个区域这样每个区域可以容纳相对多的用户:
区域 | IP | 具体规划 |
---|---|---|
A0 | 172.16.0.0/19 | 0.0/29搭建骨干MA网络,0.128/25及之后用作环回 |
A1 | 172.16.32.0/19 | 32.0/29搭建骨干MA网络,32.128/25及以后用作环回 |
A2 | 172.16.64.0/19 | 64.0/30作为骨干网络,64.128/25及以后用作环回 |
A3 | 172.16.96.0/19 | 同上 |
A4 | 172.16.128.0/19 | 同上 |
EIGRP | 172.16.160.0/19 | 分为两部分160.1/20、176.1/20 |
2、配置:
(1)底层:
该底层中的公网IP是随便配置的,运营商的环回IP为4.4.4.4/24,绿色虚线模拟MGRE。
(2)路由:
①配置缺省:
在R3、R5-7上需要配置缺省路由指向运营商ISP:
R3(config)#ip route 0.0.0.0 0.0.0.0 34.1.1.2
R5(config)#ip route 0.0.0.0 0.0.0.0 45.1.1.2
R6(config)#ip route 0.0.0.0 0.0.0.0 46.1.1.2
R7(config)#ip route 0.0.0.0 0.0.0.0 47.1.1.2
此时R3可以ping通R5、R6、R7
②搭建MGRE:
配置中心站点:
R3(config)#int tunnel 0
R3(config-if)#ip add 172.16.0.1 255.255.255.248
R3(config-if)#tunnel source 34.1.1.1
R3(config-if)#tunnel mode gre multipoint
R3(config-if)#ip nhrp map multicast dynamic
R3(config-if)#ip nhrp network-id 100
R5、R6、R7均同下配置:
R5(config)#int tunnel 0
R5(config-if)#ip add 172.16.0.2 255.255.255.248
R5(config-if)#tunnel source s0/0
R5(config-if)#tunnel mode gre multipoint
R5(config-if)#ip nhrp nhs 172.16.0.1
R5(config-if)#ip nhrp map 172.16.0.1 34.1.1.1
R5(config-if)#ip nhrp network-id 100
此时MGRE就算搭建完成了。
考虑到后面我们会使用OSPF协议实现全网可达,此时只有R3开启了伪广播,R5-7都没有开启。
R5(config-if)#ip nhrp map multicast 34.1.1.1
R6(config-if)#ip nhrp map multicast 34.1.1.1
R7(config-if)#ip nhrp map multicast 34.1.1.1
此时还需要将R3、R5-7的工作方式改为点到多点,并关闭R3水平分割:
R3(config)#int tunnel 0
R3(config-if)#ip ospf network point-to-multipoint
③路由宣告:
R1-R12进行宣告,这里以R12为例,其余不再演示。
R12(config)#router ospf 1
R12(config-router)#router-id 12.12.12.12
R12(config-router)#network 172.16.64.0 0.0.0.255 a 2
R12(config)#router eigrp 90
R12(config-router)#no auto-summary
//注意不可以主类宣告,这里需要使用精确宣告
R12(config-router)#network 172.16.160.0 0.0.31.255
R9不用不用宣告area4中的网段,因为一会儿要使用多进程双向重发布解决不规则区域
④重发布EIGRP:
R12(config)#router ospf 1
R12(config-router)#redistribute eigrp 90 subnets
⑤解决不规则区域:
解决不规则区域最好的办法就是多进程重发布:
首先启动第二个OSPF的进程:
R9(config)#router ospf 2
R9(config-router)#network 172.16.128.0 0.0.0.255 area 4
接着我们将area4中的路由重发布到area3中,但并不把area3学到的路由重发布到area4中,这个我们一会儿把area3设置为完全NSSA区域后再说。
R9(config)#router ospf 1
R9(config-router)#redistribute ospf 2 subnets
之后R5便拥有了area4的路由:
⑥配置NAT:
R3、R5-7均按如下方法配置:
R3(config)#access-list 1 permit 172.16.0.0 0.0.255.255
R3(config)#ip nat inside source list 1 int s1/0 overload
R3(config)#int s1/0
R3(config-if)#ip nat outside
R3(config-if)#int e0/0
R3(config-if)#ip nat inside
(3)优化:
①减少骨干的LSA更新量:
汇总域间路由:
R3(config)#router ospf 1
R3(config-router)#area 1 range 172.16.32.0 255.255.224.0
R6(config)#router ospf 1
R6(config-router)#area 2 range 172.16.64.0 255.255.224.0
R7(config)#router ospf 1
R7(config-router)#area 3 range 172.16.96.0 255.255.224.0
汇总域外路由:
R12(config)#router ospf 1
R12(config-router)#summary-address 172.16.160.0 255.255.224.0
R9(config)#router ospf 1
R9(config-router)#summary-address 172.16.128.0 255.255.224.0
汇总之后它们的路由表应该只有3条O IA,2条O E2
②减少非骨干的LSA更新量:
Ⅰ、优化区域1为完全末梢区域:
这是没有把area1设置为完全末梢区域的数据库表:
R3(config)#router ospf 1
R3(config-router)#area 1 stub no-summary
R1(config-router)#area 1 stub
R2(config-router)#area 1 stub
之后优化之后,3类只剩下一条缺省:
Ⅱ、将area2优化为完全NSSA:
这是优化前的数据库表:
优化之后,它应该会删除3、4、5类LSA,然后只保留一条3类缺省,并多出一条7类LSA:
R6(config)#router ospf 1
R6(config-router)#area 2 nssa no-summary
R11(config)#router ospf 1
R11(config-router)#area 2 nssa
R12(config-router)#area 2 nssa
Ⅲ、将area3也设置为完全NSSA区域:
R7(config)#router ospf 1
R7(config-router)#area 3 nssa no-summary
R8(config)#router ospf 1
R8(config-router)#area 3 nssa
R9(config)#router ospf 1
R9(config-router)#area 3 nssa
R8的路由表:
此时area 3被设置为了NSSA区域,R9拥有了缺省路由,那么我们就可以在R9上的OSPF的进程2中下放缺省,这样才可以出去。
R9(config)#router ospf 2
R9(config-router)#default-information originate
此时R10就会有缺省:
做到这里局域网全部可以通了,可以让R1、R10、R12去ping一下R4的环回,检测一下。