ASBR上配置外部OSPF路由汇总_第1张图片

 

对于从其他协议(例EIGRP)重分发到OSPF的每条外部路由,都使用一个外部LSA(5类LSA)进行通告。在ASBR中,可对5类LSA(重分发而来的的路由)进行汇总,然后将其注入OSPF域中。

 

 

 

R1配置:

interface Loopback1

 ip address 1.1.1.1 255.255.255.255

!

interface Loopback2

 ip address 1.1.2.1 255.255.255.255

!

interface Loopback3

 ip address 1.1.3.1 255.255.255.255

!

interface Loopback4

 ip address 1.1.4.1 255.255.255.255

!

interface Serial1/1

 ip address 10.0.1.1 255.255.255.0

 serial restart-delay 0

!

router ospf 1

 log-adjacency-changes

 network 1.1.1.0 0.0.0.255 area 0

 network 1.1.2.0 0.0.0.255 area 0

 network 1.1.3.0 0.0.0.255 area 0

 network 1.1.4.0 0.0.0.255 area 0

 network 10.0.1.0 0.0.0.255 area 0

!

 

R2配置:

interface Serial1/0

 ip address 10.0.1.2 255.255.255.0

 serial restart-delay 0

!

interface Serial1/1

 ip address 10.0.2.1 255.255.255.0

 serial restart-delay 0

!

router eigrp 1

 network 10.0.2.0 0.0.0.255

 auto-summary

!

router ospf 1

 redistribute eigrp 1 subnets           //将EIGRP网络的路由生分发到OSPF中

 network 10.0.1.0 0.0.0.255 area 0

!

 

R3配置:

interface Loopback1

 ip address 3.3.3.3 255.255.255.255

!

interface Loopback2

 ip address 3.3.2.3 255.255.255.0

!

interface Loopback3

 ip address 3.3.1.3 255.255.255.0

!

interface Loopback4

 ip address 3.3.4.3 255.255.255.0

!         

interface Serial1/0

 ip address 10.0.2.2 255.255.255.0

 serial restart-delay 0

!

router eigrp 1

 network 3.3.1.0 0.0.0.255

 network 3.3.2.0 0.0.0.255

 network 3.3.3.0 0.0.0.255

 network 3.3.4.0 0.0.0.255

 network 10.0.2.0 0.0.0.255

 no auto-summary

!

ip route 0.0.0.0 0.0.0.0 10.0.2.1           //创建一条默认路由

 

上述配置完成后查看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, 4 subnets

C       1.1.1.1 is directly connected, Loopback1

C       1.1.3.1 is directly connected, Loopback3

C       1.1.2.1 is directly connected, Loopback2

C       1.1.4.1 is directly connected, Loopback4

     3.0.0.0/8 is variably subnetted, 4 subnets, 2 masks

O E2    3.3.3.3/32 [110/20] via 10.0.1.2, 00:00:10, Serial1/1

O E2    3.3.1.0/24 [110/20] via 10.0.1.2, 00:00:10, Serial1/1

O E2    3.3.2.0/24 [110/20] via 10.0.1.2, 00:00:10, Serial1/1

O E2    3.3.4.0/24 [110/20] via 10.0.1.2, 00:00:10, Serial1/1

     10.0.0.0/24 is subnetted, 2 subnets

O E2    10.0.2.0 [110/20] via 10.0.1.2, 00:29:44, Serial1/1

C       10.0.1.0 is directly connected, Serial1/1

 

显示了EIGRP网络中的明细路由,其中3.3.1.0-3.3.4.0是连续网段,我们可以将其汇总成一条3.3.0.0/21的路由通告给R1,这将减少R1的路由条目。

 

在R2(ASBR)上做OSPF路由汇总:

 

R2#conf ter

R2(config)#router ospf 1

R2(config-router)#summary-address 3.3.0.0 255.255.248.0 

 

再次查看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, 4 subnets

C       1.1.1.1 is directly connected, Loopback1

C       1.1.3.1 is directly connected, Loopback3

C       1.1.2.1 is directly connected, Loopback2

C       1.1.4.1 is directly connected, Loopback4

     3.0.0.0/21 is subnetted, 1 subnets

O E2    3.3.0.0 [110/20] via 10.0.1.2, 00:02:42, Serial1/1

     10.0.0.0/24 is subnetted, 2 subnets

O E2    10.0.2.0 [110/20] via 10.0.1.2, 00:27:40, Serial1/1

C       10.0.1.0 is directly connected, Serial1/1