欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

OSPF路由聚合实验(详细)

发布时间:2025/7/14 编程问答 35 豆豆
生活随笔 收集整理的这篇文章主要介绍了 OSPF路由聚合实验(详细) 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

 

理论准备: 利用abr-summary 过滤区域内的路由,对区域类型没有要求。 利用asbr-summary过滤区域内的外部路由,需要在区域内部的ASBR上配置,当ASBR很多时,配置比较复杂。 利用asbr-summary过滤区域内的外部路由,只需要在ABR上配置,但是要求区域必需为NSSA 。 not-advertise参数:不通告匹配指定IP地址/掩码的路由  一、实验证明以下两点 利用abr-summary 过滤区域内的路由 abr-summary ip-address mask [ advertise | not-advertise ] 利用asbr-summary过滤区域内的外部路由 asbr-summary ip-address mask [ not-advertise | tag tag-value ]  拓扑如下,配置会在最后会贴出来,设备用的是华三的模拟器

1、1配置聚合前: <R4>dis ip ro Routing Tables: Public Destinations : 15       Routes : 15 Destination/Mask    Proto  Pre  Cost         NextHop         Interface 3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1 3.3.3.2/32          O_ASE  150  1            4.4.4.1         S0/6/1 4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1 4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1 4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0 6.1.1.1/32          O_ASE  150  1            4.4.4.1         S0/6/1 6.1.2.1/32          O_ASE  150  1            4.4.4.1         S0/6/1 6.1.3.1/32          O_ASE  150  1            4.4.4.1         S0/6/1 7.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0 10.1.1.2/32         O_ASE  150  1            4.4.4.1         S0/6/1 10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 R4的路由表中有三条O_ASE 6.1.0.0/16网段 [R4]dis ospf lsdb OSPF Process 1 with Router ID 10.1.1.4 Link State Database  Area: 0.0.0.1 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric Router    10.1.1.4        10.1.1.4           812  84    80000004       0 Router    10.1.1.3        10.1.1.3           813  48    80000002       0 Sum-Net   3.3.3.0         10.1.1.3           821  28    80000001    1562 Sum-Asbr  10.1.1.2        10.1.1.3           821  28    80000001    1562 AS External Database Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric External  6.1.2.1         10.1.1.2           266  36    80000001       1 External  6.1.3.1         10.1.1.2           266  36    80000001       1 External  6.1.1.1         10.1.1.2           266  36    80000001       1 External  3.3.3.0         10.1.1.2           854  36    80000001       1 External  3.3.3.2         10.1.1.2           854  36    80000001       1 External  10.1.1.2        10.1.1.2           854  36    80000001       1 [R1] dis ip ro Routing Tables: Public Destinations : 13       Routes : 13 Destination/Mask    Proto  Pre  Cost         NextHop         Interface 3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0 3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0 3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0 4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0 6.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0 6.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0 6.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.1.1/32          OSPF   10   3124         3.3.3.2         S0/6/0 7.1.2.1/32          OSPF   10   3124         3.3.3.2         S0/6/0 7.1.3.1/32          OSPF   10   3124         3.3.3.2         S0/6/0 10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 R1的路由表中有三条ospf路由到 7.1.0.0/16网段 下面我们再来分析R1的LSA [R1] dis ospf lsdb OSPF Process 1 with Router ID 10.1.1.2 Link State Database  Area: 0.0.0.0 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric Router    10.1.1.3        10.1.1.3           778  48    80000003       0 Router    10.1.1.2        10.1.1.2           782  48    80000002       0 Sum-Net   4.4.4.0         10.1.1.3           760  28    80000001    1562 Sum-Net   7.1.3.1         10.1.1.3           182  28    80000001    1562 Sum-Net   7.1.2.1         10.1.1.3           182  28    80000001    1562 Sum-Net   7.1.1.1         10.1.1.3           182  28    80000001    1562 AS External Database Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric External  6.1.2.1         10.1.1.2           202  36    80000001       1 External  6.1.3.1         10.1.1.2           202  36    80000001       1 External  6.1.1.1         10.1.1.2           202  36    80000001       1 External  3.3.3.0         10.1.1.2           791  36    80000001       1 External  3.3.3.2         10.1.1.2           791  36    80000001       1 External  10.1.1.2        10.1.1.2           791  36    80000001       1 1、2 在R1上加入如命令后: ospf 1 router-id 10.1.1.2 asbr-summary 6.1.0.0 255.255.0.0 import-route direct 在R2的区域1配置聚合的命令后 area 0.0.0.1    abr-summary 7.1.0.0 255.255.0.0 我们再来看路由表 <R4>dis ip ro Routing Tables: Public Destinations : 13       Routes : 13 Destination/Mask    Proto  Pre  Cost         NextHop         Interface 3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1 3.3.3.2/32          O_ASE  150  1            4.4.4.1         S0/6/1 4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1 4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1 4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0 6.1.0.0/16          O_ASE  150  2            4.4.4.1         S0/6/1  //聚合成功 7.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0 10.1.1.2/32         O_ASE  150  1            4.4.4.1         S0/6/1 10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 [R4]dis ospf lsdb OSPF Process 1 with Router ID 10.1.1.4 Link State Database  Area: 0.0.0.1 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric Router    10.1.1.4        10.1.1.4           391  84    80000005       0 Router    10.1.1.3        10.1.1.3           393  48    80000003       0 Sum-Net   3.3.3.0         10.1.1.3           401  28    80000002    1562 Sum-Asbr  10.1.1.2        10.1.1.3           401  28    80000002    1562 AS External Database Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric External  6.1.0.0         10.1.1.2            74  36    80000001       2 External  3.3.3.0         10.1.1.2           429  36    80000002       1 External  3.3.3.2         10.1.1.2           429  36    80000002       1 External  10.1.1.2        10.1.1.2           429  36    80000002       1 external 6.1.0.0/24的五类LSA由三条变为一条,说明聚合成功 <R1>dis ip ro Routing Tables: Public Destinations : 12       Routes : 12 Destination/Mask    Proto  Pre  Cost         NextHop         Interface 3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0 3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0 3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0 4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0 6.1.0.0/16          OSPF   255  0            0.0.0.0         NULL0 6.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0 6.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0 6.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.0.0/16          OSPF   10   3124         3.3.3.2         S0/6/0   //可见7.1.0.0/16网段已经聚合成功 10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 [R1]dis ospf lsdb OSPF Process 1 with Router ID 10.1.1.2 Link State Database  Area: 0.0.0.0 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric Router    10.1.1.3        10.1.1.3           357  48    80000004       0 Router    10.1.1.2        10.1.1.2           363  48    80000003       0 Sum-Net   4.4.4.0         10.1.1.3           340  28    80000002    1562 Sum-Net   7.1.0.0         10.1.1.3            29  28    80000001    1562 AS External Database Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric External  6.1.0.0         10.1.1.2            11  36    80000001       2 External  3.3.3.0         10.1.1.2           367  36    80000002       1 External  3.3.3.2         10.1.1.2           367  36    80000002       1 External  10.1.1.2        10.1.1.2           367  36    80000002       1 sum-net LSA 7.1.0.0/16由三条变为两条,聚合成功 附加说明: 利用abr-summary 过滤区域内的路由,对区域类型没有要求。 利用asbr-summary过滤区域内的外部路由,需要在区域内部的ASBR上配置,当ASBR很多时,配置比较复杂。 利用asbr-summary过滤区域内的外部路由,只需要在ABR上配置,但是要求区域必需为NSSA 。 二、用实验证明加了not-advertise后不通告匹配指定IP地址/掩码的路由。 在R1上加入如命令后: ospf 1 router-id 10.1.1.2 not-advertise asbr-summary 6.1.0.0 255.255.0.0 import-route direct 在R2的区域1配置聚合的命令后 area 0.0.0.1    abr-summary 7.1.0.0 255.255.0.0  not-advertise 1、我们来看R4的路由表 <R4>dis ip ro Routing Tables: Public Destinations : 14       Routes : 14 Destination/Mask    Proto  Pre  Cost         NextHop         Interface 2.2.2.0/30          OSPF   10   4686         4.4.4.1         S0/6/1 2.2.2.2/32          O_ASE  150  1            4.4.4.1         S0/6/1 3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1 3.3.3.2/32          O_ASE  150  1            4.4.4.1         S0/6/1 4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1 4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1 4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0 7.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0 7.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0 10.1.1.2/32         O_ASE  150  1            4.4.4.1         S0/6/1 10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 没有6.1.0.0/16网段的路由,说明ASBR没有把这个网段通告出来 2、我们来看R1的路由表 [R1]dis ip ro Routing Tables: Public Destinations : 13       Routes : 13 Destination/Mask    Proto  Pre  Cost         NextHop         Interface 2.2.2.0/30          Direct 0    0            2.2.2.1         S0/6/3 2.2.2.1/32          Direct 0    0            127.0.0.1       InLoop0 2.2.2.2/32          Direct 0    0            2.2.2.2         S0/6/3 3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0 3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0 3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0 4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0 6.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0 6.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0 6.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0 10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 没有7.1.0.0/16网段的路由,说明ASB没有把这个网段通告出来 这里要注间了,是ABR没有通网段通告出来,那ABR上应当有7.1.0.0/16的路由,也就是说R4是把路由传给R2的 请看R2的路由表 [R2]dis ip ro Routing Tables: Public Destinations : 15       Routes : 15 Destination/Mask    Proto  Pre  Cost         NextHop         Interface 2.2.2.0/30          OSPF   10   3124         3.3.3.1         S0/6/0 2.2.2.2/32          O_ASE  150  1            3.3.3.1         S0/6/0 3.3.3.0/30          Direct 0    0            3.3.3.2         S0/6/0 3.3.3.1/32          Direct 0    0            3.3.3.1         S0/6/0 3.3.3.2/32          Direct 0    0            127.0.0.1       InLoop0 4.4.4.0/30          Direct 0    0            4.4.4.1         S0/6/1 4.4.4.1/32          Direct 0    0            127.0.0.1       InLoop0 4.4.4.2/32          Direct 0    0            4.4.4.2         S0/6/1 7.1.1.1/32          OSPF   10   1562         4.4.4.2         S0/6/1 7.1.2.1/32          OSPF   10   1562         4.4.4.2         S0/6/1 7.1.3.1/32          OSPF   10   1562         4.4.4.2         S0/6/1 10.1.1.2/32         O_ASE  150  1            3.3.3.1         S0/6/0 10.1.1.3/32         Direct 0    0            127.0.0.1       InLoop0 127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0 127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 好了,实验到此结束,欢迎大家在线交流,共同学习 配置如下 R1 [R1-ospf-1]  dis cu # version 5.20, Alpha 1011 # sysname R1 # password-control login-attempt 3 exceed lock-time 120 # undo voice vlan mac-address 00e0-bb00-0000 # ipsec cpu-backup enable # undo cryptoengine enable # domain default enable system # vlan 1 # domain system access-limit disable state active idle-cut disable self-service-url disable # interface Serial0/6/0 link-protocol ppp ip address 3.3.3.1 255.255.255.252 # interface Serial0/6/1 link-protocol ppp # interface Serial0/6/2 link-protocol ppp # interface Serial0/6/3 link-protocol ppp # interface NULL0 # interface LoopBack0 ip address 10.1.1.2 255.255.255.255 # interface LoopBack1 ip address 6.1.1.1 255.255.255.255 # interface LoopBack2 ip address 6.1.2.1 255.255.255.255 #                interface LoopBack3 ip address 6.1.3.1 255.255.255.255 # interface Ethernet0/4/0 port link-mode bridge # interface Ethernet0/4/1 port link-mode bridge # interface Ethernet0/4/2 port link-mode bridge # interface Ethernet0/4/3 port link-mode bridge # interface Ethernet0/4/4 port link-mode bridge # interface Ethernet0/4/5 port link-mode bridge # interface Ethernet0/4/6 port link-mode bridge # interface Ethernet0/4/7 port link-mode bridge # ospf 1 router-id 10.1.1.2 asbr-summary 6.1.0.0 255.255.0.0 not-advertise import-route direct area 0.0.0.0 network 3.3.3.0 0.0.0.3 # load xml-configuration # user-interface con 0 user-interface vty 0 4 # return R2 <R2>dis cu # version 5.20, Alpha 1011 # sysname R2 # password-control login-attempt 3 exceed lock-time 120 # undo voice vlan mac-address 00e0-bb00-0000 # ipsec cpu-backup enable # undo cryptoengine enable # domain default enable system # vlan 1 # domain system access-limit disable state active idle-cut disable self-service-url disable # interface Serial0/6/0 link-protocol ppp ip address 3.3.3.2 255.255.255.252 # interface Serial0/6/1 link-protocol ppp ip address 4.4.4.1 255.255.255.252 # interface Serial0/6/2 link-protocol ppp # interface Serial0/6/3 link-protocol ppp # interface NULL0 # interface LoopBack0 ip address 10.1.1.3 255.255.255.255 # interface Ethernet0/4/0 port link-mode bridge # interface Ethernet0/4/1 port link-mode bridge # interface Ethernet0/4/2 port link-mode bridge # interface Ethernet0/4/3 port link-mode bridge # interface Ethernet0/4/4 port link-mode bridge # interface Ethernet0/4/5 port link-mode bridge # interface Ethernet0/4/6 port link-mode bridge # interface Ethernet0/4/7 port link-mode bridge # ospf 1 router-id 10.1.1.3 area 0.0.0.0 network 3.3.3.0 0.0.0.3 area 0.0.0.1    abr-summary 7.1.0.0 255.255.0.0  not-advertise  network 4.4.4.0 0.0.0.3 # load xml-configuration # user-interface con 0 user-interface vty 0 4 # return R4 [R4-ospf-1]dis cu # version 5.20, Alpha 1011 # sysname R4 # password-control login-attempt 3 exceed lock-time 120 # undo voice vlan mac-address 00e0-bb00-0000 # ipsec cpu-backup enable # undo cryptoengine enable # domain default enable system # vlan 1 # domain system access-limit disable state active idle-cut disable self-service-url disable # interface Serial0/6/0 link-protocol ppp # interface Serial0/6/1 link-protocol ppp ip address 4.4.4.2 255.255.255.252 # interface Serial0/6/2 link-protocol ppp # interface Serial0/6/3 link-protocol ppp # interface NULL0 # interface LoopBack0 ip address 10.1.1.4 255.255.255.255 # interface LoopBack1 ip address 7.1.1.1 255.255.255.255 # interface LoopBack2 ip address 7.1.2.1 255.255.255.255 #                interface LoopBack3 ip address 7.1.3.1 255.255.255.255 # interface Ethernet0/4/0 port link-mode bridge # interface Ethernet0/4/1 port link-mode bridge # interface Ethernet0/4/2 port link-mode bridge # interface Ethernet0/4/3 port link-mode bridge # interface Ethernet0/4/4 port link-mode bridge # interface Ethernet0/4/5 port link-mode bridge # interface Ethernet0/4/6 port link-mode bridge # interface Ethernet0/4/7 port link-mode bridge # ospf 1 router-id 10.1.1.4 area 0.0.0.1 network 4.4.4.0 0.0.0.3 network 7.1.1.1 0.0.0.0 network 7.1.2.1 0.0.0.0 network 7.1.3.1 0.0.0.0 # load xml-configuration # user-interface con 0 user-interface vty 0 4 # return

转载于:https://blog.51cto.com/hciewd/1120132

总结

以上是生活随笔为你收集整理的OSPF路由聚合实验(详细)的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。