EIGRP优化—路由汇总

版权声明: https://blog.csdn.net/Breeze_CAT/article/details/79711416

EIGRP路由汇总

汇总路由会进一步加快EIGRP的收敛时间,假如一台路由器收到一条某个网络查询消息时,而该网络正好被自己路由表中的一条汇总路由所包括,那么它便会立即对此查询进行应答。

自动汇总

自动汇总是EIGRP默认启动的根据主类网络类型进行的自动汇总,

我们以以下网络为例:
自动汇总拓扑图
对R1进行配置:

R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no sh

R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no sh

R1(config-if)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no sh

R1(config)#router eigrp 100 
R1(config-router)#no au

R1(config-router)#network 1.1.1.0 0.0.0.255

R1(config-router)#network 192.168.0.0 0.0.255.255

对R2进行配置:

R2(config)#int f0/0
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no sh

R2(config-if)#int lo 0
R2(config-if)#ip add 10.10.0.1 255.255.0.0
R2(config-if)#no sh

R2(config-if)#int lo 1
R2(config-if)#ip add 10.11.0.1 255.255.0.0
R2(config-if)#no sh

R2(config-if)#int lo 2
R2(config-if)#ip add 10.12.0.1 255.255.0.0
R2(config-if)#no sh

R2(config-if)#int lo 3
R2(config-if)#ip add 10.13.0.1 255.255.0.0
R2(config-if)#no sh

R2(config)#router eigrp 100
R2(config-router)#no au

R2(config-router)#network 10.0.0.0 0.255.255.255

R2(config-router)#network 192.168.1.0 0.0.0.255

对R3进行配置

R3(config)#int f0/1
R3(config-if)#ip add 192.168.2.2 255.255.255.0
R3(config-if)#no sh

R3(config-if)#int lo 0
R3(config-if)#ip add 10.64.0.1 255.255.0.0
R3(config-if)#no sh

R3(config-if)#int lo 1
R3(config-if)#ip add 10.65.0.1 255.255.0.0
R3(config-if)#no sh

R3(config-if)#int lo 2
R3(config-if)#ip add 10.66.0.1 255.255.0.0
R3(config-if)#no sh

R3(config)#router e 100
R3(config-router)#no au

R3(config-router)#network 10.0.0.0 0.255.255.255

R3(config-router)#network 192.168.0.0 0.0.255.255

这时我们查看以下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/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     10.0.0.0/16 is subnetted, 7 subnets
D       10.10.0.0 [90/409600] via 192.168.1.2, 00:08:37, FastEthernet0/0
D       10.11.0.0 [90/409600] via 192.168.1.2, 00:08:37, FastEthernet0/0
D       10.12.0.0 [90/409600] via 192.168.1.2, 00:08:37, FastEthernet0/0
D       10.13.0.0 [90/409600] via 192.168.1.2, 00:08:37, FastEthernet0/0
D       10.66.0.0 [90/409600] via 192.168.2.2, 00:07:41, FastEthernet0/1
D       10.64.0.0 [90/409600] via 192.168.2.2, 00:07:43, FastEthernet0/1
D       10.65.0.0 [90/409600] via 192.168.2.2, 00:07:43, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1

由标识D标志的7条路由条目为R1通过EIGRP收到的7个不同的内部网络。
我们先来尝试自动汇总
在R2上配置自动汇总
R2(config)#router eigrp 100
R2(config-router)#auto-summary
启用自动汇总时,邻居关系不会终止,而auto-summary这条命令会在有类网络边界自动汇总,而不需手动输入掩码。这条命令默认启动。

我们继续在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/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
D       10.0.0.0/8 [90/409600] via 192.168.1.2, 00:00:05, FastEthernet0/0
D       10.66.0.0/16 [90/409600] via 192.168.2.2, 00:54:23, FastEthernet0/1
D       10.64.0.0/16 [90/409600] via 192.168.2.2, 00:54:23, FastEthernet0/1
D       10.65.0.0/16 [90/409600] via 192.168.2.2, 00:54:23, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1

10.0.0.0/8替代了原来10.10.0.0/16~10.13.0.0/16的路由

我们再查看以下R2上的路由表

R2#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/24 is subnetted, 1 subnets
D       1.1.1.0 [90/409600] via 192.168.1.1, 00:58:51, FastEthernet0/0
     10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
C       10.10.0.0/16 is directly connected, Loopback0
C       10.11.0.0/16 is directly connected, Loopback1
C       10.12.0.0/16 is directly connected, Loopback2
C       10.13.0.0/16 is directly connected, Loopback3
D       10.0.0.0/8 is a summary, 00:03:39, Null0
D       10.66.0.0/16 [90/435200] via 192.168.1.1, 00:57:56, FastEthernet0/0
D       10.64.0.0/16 [90/435200] via 192.168.1.1, 00:57:57, FastEthernet0/0
D       10.65.0.0/16 [90/435200] via 192.168.1.1, 00:57:57, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
D    192.168.2.0/24 [90/307200] via 192.168.1.1, 00:58:53, FastEthernet0/0

我门看见这里多出了一条描述为10.0.0.0/8的目的网络,出接口为Null0。当配置了自动汇总后,这条路由会自动写入路由表,为了避免环路。假如R2接收到了一条被包括在10.0.0.0/8中的数据包,但却并不在路由表中,万一R2配置有去往R1的默认路由,则会把这个数据包发送给R1,而R1收到这个数据包后会根据汇总路由将其发回给R2,这样就会无限制的循环下去知道到达生存时间。所以这里将这条汇总路由写入路由表,并且出接口是Null0,这样就有效的防止了路由环路。

接下来我们再在R3上配置自动汇总
R3(config)#router eigrp 100
R3(config-router)#auto-summary
之后我们继续在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/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
D    10.0.0.0/8 [90/409600] via 192.168.2.2, 00:00:35, FastEthernet0/1
                [90/409600] via 192.168.1.2, 00:00:35, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1

我们可以看到,R2与R3上面的网络汇总之后都是10.0.0.0/8,所以R1收到了完全相同的汇总路由!而这两条路有有相同的开销(409600),所以会在这两条路有间执行等价负载均衡(后面介绍)。
我们尝试从R1ping10.10.0.1与10.11.0.1:

R1#ping 10.10.0.1           

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.0.1, timeout is 2 seconds:
UUUUU
Success rate is 0 percent (0/5)
R1#ping 10.11.0.1           

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.11.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/34/60 ms

在相同主机上的两个目的网络一个可达一个不可达(这次连通性测试发生什么情况都是有可能的,因为此路由已经不可靠,你不确定自己ping会不会通)说明由于汇总路由将两个邻居的网络都包含在内,这样R1很有可能将数据包发送给错误的邻居。

所以,自动汇总在无类网络不连续的网络中会造成连通性问题。因此只能在极少数情况下才有用,非常不建议使用自动汇总。

手动汇总

EIGRP手动汇总是需要我们人工进行计算来汇总路由,假如在这个例子中如何来手工汇总呢:
掩码汇总
使用我们刚刚学习子网掩码时的知识,很容易将这四个网段汇总为掩码为/13的一条路由:10.8.0.0/13。可见,R2上的所有换回口都被此汇总路由所包括,而R3上的10.64.0.0缺不被这个路由包括。
下面我们在R2上配置手动汇总:

R2(config)#router eigrp 100
R2(config-router)#no auto-summary 

R2(config)#int f0/0
R2(config-if)#ip summary-address eigrp 100 10.8.0.0 255.248.0.0

在EIGRP协议配置中使用no auto-summary 是关闭自动汇总,然后在需要发送汇总路由的端口进行手工汇总,命令为:ip summary-address eigrp as号 汇总ip 汇总掩码。
我们先关闭R3的自动汇总后再去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/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
D       10.8.0.0/13 [90/409600] via 192.168.1.2, 00:09:09, FastEthernet0/0
D       10.66.0.0/16 [90/409600] via 192.168.2.2, 00:00:03, FastEthernet0/1
D       10.64.0.0/16 [90/409600] via 192.168.2.2, 00:00:03, FastEthernet0/1
D       10.65.0.0/16 [90/409600] via 192.168.2.2, 00:00:03, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1

这条便是汇总路由
我们回到R2看一眼路由表;

R2#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/24 is subnetted, 1 subnets
D       1.1.1.0 [90/409600] via 192.168.1.1, 02:14:40, FastEthernet0/0
     10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
C       10.10.0.0/16 is directly connected, Loopback0
C       10.11.0.0/16 is directly connected, Loopback1
D       10.8.0.0/13 is a summary, 00:09:58, Null0
C       10.12.0.0/16 is directly connected, Loopback2
C       10.13.0.0/16 is directly connected, Loopback3
D       10.66.0.0/16 [90/435200] via 192.168.1.1, 00:00:52, FastEthernet0/0
D       10.64.0.0/16 [90/435200] via 192.168.1.1, 00:00:53, FastEthernet0/0
D       10.65.0.0/16 [90/435200] via 192.168.1.1, 00:00:53, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
D    192.168.2.0/24 [90/307200] via 192.168.1.1, 02:14:42, FastEthernet0/0

与自动汇总一样,为了防止出现环路,将次汇总以端口Null0为出接口写入到本机路由表中。
我们再来测试网络的连通性:

R1#ping 10.10.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/31/68 ms
R1#ping 10.11.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.11.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/31/48 ms
R1#ping 10.64.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.64.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/29/44 ms
R1#ping 10.65.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.65.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/39/52 ms

由此可见,网络已经连通!

猜你喜欢

转载自blog.csdn.net/Breeze_CAT/article/details/79711416