精华内容
下载资源
问答
  • OSPF路由汇总

    万次阅读 多人点赞 2018-03-27 23:23:34
    OSPF路由汇总 在不使用路由汇总的情况下,每个链路的LSA会发送到OSPF骨干一级其他区域中,这就造成了不必要的网络流量和路由开销。但假如使用路由汇总,只有汇总的路由会传播到骨干区域,避免了大量LSA占用带宽,...

    OSPF路由汇总

    在不使用路由汇总的情况下,每个链路的LSA会发送到OSPF骨干一级其他区域中,这就造成了不必要的网络流量和路由开销。但假如使用路由汇总,只有汇总的路由会传播到骨干区域,避免了大量LSA占用带宽,CPU以及内存资源。即便链路出现了故障,这种变化也不会传播到骨干网络中,使得骨干网络更加稳定。
    OSPF有两种汇总方式:

    域间汇总:

    域间汇总在ABR上进行,命令为在ospf进程下,area 1 range 192.168.20.0 25.255.252.0

    域间汇总演示

    以下面拓扑图为例
    这里写图片描述

    对R1进行配置:

    R1>en
    R1#conf t
    R1(config)#int lo 0
    R1(config-if)#ip add 1.1.1.1 255.255.255.255
    R1(config-if)#no sh
    R1(config-if)#int f0/0
    R1(config-if)#ip add 12.1.1.1 255.255.255.0
    R1(config-if)#no sh
    R1(config-if)#exi
    
    R1(config)#router os 100
    R1(config-router)#router-id 1.1.1.1
    R1(config-router)#net 1.1.1.1 0.0.0.0 a 0
    R1(config-router)#net 12.1.1.0 0.0.0.255 a 0
    R1(config-router)#exi

    对R2进行配置:

    R2>en
    R2#conf t
    R2(config)#int lo 0
    R2(config-if)#ip add 2.2.2.2 255.255.255.255
    R2(config-if)#no sh
    R2(config-if)#int f0/0
    R2(config-if)#ip add 12.1.1.2 255.255.255.0
    R2(config-if)#no sh
    R2(config-if)#exi
    R2(config)#int f0/1
    R2(config-if)#ip add 23.1.1.2 255.255.255.0
    R2(config-if)#no sh
    R2(config-if)#exi
    R2(config)#int f1/0
    R2(config-if)#ip add 24.1.1.2 255.255.255.0
    R2(config-if)#no sh
    R2(config-if)#exi
    
    R2(config)#router os 100
    R2(config-router)#router-id 2.2.2.2
    R2(config-router)#net 2.2.2.2 0.0.0.0 a 0
    R2(config-router)#net 12.1.1.0 0.0.0.255 a 0
    R2(config-router)#net 23.1.1.0 0.0.0.255 a 1
    R2(config-router)#net 24.1.1.0 0.0.0.255 a 2
    R2(config-router)#exi

    对R3进行配置:

    R3>en
    R3#conf t
    R3(config)#int lo 0
    R3(config-if)#ip add 3.3.3.3 255.255.255.255
    R3(config-if)#no sh
    R3(config-if)#int lo 1
    R3(config-if)#ip add 192.168.20.1 255.255.255.0
    R3(config-if)#no sh
    R3(config-if)#exi
    R3(config)#int lo 2
    R3(config-if)#ip add 192.168.21.1 255.255.255.0
    R3(config-if)#no sh
    R3(config-if)#int lo 3
    R3(config-if)#ip add 192.168.22.1 255.255.255.0
    R3(config-if)#no sh
    R3(config-if)#int lo 4
    R3(config-if)#ip add 192.168.23.1 255.255.255.0
    R3(config-if)#no sh
    R3(config-if)#exi
    R3(config)#int f0/1
    R3(config-if)#ip add 23.1.1.3 255.255.255.0
    R3(config-if)#no sh
    R3(config-if)#exi
    
    R3(config)#router os 100
    R3(config-router)#router-id 3.3.3.3 
    R3(config-router)#net 3.3.3.3 0.0.0.0 a 1
    R3(config-router)#net 192.168.20.1 0.0.0.255 a 1
    R3(config-router)#net 192.168.21.1 0.0.0.255 a 1
    R3(config-router)#net 192.168.22.1 0.0.0.255 a 1
    R3(config-router)#net 192.168.23.1 0.0.0.255 a 1
    R3(config-router)#net 23.1.1.0 0.0.0.255 a 1
    R3(config-router)#exi

    对R4进行配置:

    R4>en
    R4#conf t
    R4(config)#int lo 0
    R4(config-if)#ip add 4.4.4.4 255.255.255.255
    R4(config-if)#no sh
    R4(config-if)#int lo 1
    R4(config-if)#ip add 192.168.32.1 255.255.255.0
    R4(config-if)#no sh
    R4(config-if)#int lo 2
    R4(config-if)#ip add 192.168.33.1 255.255.255.0
    R4(config-if)#no sh
    R4(config-if)#int lo 3
    R4(config-if)#ip add 192.168.34.1 255.255.255.0
    R4(config-if)#no sh                            
    R4(config-if)#int lo 4                         
    R4(config-if)#ip add 192.168.34.1 255.255.255.0
    R4(config-if)#no sh                            
    R4(config-if)#int lo 5                         
    R4(config-if)#ip add 192.168.36.1 255.255.255.0
    R4(config-if)#no sh                            
    R4(config-if)#int lo 6                         
    R4(config-if)#ip add 192.168.36.1 255.255.255.0
    R4(config-if)#no sh                            
    R4(config-if)#int lo 7                         
    R4(config-if)#ip add 192.168.38.1 255.255.255.0
    R4(config-if)#no sh                            
    R4(config-if)#int lo 8                         
    R4(config-if)#ip add 192.168.38.1 255.255.255.0
    R4(config-if)#no sh                            
    R4(config-if)#int f0/1
    R4(config-if)#ip add 24.1.1.4 255.255.255.0
    R4(config-if)#no sh
    R4(config-if)#exi
    
    R4(config)#router os 100
    R4(config-router)#router-id 4.4.4.4
    R4(config-router)#net 4.4.4.4 0.0.0.0 a 2
    R4(config-router)#net 192.168.32.0 0.0.0.255 a 2
    R4(config-router)#net 192.168.33.0 0.0.0.255 a 2
    R4(config-router)#net 192.168.34.0 0.0.0.255 a 2
    R4(config-router)#net 192.168.35.0 0.0.0.255 a 2
    R4(config-router)#net 192.168.36.0 0.0.0.255 a 2   
    R4(config-router)#net 192.168.37.0 0.0.0.255 a 2
    R4(config-router)#net 192.168.38.0 0.0.0.255 a 2
    R4(config-router)#net 192.168.39.0 0.0.0.255 a 2   
    R4(config-router)#net 24.1.1.0 0.0.0.255 a 2
    R4(config-router)#exi

    配置成功后我们在R1上看一下路由表:

    R1#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is not set
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/11] via 12.1.1.2, 00:15:49, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
    O IA    3.3.3.3 [110/21] via 12.1.1.2, 00:13:26, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    O IA    4.4.4.4 [110/12] via 12.1.1.2, 00:11:49, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    O IA    23.1.1.0 [110/20] via 12.1.1.2, 00:15:48, FastEthernet0/0
         192.168.38.0/32 is subnetted, 1 subnets
    O IA    192.168.38.1 [110/12] via 12.1.1.2, 00:11:51, FastEthernet0/0
         192.168.21.0/32 is subnetted, 1 subnets
    O IA    192.168.21.1 [110/21] via 12.1.1.2, 00:13:29, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    O IA    24.1.1.0 [110/11] via 12.1.1.2, 00:15:42, FastEthernet0/0
         192.168.39.0/32 is subnetted, 1 subnets
    O IA    192.168.39.1 [110/12] via 12.1.1.2, 00:11:53, FastEthernet0/0
         192.168.20.0/32 is subnetted, 1 subnets
    O IA    192.168.20.1 [110/21] via 12.1.1.2, 00:13:30, FastEthernet0/0
         192.168.23.0/32 is subnetted, 1 subnets
    O IA    192.168.23.1 [110/21] via 12.1.1.2, 00:13:30, FastEthernet0/0
         192.168.36.0/32 is subnetted, 1 subnets
    O IA    192.168.36.1 [110/12] via 12.1.1.2, 00:11:55, FastEthernet0/0
         192.168.22.0/32 is subnetted, 1 subnets
    O IA    192.168.22.1 [110/21] via 12.1.1.2, 00:13:33, FastEthernet0/0
         192.168.37.0/32 is subnetted, 1 subnets
    O IA    192.168.37.1 [110/12] via 12.1.1.2, 00:11:56, FastEthernet0/0
         192.168.34.0/32 is subnetted, 1 subnets
    O IA    192.168.34.1 [110/12] via 12.1.1.2, 00:11:57, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
         192.168.35.0/32 is subnetted, 1 subnets
    O IA    192.168.35.1 [110/12] via 12.1.1.2, 00:11:58, FastEthernet0/0
         192.168.32.0/32 is subnetted, 1 subnets
    O IA    192.168.32.1 [110/12] via 12.1.1.2, 00:11:59, FastEthernet0/0
         192.168.33.0/32 is subnetted, 1 subnets
    O IA    192.168.33.1 [110/12] via 12.1.1.2, 00:12:00, FastEthernet0/0

    我们可以看见,由于域间路由的传播,R1上多达进20条路由,有R3宣告的4个,R4宣告的8个192.68网段的路由如果不进行汇总,会泛洪到全网,所以我们应该在Area 1和Area 2的ABR上也就是R2上进行汇总操作,具体操作如下:R2(config)#router os 100
    R2(config-router)#area 1 range 192.168.20.0 255.255.252.0
    R2(config-router)#area 2 range 192.168.32.0 255.255.248.0
    R2(config-router)#exi

    接下来我们去R1查看一下路由表:

    R1#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is not set
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/11] via 12.1.1.2, 00:20:48, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
    O IA    3.3.3.3 [110/21] via 12.1.1.2, 00:18:26, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    O IA    4.4.4.4 [110/12] via 12.1.1.2, 00:16:49, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    O IA    23.1.1.0 [110/20] via 12.1.1.2, 00:20:48, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    O IA    24.1.1.0 [110/11] via 12.1.1.2, 00:20:40, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
    O IA 192.168.20.0/22 [110/21] via 12.1.1.2, 00:00:39, FastEthernet0/0
    O IA 192.168.32.0/21 [110/12] via 12.1.1.2, 00:00:18, FastEthernet0/0

    可以看见,Area 1和Area 2上的192.168网段已经完成了汇总。这样会节省很多资源,拓扑发生变化也不会影响Area 0的路由表。

    域外汇总

    域外汇总需在ASBR上进行,命令为summary-address 192.168.20.0 25.255.252.0

    域外汇总演示

    我们拓扑图不变,但将Area 2变为EIGRP
    这里写图片描述
    在R2上面更改配置:

    R2(config)#router os 100
    R2(config-router)#no net 24.1.1.0 0.0.0.255 a 2
    R2(config-router)#exi
    
    R2(config)#router ei 90
    R2(config-router)#no au
    R2(config-router)#net 24.1.1.0 0.0.0.255
    R2(config-router)#exi

    在R4上更改:

    R4(config)#no router os 100
    
    R4(config)#router ei 90
    R4(config-router)#no au
    R4(config-router)#net 24.1.1.0 0.0.0.255
    R4(config-router)#net 4.4.4.4 0.0.0.0
    R4(config-router)#net 192.168.32.0 0.0.0.255
    R4(config-router)#net 192.168.33.0 0.0.0.255
    R4(config-router)#net 192.168.34.0 0.0.0.255
    R4(config-router)#net 192.168.35.0 0.0.0.255
    R4(config-router)#net 192.168.36.0 0.0.0.255
    R4(config-router)#net 192.168.37.0 0.0.0.255
    R4(config-router)#net 192.168.38.0 0.0.0.255
    R4(config-router)#net 192.168.39.0 0.0.0.255
    R4(config-router)#exi

    之后我们在R2上进行双向重分发

    R2(config)#router os 100
    R2(config-router)#redistribute eigrp 90 subnets 
    R2(config-router)#exi
    
    R2(config)#router ei 90
    R2(config-router)#redistribute ospf 100 metric 1000 1 255 1 1500
    R2(config-router)#exi

    之后再R1查看路由表:

    R1#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is not set
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/11] via 12.1.1.2, 00:01:31, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
    O IA    3.3.3.3 [110/21] via 12.1.1.2, 00:01:31, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    O E2    4.4.4.4 [110/20] via 12.1.1.2, 00:01:31, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    O IA    23.1.1.0 [110/20] via 12.1.1.2, 00:01:31, FastEthernet0/0
    O E2 192.168.38.0/24 [110/20] via 12.1.1.2, 00:01:32, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    O E2    24.1.1.0 [110/20] via 12.1.1.2, 00:01:32, FastEthernet0/0
    O E2 192.168.39.0/24 [110/20] via 12.1.1.2, 00:01:33, FastEthernet0/0
    O E2 192.168.36.0/24 [110/20] via 12.1.1.2, 00:01:34, FastEthernet0/0
    O E2 192.168.37.0/24 [110/20] via 12.1.1.2, 00:01:34, FastEthernet0/0
    O E2 192.168.34.0/24 [110/20] via 12.1.1.2, 00:01:34, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
    O E2 192.168.35.0/24 [110/20] via 12.1.1.2, 00:01:35, FastEthernet0/0
    O E2 192.168.32.0/24 [110/20] via 12.1.1.2, 00:01:35, FastEthernet0/0
    O E2 192.168.33.0/24 [110/20] via 12.1.1.2, 00:01:35, FastEthernet0/0
    O IA 192.168.20.0/22 [110/21] via 12.1.1.2, 00:01:35, FastEthernet0/0

    可以看见O E2标记的为外部的EIGRP路由,并没有汇总,下面我们在R2上进行域外路由的汇总:

    R2(config)#router os 100
    R2(config-router)#summary-address 192.168.32.0 255.255.248.0
    R2(config-router)#exi

    然后我们在R1上查看路由表:

    R1#show ip route    
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is not set
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/11] via 12.1.1.2, 00:04:44, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
    O IA    3.3.3.3 [110/21] via 12.1.1.2, 00:04:44, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    O E2    4.4.4.4 [110/20] via 12.1.1.2, 00:04:44, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    O IA    23.1.1.0 [110/20] via 12.1.1.2, 00:04:44, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    O E2    24.1.1.0 [110/20] via 12.1.1.2, 00:04:46, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
    O IA 192.168.20.0/22 [110/21] via 12.1.1.2, 00:04:47, FastEthernet0/0
    O E2 192.168.32.0/21 [110/20] via 12.1.1.2, 00:00:08, FastEthernet0/0

    ok!已经完成了汇总!

    下放默认路由的方法

    假如我们有一条通往Internet的默认路由,但我们如何将它下放到ospf域内的所有路由器呢,以免我们一台一台的配置,接下来我们还是按照上一个拓扑图来演示一下:
    这里写图片描述
    我们假定R2去往R4的就是默认路由,那么我们先在R2上面进行配置:

    R2(config)#ip route 0.0.0.0 0.0.0.0 f1/0
    R2(config)#do show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is 0.0.0.0 to network 0.0.0.0
    
         1.0.0.0/32 is subnetted, 1 subnets
    O       1.1.1.1 [110/11] via 12.1.1.1, 00:08:40, FastEthernet0/0
         2.0.0.0/32 is subnetted, 1 subnets
    C       2.2.2.2 is directly connected, Loopback0
         3.0.0.0/32 is subnetted, 1 subnets
    O       3.3.3.3 [110/11] via 23.1.1.3, 00:08:40, FastEthernet0/1
         4.0.0.0/32 is subnetted, 1 subnets
    D       4.4.4.4 [90/156160] via 24.1.1.4, 00:14:42, FastEthernet1/0
         23.0.0.0/24 is subnetted, 1 subnets
    C       23.1.1.0 is directly connected, FastEthernet0/1
    D    192.168.38.0/24 [90/156160] via 24.1.1.4, 00:14:09, FastEthernet1/0
         192.168.21.0/32 is subnetted, 1 subnets
    O       192.168.21.1 [110/11] via 23.1.1.3, 00:08:41, FastEthernet0/1
         24.0.0.0/24 is subnetted, 1 subnets
    C       24.1.1.0 is directly connected, FastEthernet1/0
    D    192.168.39.0/24 [90/156160] via 24.1.1.4, 00:14:05, FastEthernet1/0
         192.168.20.0/32 is subnetted, 1 subnets
    O       192.168.20.1 [110/11] via 23.1.1.3, 00:08:44, FastEthernet0/1
         192.168.23.0/32 is subnetted, 1 subnets
    O       192.168.23.1 [110/11] via 23.1.1.3, 00:08:44, FastEthernet0/1
    D    192.168.36.0/24 [90/156160] via 24.1.1.4, 00:14:20, FastEthernet1/0
         192.168.22.0/32 is subnetted, 1 subnets
    O       192.168.22.1 [110/11] via 23.1.1.3, 00:08:45, FastEthernet0/1
    D    192.168.37.0/24 [90/156160] via 24.1.1.4, 00:14:17, FastEthernet1/0
    D    192.168.34.0/24 [90/156160] via 24.1.1.4, 00:14:28, FastEthernet1/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
    D    192.168.35.0/24 [90/156160] via 24.1.1.4, 00:14:26, FastEthernet1/0
    D    192.168.32.0/24 [90/156160] via 24.1.1.4, 00:14:36, FastEthernet1/0
    D    192.168.33.0/24 [90/156160] via 24.1.1.4, 00:14:33, FastEthernet1/0
    S*   0.0.0.0/0 is directly connected, FastEthernet1/0
    O    192.168.20.0/22 is a summary, 00:08:47, Null0
    O    192.168.32.0/21 is a summary, 00:04:08, Null0

    我们看见表姐为*的就是默认路由,已经配置完毕,下面我们在Area 0和Area 1进行下放默认路由。
    R2(config)#router os 100
    R2(config-router)#default-information originate

    接下来分别在R1和R3上查看路由表:

    R1#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is 12.1.1.2 to network 0.0.0.0
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/11] via 12.1.1.2, 00:10:14, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
    O IA    3.3.3.3 [110/21] via 12.1.1.2, 00:10:14, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    O E2    4.4.4.4 [110/20] via 12.1.1.2, 00:10:14, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    O IA    23.1.1.0 [110/20] via 12.1.1.2, 00:10:15, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    O E2    24.1.1.0 [110/20] via 12.1.1.2, 00:10:15, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
    O*E2 0.0.0.0/0 [110/1] via 12.1.1.2, 00:00:11, FastEthernet0/0
    O IA 192.168.20.0/22 [110/21] via 12.1.1.2, 00:10:17, FastEthernet0/0
    O E2 192.168.32.0/21 [110/20] via 12.1.1.2, 00:05:38, FastEthernet0/0
    R3#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is 23.1.1.2 to network 0.0.0.0
    
         1.0.0.0/32 is subnetted, 1 subnets
    O IA    1.1.1.1 [110/21] via 23.1.1.2, 00:11:46, FastEthernet0/1
         2.0.0.0/32 is subnetted, 1 subnets
    O IA    2.2.2.2 [110/11] via 23.1.1.2, 00:11:46, FastEthernet0/1
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
         4.0.0.0/32 is subnetted, 1 subnets
    O E2    4.4.4.4 [110/20] via 23.1.1.2, 00:11:46, FastEthernet0/1
         23.0.0.0/24 is subnetted, 1 subnets
    C       23.1.1.0 is directly connected, FastEthernet0/1
    C    192.168.21.0/24 is directly connected, Loopback2
         24.0.0.0/24 is subnetted, 1 subnets
    O E2    24.1.1.0 [110/20] via 23.1.1.2, 00:11:47, FastEthernet0/1
    C    192.168.20.0/24 is directly connected, Loopback1
    C    192.168.23.0/24 is directly connected, Loopback4
    C    192.168.22.0/24 is directly connected, Loopback3
         12.0.0.0/24 is subnetted, 1 subnets
    O IA    12.1.1.0 [110/20] via 23.1.1.2, 00:11:50, FastEthernet0/1
    O*E2 0.0.0.0/0 [110/1] via 23.1.1.2, 00:01:46, FastEthernet0/1
    O E2 192.168.32.0/21 [110/20] via 23.1.1.2, 00:07:12, FastEthernet0/1

    我们都看到了O*E2的这条默认路由标记,因为下方的路由属于静态的路由,自然属于OSPF域外路由,所以标记为O E2,单又是默认路由,所以就是O*E2。

    那如果我们没有在R2上配置默认路由,但我们想让其他设备将通往R2的路由设置为默认路由该如何进行配置呢?
    首先我们将R2还原:
    R2(config)#no ip route 0.0.0.0 0.0.0.0 f1/0
    R2(config)#router os 100
    R2(config-router)#no default-information originate

    之后我们再去R1看一下路由表:

    R1#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is not set
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/11] via 12.1.1.2, 00:16:32, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
    O IA    3.3.3.3 [110/21] via 12.1.1.2, 00:16:32, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    O E2    4.4.4.4 [110/20] via 12.1.1.2, 00:16:32, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    O IA    23.1.1.0 [110/20] via 12.1.1.2, 00:16:32, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    O E2    24.1.1.0 [110/20] via 12.1.1.2, 00:16:34, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
    O IA 192.168.20.0/22 [110/21] via 12.1.1.2, 00:16:34, FastEthernet0/0
    O E2 192.168.32.0/21 [110/20] via 12.1.1.2, 00:11:54, FastEthernet0/0

    默认路由消失,然后我们在OSPF进程下进行下放默认路由:
    R2(config-router)#default-information originate always

    然后再去R1查看路由表:

    R1#show ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    
    Gateway of last resort is 12.1.1.2 to network 0.0.0.0
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/11] via 12.1.1.2, 00:18:07, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
    O IA    3.3.3.3 [110/21] via 12.1.1.2, 00:18:07, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    O E2    4.4.4.4 [110/20] via 12.1.1.2, 00:18:07, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    O IA    23.1.1.0 [110/20] via 12.1.1.2, 00:18:08, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    O E2    24.1.1.0 [110/20] via 12.1.1.2, 00:18:08, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
    O*E2 0.0.0.0/0 [110/1] via 12.1.1.2, 00:00:33, FastEthernet0/0
    O IA 192.168.20.0/22 [110/21] via 12.1.1.2, 00:18:10, FastEthernet0/0
    O E2 192.168.32.0/21 [110/20] via 12.1.1.2, 00:13:32, FastEthernet0/0

    综上,共有两种方式下放默认路由:

    1. 在本地有默认路由的情况下
      R2(config-router)#default-information originate
    2. 本地没有默认路由的情况下,强行下放默认路由
      R2(config-router)#default-information originate always
      默认cost=1并且是一个由LSA-5下放的
    展开全文
  • IP路由-OSPF路由汇总.docx
  • OSPF 路由汇总

    2017-08-02 12:30:00
    1. 关于路由汇总 路由汇总,又被称为路由聚合(Route Aggregation or RouteSummarization),指的是把一组路由汇聚成一条路由条目的操作。这组路由被称为明细路由,而所汇聚成的路由被称为汇总路由。路由汇总是...
    1. 关于路由汇总
     
    路由汇总,又被称为路由聚合(Route Aggregation or RouteSummarization),指的是把一组路由汇聚成一条路由条目的操作。这组路由被称为明细路由,而所汇聚成的路由被称为汇总路由。路由汇总是一种重要的思想,在大型的项目中是必须考虑的一个重点事项。我们都知道,随着网络的规模越来越大,网络中的设备所需维护的路由表项也就会越来越多,路由表的规模也就会逐渐变大,而路由表是需要占用设备的内存空间的,路由的查询也是需要占用设备的资源的,因此我们需要考虑(尤其在一些大型的网络中)在保证网络中路由畅通的同时,减小路由表的规模。路由汇总就是一个有效的手段。几乎所有的路由协议都支持路由汇总。RIP、EIGRP等协议支持自动及手工路由汇总,而OSPF只支持手工路由汇总。OSPF支持两种形式的手工自动汇总:一种部署在ABR上,另一种则部署在ASBR上。
     
    2. OSPF路由汇总案例
     
    网络拓扑如上图所示。R1、R2、R3、R4及R5运行OSPF,OSPF区域的规划如图。
    R5将三个直连网段(172.16.1.0/24、172.16.2.0/24及172.16.3.0/24)都network到OSPF。
    R1将三个直连网段(10.1.1.0/24、10.1.2.0/24及10.1.3.0/24)都重发布到OSPF。
    完成上述配置后,所有的路由器应该都能学习到全网的路由。
     
    2.1 在ABR上执行路由汇总
     
     
    在R3(ABR)上对Area2内的路由执行汇总:
    R3(config)# router ospf 1
    R3(config-router)# area 2 range 172.16.0.0 255.255.0.0 cost?
     
    注意,这种汇总方式(arearange)只能在ABR上配置,而且只能对ABR直接连接的区域中的Intra-Area路由( 区域内部路由)执行汇总。R3执行汇总后,R1及R2的路由表中将出现172.16.0.0/16的汇总路由,而不会再学习到明细路由。如此一来,R1及R2的路由表就精简了,而且当它们需要访问R5下挂的那三个网段时,可以通过这条汇总路由到达。
     
    要强点的是,如果不是在R3,而是在R2上对R5下挂的网段进行汇总,则无法实现。因此此时R3作为ABR,已经将描述这些网段的3类LSA注入到了Area0,而在R2上,是无法对这些3类LSA进行路由汇总的。
     
    2.2 在ASBR上执行路由汇总
     

    在R1上对其自己重发布进OSPF的路由执行汇总:
    router ospf 1
      summary-address 10.1.0.0 255.255.0.0
    完成上述配置后,R2、R3、R4及R5都会学习到一条10.1.0.0/16的汇总路由(使用Type-5LSA描述),而不会再学习到10.1.1.0/24、10.1.2.0/24以及10.1.3.0/24这三条明细路由。
     
    2.3 在NSSA的ABR上执行路由汇总
    将网络做一点小小的变更,Area1被配置为NSSA。R1将三条直连路由引入NSSA,R2会学习到这三条外部路由(Type-7LSA),并执行Type-7 LSA转Type-5 LSA的动作,因此其实R2既是ABR又是ASBR,这些Type-5LSA是由其产生的,那么R2也能执行路由汇总:
    router ospf 1
      summary-address 10.1.0.0 255.255.0.0
     
    3. OSPF汇总路由的防环设计



    在上图所示的场景中,R3将R5下挂的三个子网汇总成172.16.0.0/16并向R2通告这条汇总路由。R1则下发一条OSPF默认路由到整个OSPF域。此时R5下挂的某个子网里有PC中毒,疯狂扫描一个并不存在的子网的IP地址(如172.16.222.0/24子网),这些数据包被发给网关R5,R5通过路由表查询,最终将这些报文依照默认路由进行转发,也就是发送给R4,而R4也一样,将报文依照默认路由转发给R3,R3再转给R2,而R2由于已经收到R3传递过来的汇总路由( 172.16.0.0/16),因此经过路由表查询后,数据包的目的地址匹配上了这条汇总路由,于是它又把这些数据包丢回去给R3,数据包的目的地址在R3处匹配了默认路由,又被丢回R2,如此反复,直到报文的TTL递减为0。这就出现了环路。
     
    OSPF为了解决这个问题,在执行路由汇总时,会在本地自动产生一条指向Null0的路由。例如在R3处执行了路由汇总,则它会自动产生一条指向Null0的路由:
    O      172.16.0.0/16 is a summary, 00:00:02, Null0
    这样一来当再有类似事件发生,数据包将在R3这就被丢弃(匹配Null0路由)。
    实际上,当执行路由汇总时,自动在本地路由表产生一条指向Null0的路由是一种非常常规的防环手段,许多动态路由协议都具备这个特征。
     
     
     
     
    红茶三杯
     
    网络工程 | 数据通信 | 项目管理
    学习 沉淀 成长 分享
    站点://ccietea.com
     
    红茶三杯版权所有,转载请注明出处

    转载于:https://www.cnblogs.com/wuguan/p/7273281.html

    展开全文
  • OSPF路由汇总配置
  • ospf路由汇总

    2020-02-02 19:38:56
    ospf network-type broadcast lookback接口是点对点,默认子网掩码为32,修改为broadcast 就变成了24 [ospf-1-area12]abr-summary 10.10.0.0. 255.255.0.0 import-route direct 直连网段,产生5类LSA 10.50.1.1/24 ...

    int lookback 1
    ospf network-type broadcast
    lookback接口是点对点,默认子网掩码为32,修改为broadcast 就变成了24
    [ospf-1-area12]abr-summary 10.10.0.0. 255.255.0.0

    import-route direct 直连网段,产生5类LSA

    10.50.1.1/24
    10.50.2.2/24
    10.50.3.3/24
    10.50.4.4/24
    ================
    
    10.50.0000 0001.x
    10.50.0000 0010.x
    10.50.0000 0011.x
    10.50.0000 0100.x
    相同部位直接定,不同部位写0
    10.50.0000 0000.x 
    子网掩码,相同部位都是1
    255.255.1111 1000.0
    [ospf-1]asbr-summary 10.50.0.0 255.255.248.0
    
    展开全文
  • 17-OSPF路由协议详解——OSPF路由汇总

    千次阅读 2019-07-23 13:26:25
    OSPF路由汇总需要注意的是:不能在区域内汇总,区域内部的路由器无法执行汇总功能,一般汇总的流程是从常规区域汇总到主干区域。例如下图中展示了OSPF路由汇总的流程中area 0是主干区域,其他ar...

    通常在一个大型的企业网或校园网中,其网络拓扑是非常复杂的,路由器的路由表也会非常冗余,这会造成网络设备在转发数据流量时需要消耗更多的硬件资源,OSPF路由协议也不例外,因此就需要用到路由汇总技术。

    OSPF路由汇总需要注意的是:不能在区域内汇总,区域内部的路由器无法执行汇总功能,一般汇总的流程是从常规区域汇总到主干区域。例如下图中展示了OSPF路由汇总的流程中area 0是主干区域,其他area 10,20,30则是常规区域。

     

    下面我们分别在R1,R2,R3三台路由设备中配置接口的IP地址信息,以R1设备为例:

    R1#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    R1(config)#int loopback 1
    R1(config-if)#ip address 1.1.1.1 255.255.255.255
    R1(config-if)#exit
    R1(config)#int f0/0
    R1(config-if)#ip address 12.1.1.1 255.255.255.0
    R1(config-if)#no shutdown 
    R1(config-if)#exit
    R1(config)#int f0/1        
    R1(config-if)#ip address 13.1.1.1 255.255.255.0
    R1(config-if)#no shutdown 
    R1(config-if)#exit
    
    //再创建一个lo2口,配置4个ip地址
    R1(config)#int loopback 2
    R1(config-if)#ip address 192.168.0.1 255.255.255.0
    R1(config-if)#ip address 192.168.1.1 255.255.255.0 secondary 
    R1(config-if)#ip address 192.168.2.1 255.255.255.0 secondary 
    R1(config-if)#ip address 192.168.3.1 255.255.255.0 secondary 
    R1(config-if)#exit

    R2和R3设备的配置IP地址命令是类似的,这里直接略过......

     

     

    接下来分别在R1,R2,R3三台路由设备中配置OSPF路由协议并相互通告所在网络,R1设备配置如下:

    R1(config)#router ospf 100
    R1(config-router)#router-id 1.1.1.1
    R1(config-router)#network 1.1.1.1 0.0.0.0 area 10
    R1(config-router)#network 12.1.1.0 0.0.0.255 area 0
    R1(config-router)#network 13.1.1.0 0.0.0.255 area 0
    //通告lo2口所在网段
    R1(config-router)#network 192.168.0.0 0.0.0.255 area 10
    R1(config-router)#network 192.168.1.0 0.0.0.255 area 10
    R1(config-router)#network 192.168.2.0 0.0.0.255 area 10                                            
    R1(config-router)#network 192.168.3.0 0.0.0.255 area 10 
    R1(config-router)#

     

    R2设备配置如下:

    R2(config)#router ospf 100
    R2(config-router)#router-id 2.2.2.2
    R2(config-router)#network 2.2.2.2 0.0.0.0 area 20
    R2(config-router)#network 12.1.1.0 0.0.0.255 area 0
    R2(config-router)#network 23.1.1.0 0.0.0.255 area 0 
    R2(config-router)#exit

     

    R3设备配置如下:

    R3(config)#router ospf 100
    R3(config-router)#router-id 3.3.3.3
    R3(config-router)#network 3.3.3.3 0.0.0.0 area 30
    R3(config-router)#network 13.1.1.0 0.0.0.255 area 0
    R3(config-router)#network 23.1.1.0 0.0.0.255 area 0
    R3(config-router)#exit

     

     

    然后再查看R3的OSPF路由表信息:

    R3#show ip route ospf
         1.0.0.0/32 is subnetted, 1 subnets
    O IA    1.1.1.1 [110/2] via 13.1.1.1, 00:09:50, FastEthernet0/0
         2.0.0.0/32 is subnetted, 1 subnets
    O IA    2.2.2.2 [110/2] via 23.1.1.2, 00:09:40, FastEthernet0/1
         192.168.0.0/32 is subnetted, 1 subnets
    O IA    192.168.0.1 [110/2] via 13.1.1.1, 00:03:08, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    O       12.1.1.0 [110/2] via 23.1.1.2, 00:09:40, FastEthernet0/1
                     [110/2] via 13.1.1.1, 00:09:50, FastEthernet0/0
    O IA 192.168.1.0/24 [110/2] via 13.1.1.1, 00:02:58, FastEthernet0/0
    O IA 192.168.2.0/24 [110/2] via 13.1.1.1, 00:02:38, FastEthernet0/0
    O IA 192.168.3.0/24 [110/2] via 13.1.1.1, 00:02:28, FastEthernet0/0

    我们发现R3从R1设备中学到了4条路由信息,当然R2也从R1设备中学到了这4条路由信息(通过show命令可以查看R2的OSPF路由表信息进行验证),为了减少主干区域的链路状态数据库和路由表大小从而降低路由器的压力,因此需要在R1设备采用路由汇总技术。

     

     

    这里我们在R1设备处进行路由汇总,配置如下:

    R1(config)#router ospf 100
    R1(config-router)#area 10 range 192.168.0.0 255.255.252.0
    R1(config-router)#exit

    area 10 range 192.168.0.0 255.255.252.0,这条命令的意思是把常规区域10中192.168.1.0开始的4条精细路由信息全部都汇总到主干区域0中。

     

     

    经过OSPF路由汇总后,再查看R3设备的OSPF路由表信息:

    R3#show ip route ospf
         1.0.0.0/32 is subnetted, 1 subnets
    O IA    1.1.1.1 [110/2] via 13.1.1.1, 00:17:47, FastEthernet0/0
         2.0.0.0/32 is subnetted, 1 subnets
    O IA    2.2.2.2 [110/2] via 23.1.1.2, 00:17:37, FastEthernet0/1
         12.0.0.0/24 is subnetted, 1 subnets
    O       12.1.1.0 [110/2] via 23.1.1.2, 00:17:37, FastEthernet0/1
                     [110/2] via 13.1.1.1, 00:17:47, FastEthernet0/0
    O IA 192.168.0.0/22 [110/2] via 13.1.1.1, 00:00:12, FastEthernet0/0

     

    很明显,进行路由汇总之后,R3的路由表明显简化了很多,将这4条精细路由信息都汇总成了192.168.0.0这一条路由信息。

    注意路由信息前面的“O IA”,上面的“O IA”表示R3路由设备收到R1和R2区域间路由汇总的路由信息。

     

    展开全文
  • 实验二十————OSPF路由汇总的配置.pdf

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 7,184
精华内容 2,873
关键字:

ospf路由汇总