CCIELAB之路由重分布之单点双向重分布的汇总路由反馈_第1张图片

一。实验配置

R1:

R1#sh run
Building configuration...

Current configuration : 738 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!

!
interface Loopback0
ip address 1.1.1.1 255.255.255.255

!
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0

duplex auto
speed auto
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
router eigrp 100
network 0.0.0.0
no auto-summary

!
no ip http server
no ip http secure-server
!
!
!
!
!
control-plane
!
!
!

!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end

R3:

Building configuration...

Current configuration : 899 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!

!
!

interface Loopback0
ip address 3.3.3.1 255.255.255.255
!
interface Loopback1
ip address 3.3.3.2 255.255.255.255
!
interface Loopback3
ip address 3.3.3.3 255.255.255.255

!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 23.1.1.3 255.255.255.0
duplex auto
speed auto
!
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0

!
no ip http server
no ip http secure-server
!
!
!
!
!
control-plane
!
!

!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end


R2:

Building configuration...

Current configuration : 985 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!
!
!
!
!
!
!
!
!

!
interface Loopback2
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
ip summary-address eigrp 100 3.3.3.0 255.255.255.252 5  !对ospf的网段的路由进行手工汇总
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 23.1.1.2 255.255.255.0
duplex auto
speed auto
!
router eigrp 100
redistribute ospf 1 metric 10000 100 255 1 1500
network 12.1.1.2 0.0.0.0
no auto-summary

!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
redistribute eigrp 100 subnets
network 23.1.1.2 0.0.0.0 area 0

!
no ip http server
no ip http secure-server
!
!
!
!
!
control-plane
!

!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!
end


二 各路由表

R1:
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
     3.0.0.0/30 is subnetted, 1 subnets
D       3.3.3.0 [90/284160] via 12.1.1.2, 00:08:14, FastEthernet0/0
     23.0.0.0/24 is subnetted, 1 subnets
D EX    23.1.1.0 [170/284160] via 12.1.1.2, 00:08:34, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets

C       12.1.1.0 is directly connected, FastEthernet0/0


R2:


Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
D       1.1.1.1 [90/156160] via 12.1.1.1, 00:09:51, FastEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback2
     3.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O       3.3.3.3/32 [110/2] via 23.1.1.3, 00:06:22, FastEthernet1/0
O       3.3.3.2/32 [110/2] via 23.1.1.3, 00:06:22, FastEthernet1/0
O       3.3.3.1/32 [110/2] via 23.1.1.3, 00:06:22, FastEthernet1/0
D       3.3.3.0/30 is a summary, 00:08:43, Null0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, FastEthernet1/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, FastEthernet0/0



R3:
Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O E2    1.1.1.1 [110/20] via 23.1.1.2, 00:06:48, FastEthernet1/0
     3.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C       3.3.3.3/32 is directly connected, Loopback3
C       3.3.3.2/32 is directly connected, Loopback1
C       3.3.3.1/32 is directly connected, Loopback0
O E2    3.3.3.0/30 [110/20] via 23.1.1.2, 00:06:48, FastEthernet1/0
     23.0.0.0/24 is subnetted, 1 subnets

C       23.1.1.0 is directly connected, FastEthernet1/0
     12.0.0.0/24 is subnetted, 1 subnets
O E2    12.1.1.0 [110/20] via 23.1.1.2, 00:06:49, FastEthernet1/0
 
 
三。实验分析
 
 
      从R3路由表可以发现,在R2对ospf域引入的路由进行手动汇总之后,该汇总后的路由条目又被重分布进ospf域.
     我们设想一下,如果此时R3上的3.3.3.3/32网段失效,那么R3前往3.3.3.3的报文将根据路由表发往R2,保文到达R2后,R2匹配指向null0的汇总路由条目,将报文丢弃,以避免环路的产生。发现并没有多大的问题。可是,当ospf域的直径很大时,那么目的地址为3.3.3.3的这条报文本来可以不从R3发出,却要将历经好几个节点才能被丢弃,大大浪费了带宽和设备的资源。
 
四,解决
 
 
解决的思路很简单,只要在R2上将eigrp重分布进ospf时,将这条汇总路由过滤即可
 
 
配置:
R2:
 
ip prefix-list 1 seq 5 permit 3.3.3.0/30
!
route-map filter deny 10
match ip address prefix-list 1
!
route-map filter permit 20
!
!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
redistribute eigrp 100 subnets route-map filter
network 23.1.1.2 0.0.0.0 area 0

再次查看R3的路由表:

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O E2    1.1.1.1 [110/20] via 23.1.1.2, 00:00:02, FastEthernet1/0
     3.0.0.0/32 is subnetted, 3 subnets
C       3.3.3.3 is directly connected, Loopback3
C       3.3.3.2 is directly connected, Loopback1
C       3.3.3.1 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, FastEthernet1/0
     12.0.0.0/24 is subnetted, 1 subnets
O E2    12.1.1.0 [110/20] via 23.1.1.2, 00:00:02, FastEthernet1/0

可以发现汇总的路由条目已消失。
 
 
 
PS:为什么R3会学到那条汇总的路由条目?其实最本质的原因还是路由重发布的原则问题,因为R2在本地汇总之后,在本地自动产生一条指向null0的汇总路由以避免路由环路,但也恰恰因为出现了这条路由条目,所以使其被引入进了ospf域