路由重分配和路由汇总
1. (1)汇总要起作用,首先IP子网地址要为汇总进行过规划
(2)summary-address为ospf进程指定了一个汇总地址和掩码,任何指定汇总地址范围内的更精确的地址都会被禁止
(3)对于eigrp的汇总是在指定接口下完成的,eigrp汇总禁止通告汇总范围以内的子网
2.试验拓扑:

3 试验步骤:
hostname R1
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
ip audit notify log
ip audit po max-events 100
ip ssh time-out 120
ip ssh authentication-retries 3
!
!
!
!
!
!
!
interface Loopback0
ip address 192.168.3.33 255.255.255.224
!
interface Loopback1
ip address 192.168.3.65 255.255.255.224
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
ip address 192.168.3.97 255.255.255.224
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 192.168.3.33 0.0.0.0 area 0
network 192.168.3.65 0.0.0.0 area 0
network 192.168.3.97 0.0.0.0 area 0
!
ip classless
no ip http server
no ip http secure-server
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 5 15
!
!
end
hostname R2
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
ip audit notify log
ip audit po max-events 100
ip ssh time-out 120
ip ssh authentication-retries 3
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 172.16.2.1 255.255.255.0
ip summary-address eigrp 2 192.168.3.0 255.255.255.0 5
duplex half
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
ip address 192.168.3.98 255.255.255.224
serial restart-delay 0
!
interface Serial2/2
ip address 192.168.3.129 255.255.255.224
ip summary-address eigrp 1 192.168.3.0 255.255.255.128 5
ip summary-address eigrp 1 172.16.0.0 255.255.0.0 5
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/3
no ip address
shutdown
serial restart-delay 0
!
router eigrp 1
redistribute ospf 1 metric 10000 100 1 255 1500
redistribute eigrp 2
network 192.168.3.129 0.0.0.0
no auto-summary
no eigrp log-neighbor-changes
!
router eigrp 2
redistribute eigrp 1
network 172.16.2.1 0.0.0.0
no auto-summary
no eigrp log-neighbor-changes
!
router ospf 1
log-adjacency-changes
summary-address 192.168.3.128 255.255.255.128
summary-address 172.16.0.0 255.255.0.0
redistribute eigrp 1 subnets
redistribute eigrp 2 metric 100 metric-type 1 subnets
network 192.168.3.98 0.0.0.0 area 0
!
ip classless
no ip http server
no ip http secure-server
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 5 15
!
!
end
hostname R3
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
ip audit notify log
ip audit po max-events 100
ip ssh time-out 120
ip ssh authentication-retries 3
!
!
!
!
!
!
!
interface Loopback0
ip address 192.168.3.161 255.255.255.224
!
interface Loopback1
ip address 192.168.3.193 255.255.255.224
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
ip address 192.168.3.130 255.255.255.224
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/3
no ip address
shutdown
serial restart-delay 0
!
router eigrp 1
network 192.168.3.130 0.0.0.0
network 192.168.3.161 0.0.0.0
network 192.168.3.193 0.0.0.0
no auto-summary
no eigrp log-neighbor-changes
!
ip classless
no ip http server
no ip http secure-server
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 5 15
!
!
end
hostname R4
!
!
ip subnet-zero
ip cef
!
!
no ip domain-lookup
!
ip audit notify log
ip audit po max-events 100
ip ssh time-out 120
ip ssh authentication-retries 3
!
!
!
!
!
!
!
interface Loopback0
ip address 172.16.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 172.16.2.2 255.255.255.0
duplex half
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/3
no ip address
shutdown
serial restart-delay 0
!
router eigrp 2
network 172.16.1.1 0.0.0.0
network 172.16.2.2 0.0.0.0
no auto-summary
no eigrp log-neighbor-changes
!
ip classless
no ip http server
no ip http secure-server
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 5 15
!
!
end
4 试验调试:
R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
O E2 172.16.0.0/16 [110/20] via 192.168.3.98, 01:03:59, Serial2/1
192.168.3.0/24 is variably subnetted, 6 subnets, 3 masks
C 192.168.3.96/27 is directly connected, Serial2/1
C 192.168.3.64/27 is directly connected, Loopback1
C 192.168.3.32/27 is directly connected, Loopback0
O E2 192.168.3.0/25 [110/20] via 192.168.3.98, 01:03:24, Serial2/1
O E1 192.168.3.0/24 [110/164] via 192.168.3.98, 01:03:24, Serial2/1
O E2 192.168.3.128/25 [110/20] via 192.168.3.98, 01:05:58, Serial2/1
ospf通告的汇总路由被标记为外部路由
R2# show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
D 172.16.0.0/16 is a summary, 01:04:44, Null0
D 172.16.1.0/24 [90/156160] via 172.16.2.2, 01:09:12, FastEthernet0/0
C 172.16.2.0/24 is directly connected, FastEthernet0/0
192.168.3.0/24 is variably subnetted, 9 subnets, 4 masks
C 192.168.3.96/27 is directly connected, Serial2/1
O 192.168.3.65/32 [110/65] via 192.168.3.97, 01:06:42, Serial2/1
O 192.168.3.33/32 [110/65] via 192.168.3.97, 01:06:42, Serial2/1
D 192.168.3.0/24 is a summary, 01:04:09, Null0
D 192.168.3.0/25 is a summary, 01:05:08, Null0
D 192.168.3.192/27 [90/2297856] via 192.168.3.130, 01:17:29, Serial2/2
D 192.168.3.160/27 [90/2297856] via 192.168.3.130, 01:17:29, Serial2/2
O 192.168.3.128/25 is a summary, 01:04:44, Null0
C 192.168.3.128/27 is directly connected, Serial2/2
空接口是一个不知道去往那里的软件接口,路由到它的数据包会被丢弃,除了某些特例(ospf内部区域汇总并不自动生成到空接口的汇总路由,它必须被静态配置。)外,每当路由产生一条汇总路由,路由器同时还会生成一条指向空接口的路由。
R3# show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
D 172.16.0.0/16 [90/2172416] via 192.168.3.129, 01:05:07, Serial2/1
192.168.3.0/24 is variably subnetted, 6 subnets, 3 masks
D EX 192.168.3.0/24 [170/2195456] via 192.168.3.129, 01:04:32, Serial2/1
D 192.168.3.0/25 [90/2195456] via 192.168.3.129, 01:05:31, Serial2/1
C 192.168.3.192/27 is directly connected, Loopback1
C 192.168.3.160/27 is directly connected, Loopback0
D EX 192.168.3.128/25 [170/2195456] via 192.168.3.129, 01:05:31, Serial2/1
C 192.168.3.128/27 is directly connected, Serial2/1
eigrp的汇总路由没有被标记为外部路由。192.168.3.128/25 和192.168.3.0/24 作为外部路由出现在R3中是因为,汇总路由被通告到ospf,接着又从ospf域被 重新分配到eigrp
R4#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
D EX 172.16.0.0/16 [170/30720] via 172.16.2.1, 01:04:55, FastEthernet0/0
C 172.16.1.0/24 is directly connected, Loopback0
C 172.16.2.0/24 is directly connected, FastEthernet0/0
D 192.168.3.0/24 [90/284160] via 172.16.2.1, 01:04:55, FastEthernet0/0
