实验要求:
1,R4为ISP,其上只能配置IP地址;R4与其他所有直连设备间均使用公有IP
2,R3-R5/6/7为MGRE环境,R3为中心站点;
3,整个OSPF环境IP基于172.16.0.0/16划分;
4,所有设备均可访问R4的环回;
5,减少LSA的更新量,加快收敛,保障更新安全;
6,全网可达
首先配置好IP和MGRE环境,R1-R9用ospf 1,R9-R10用ospf 2,R11和R12用ospf 1,R12额外用rip 1。最后R1的路由表如下。
接下来开始优化LSA减少更新量,发现R3,R6,R7含有很多3类LSA,会影响网络传输效率
首先在R3处做汇总,使得area 1的3类LSA更新量减少
然后在R6,R7上做汇总,减少3类LSA更新量 #多出来的12.12.12.12是之前忘了import rip了
然后查看R1的lsdb,发现內域中其他area来的3类LSA很多,选择修改area 1为stub特殊区域
瞬间R1的lsdb就少了很多,3类LSA缺省指向R3
同理,area 3符合nssa特殊区域条件,将area 3里的R7,R8,R9改为nssa特殊区域,改完后在R7和R9处做汇总,减少LSA更新量
R6,R11,R12也是nssa区域,改完后在R6和R12做汇总,减少LSA更新量
R3,R5,R6,R7做nat使得R4环回可以ping通
最后观察R5的lsdb,发现LSA少了好多,汇总成网段的形式而不是零散的形式。
最后用R1ping通R4,R5,R6,R7,R8,R9,R10,R11,R12的环回,全网通达成。
代码如下:
R1
ospf 1 router-id 1.1.1.1
area 0.0.0.1
network 172.16.32.0 0.0.31.255
authentication-mode md5 1 cipher 123456 #区域认证
stub #设置R1处于stub区域
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 172.16.32.0 0.0.31.255
authentication-mode md5 1 cipher 123456
stub
R3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 172.16.10.0 0.0.0.255
area 0.0.0.1
abr-summary 172.16.32.0 255.255.224.0 #然后手动汇总
network 172.16.32.0 0.0.0.255
network 172.16.35.0 0.0.0.255
authentication-mode md5 1 cipher 123456
stub no-summary #先关闭汇总
ip route-static 0.0.0.0 0.0.0.0 172.16.0.1
interface Tunnel0/0/0
ip address 172.16.10.1 255.255.255.0
tunnel-protocol gre p2mp
source Serial4/0/0
ospf network-type p2mp #ospf接口改为p2mp
ospf timer hello 1 #复杂的拓扑图中hello时间过长不利于LSA快速传播,配置后查看成效速度慢
nhrp entry multicast dynamic #开启伪广播
nhrp network-id 10
R5
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 172.16.5.0 0.0.0.255
network 172.16.10.0 0.0.0.255
ip route-static 0.0.0.0 0.0.0.0 172.16.1.1
interface Tunnel0/0/0
ip address 172.16.10.2 255.255.255.0
tunnel-protocol gre p2mp
source Serial4/0/0
ospf network-type p2mp
ospf timer hello 1
nhrp network-id 10
nhrp entry 172.16.10.1 172.16.0.2 register #作为分支注册R1为中心
R6
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 172.16.6.0 0.0.0.255
network 172.16.10.0 0.0.0.255
area 0.0.0.2
abr-summary 172.16.64.0 255.255.224.0
network 172.16.64.0 0.0.0.255
nssa no-summary
ip route-static 0.0.0.0 0.0.0.0 172.16.2.1
interface Tunnel0/0/0
ip address 172.16.10.3 255.255.255.0
tunnel-protocol gre p2mp
source Serial4/0/0
ospf network-type p2mp
ospf timer hello 1
nhrp network-id 10
nhrp entry 172.16.10.1 172.16.0.2 register
R7
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 172.16.7.0 0.0.0.255
network 172.16.10.0 0.0.0.255
area 0.0.0.3
abr-summary 172.16.96.0 255.255.224.0 #ABR手动汇总
network 172.16.96.0 0.0.0.255
nssa no-summary
ip route-static 0.0.0.0 0.0.0.0 172.16.3.1
interface Tunnel0/0/0
ip address 172.16.10.4 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf network-type p2mp
ospf timer hello 1
nhrp network-id 10
nhrp entry 172.16.10.1 172.16.0.2 register
R8
ospf 1 router-id 8.8.8.8
area 0.0.0.3
network 172.16.96.0 0.0.31.255
nssa
R9
ospf 1 router-id 9.9.9.9
asbr-summary 172.16.128.0 255.255.224.0
import-route ospf 2
area 0.0.0.3
network 172.16.96.0 0.0.31.255
nssa
ospf 2 router-id 9.9.9.9
default-route-advertise
import-route ospf 1
area 0.0.0.0
network 172.16.128.0 0.0.31.255
R10
ospf 2 router-id 10.10.10.10
area 0.0.0.0
network 172.16.128.0 0.0.31.255
R11
ospf 1 router-id 11.11.11.11
area 0.0.0.2
network 172.16.64.0 0.0.31.255
nssa
R12
rip 1
version 2
network 172.16.0.0
import-route ospf 1
ospf 1 router-id 12.12.12.12
asbr-summary 172.16.192.0 255.255.224.0 #ASBR手动汇总
import-route rip 1
area 0.0.0.2
network 172.16.65.0 0.0.0.255
nssa
最后想说的就是一定要注意好宣告的网段,我做实验的时候把R3,R5,R6,R7(MGRE的4个)的物理直连链路宣告进了ospf中,导致R3ping不通其他环回,查看路由表时甚至看见了172.16.5.1(R5环回)下一跳为172.16.10.2(R5隧道ip),172.16.10.2的下一跳还是172.16.10.2成环的离谱情况,最后排错半天才找到问题。