关于OSPF中LSA5产生的路由和LSA7产生的同一条路由的优先使用规测。

关于OSPF中LSA5产生的路由和LSA7产生的同一条路由的优先使用规测。

关于OSPF中LSA5产生的路由和LSA7产生的同一条路由的优先使用规测。_第1张图片R1配置:

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 FastEthernet0/1

 ip address 14.1.1.1 255.255.255.0

 duplex auto

 speed auto

!

router ospf 1

 router-id 1.1.1.1

 log-adjacency-changes

 redistribute static metric 21 subnets

 network 1.1.1.1 0.0.0.0 area 0

 network 12.1.1.0 0.0.0.255 area 0

!

ip classless

ip route 44.1.1.0 255.255.255.0 14.1.1.2

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

 

     34.0.0.0/24 is subnetted, 1 subnets

O IA    34.1.1.0 [110/3] via 12.1.1.2, 00:10:30, FastEthernet0/0

     1.0.0.0/32 is subnetted, 1 subnets

C       1.1.1.1 is directly connected, Loopback0

     32.0.0.0/24 is subnetted, 1 subnets

O IA    32.1.1.0 [110/2] via 12.1.1.2, 00:10:30, 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:30, FastEthernet0/0

     12.0.0.0/24 is subnetted, 1 subnets

C       12.1.1.0 is directly connected, FastEthernet0/0

     44.0.0.0/24 is subnetted, 1 subnets

S       44.1.1.0 [1/0] via 14.1.1.2

     14.0.0.0/24 is subnetted, 1 subnets

C       14.1.1.0 is directly connected, FastEthernet0/1

R1#

配置中R1上写了一条到R4  loop1 ip=44.1.1.0网段的静态路由,然后把这条路由重分发到了OSPF域内。

 

 

在看R4的配置:

interface Loopback0

 ip address 4.4.4.4 255.255.255.255

!

interface Loopback1

 ip address 44.1.1.1 255.255.255.0

!

interface FastEthernet0/0

 ip address 34.1.1.2 255.255.255.0

 duplex auto

 speed auto

!

interface FastEthernet0/1

 ip address 14.1.1.2 255.255.255.0

 duplex auto

 speed auto

!

router ospf 1

 log-adjacency-changes

 area 1 nssa

 redistribute connected subnets

 network 34.1.1.0 0.0.0.255 area 1

!

R4#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

 

     34.0.0.0/24 is subnetted, 1 subnets

C       34.1.1.0 is directly connected, FastEthernet0/0

     1.0.0.0/32 is subnetted, 1 subnets

O IA    1.1.1.1 [110/4] via 34.1.1.1, 00:09:28, FastEthernet0/0

     32.0.0.0/24 is subnetted, 1 subnets

O       32.1.1.0 [110/2] via 34.1.1.1, 00:09:28, FastEthernet0/0

     4.0.0.0/32 is subnetted, 1 subnets

C       4.4.4.4 is directly connected, Loopback0

     12.0.0.0/24 is subnetted, 1 subnets

O IA    12.1.1.0 [110/3] via 34.1.1.1, 00:09:28, FastEthernet0/0

     44.0.0.0/24 is subnetted, 1 subnets

C       44.1.1.0 is directly connected, Loopback1

     14.0.0.0/24 is subnetted, 1 subnets

C       14.1.1.0 is directly connected, FastEthernet0/1

 

R4作为ASBR路由器,把路由器R4 connect的路由41.1.1.0重分发到OSPF域内。

 

41.1.1.0那条路由通过R4发布到ospf域内的时候,他会以LSA7的类型广播到nssa区域,所以R3R2的链路状态数据库内都会有着条路由的LSA7的链路状态通告。

41.1.1.0那条路由也通过R1发布到ospf域内,这时候他会以lsa5的类型广播到area0内(本来可以广播到整个ospf域内,但是area1NSSA区域,不会接受外部lsa也就是lsa5。这样在41.1.1.0这个lsa5会在R1R2产生。

R2# show ip ospf database

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Router Link States (Area 0)

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

1.1.1.1         1.1.1.1         1693        0x8000000A 0x00D11A 2

2.2.2.2         2.2.2.2         1034        0x80000009 0x007F78 1

 

                Net Link States (Area 0)

 

Link ID         ADV Router      Age         Seq#       Checksum

12.1.1.2        2.2.2.2         1034        0x80000007 0x00060A

 

                Summary Net Link States (Area 0)

 

Link ID         ADV Router      Age         Seq#       Checksum

32.1.1.0        2.2.2.2         788         0x8000000C 0x00887E

34.1.1.0        2.2.2.2         1786        0x8000000B 0x007A8A

 

                Router Link States (Area 1)

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.2         2.2.2.2         1414        0x8000000D 0x00784E 1

3.3.3.3         3.3.3.3         1411        0x80000011 0x00A7BA 2

4.4.4.4         4.4.4.4         1754        0x8000000A 0x000BAB 1

 

                Net Link States (Area 1)

 

Link ID         ADV Router      Age         Seq#       Checksum

32.1.1.2        3.3.3.3         799         0x80000008 0x00DA0E

34.1.1.1        3.3.3.3         1818        0x80000003 0x0039AB

 

                Summary Net Link States (Area 1)

 

Link ID         ADV Router      Age         Seq#       Checksum

1.1.1.1         2.2.2.2         1035        0x80000005 0x00D054

12.1.1.0        2.2.2.2         1035        0x80000005 0x0041DA

 

                Type-7 AS External Link States (Area 1)

 

Link ID         ADV Router      Age         Seq#       Checksum Tag

4.4.4.4         4.4.4.4         1754        0x80000005 0x00C685 0

14.1.1.0        4.4.4.4         1736        0x80000001 0x00B996 0

44.1.1.0        4.4.4.4         1754        0x80000005 0x002A04 0

 

                Type-5 AS External Link States

 

Link ID         ADV Router      Age         Seq#       Checksum Tag

4.4.4.4         2.2.2.2         1787        0x80000003 0x009BC4 0

14.1.1.0        2.2.2.2         1737        0x80000001 0x008AD7 0

44.1.1.0        1.1.1.1         1589        0x80000004 0x0078F1 0

44.1.1.0        2.2.2.2         1588        0x80000001 0x000341 0

R2#

   这样看来也就是在R2lsadb内,对于41.1.1.0这个路由信息,lsa5lsa7各自有一条。那到底选哪一条做为真正的转发路径呢?

如果按照TCP-IP路由技术的说法就是:区域内路由>区域外路由>ospf域外路由LSA5>OSPF域外路由LSA7。如果按照这个规则则路由表中会出现LSA5产生的路由。

察看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

 

     34.0.0.0/24 is subnetted, 1 subnets

O       34.1.1.0 [110/2] via 32.1.1.2, 00:01:01, FastEthernet0/1

     1.0.0.0/32 is subnetted, 1 subnets

O       1.1.1.1 [110/2] via 12.1.1.1, 00:01:01, FastEthernet0/0

     32.0.0.0/24 is subnetted, 1 subnets

C       32.1.1.0 is directly connected, FastEthernet0/1

     2.0.0.0/32 is subnetted, 1 subnets

C       2.2.2.2 is directly connected, Loopback0

     4.0.0.0/32 is subnetted, 1 subnets

O N2    4.4.4.4 [110/20] via 32.1.1.2, 00:01:01, FastEthernet0/1

     12.0.0.0/24 is subnetted, 1 subnets

C       12.1.1.0 is directly connected, FastEthernet0/0

     44.0.0.0/24 is subnetted, 1 subnets

O E2    44.1.1.0 [110/20] via 12.1.1.1, 00:01:02, FastEthernet0/0

     14.0.0.0/24 is subnetted, 1 subnets

O N2    14.1.1.0 [110/20] via 32.1.1.2, 00:01:02, FastEthernet0/1

R2#

确实是这样。

 

查看R2内关于该条LSA

R2#show ip ospf database nssa-external 44.1.1.0

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Type-7 AS External Link States (Area 1)

 

  LS age: 649

  Options: (No TOS-capability, Type 7/5 translation, DC)

  LS Type: AS External Link

  Link State ID: 44.1.1.0 (External Network Number )

  Advertising Router: 4.4.4.4

  LS Seq Number: 80000006

  Checksum: 0x2805

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 34.1.1.2

        External Route Tag: 0

 

R2#show ip ospf database external 44.1.1.0

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Type-5 AS External Link States

 

  Routing Bit Set on this LSA

  LS age: 352

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 44.1.1.0 (External Network Number )

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000001

  Checksum: 0x74F9

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 0.0.0.0

        External Route Tag: 0

发现这俩条了LSAmetric也一样

那我们改变一下R1的配置,增大重新分发时候该路由的度量:

命令:redistribute  static  subnets metric 25

 

R2#show ip ospf database external 44.1.1.0

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Type-5 AS External Link States

 

  Routing Bit Set on this LSA

  LS age: 672

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 44.1.1.0 (External Network Number )

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000004

  Checksum: 0xA0C5

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 25

        Forward Address: 0.0.0.0

        External Route Tag: 0

 

R2#show ip ospf database nss  44.1.1.0   

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Type-7 AS External Link States (Area 1)

 

  Routing Bit Set on this LSA

  LS age: 1622

  Options: (No TOS-capability, Type 7/5 translation, DC)

  LS Type: AS External Link

  Link State ID: 44.1.1.0 (External Network Number )

  Advertising Router: 4.4.4.4

  LS Seq Number: 80000006

  Checksum: 0x2805

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 34.1.1.2

        External Route Tag: 0

 

检查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

 

     34.0.0.0/24 is subnetted, 1 subnets

O       34.1.1.0 [110/2] via 32.1.1.2, 00:01:01, FastEthernet0/1

     1.0.0.0/32 is subnetted, 1 subnets

O       1.1.1.1 [110/2] via 12.1.1.1, 00:01:01, FastEthernet0/0

     32.0.0.0/24 is subnetted, 1 subnets

C       32.1.1.0 is directly connected, FastEthernet0/1

     2.0.0.0/32 is subnetted, 1 subnets

C       2.2.2.2 is directly connected, Loopback0

     4.0.0.0/32 is subnetted, 1 subnets

O N2    4.4.4.4 [110/20] via 32.1.1.2, 00:01:01, FastEthernet0/1

     12.0.0.0/24 is subnetted, 1 subnets

C       12.1.1.0 is directly connected, FastEthernet0/0

     44.0.0.0/24 is subnetted, 1 subnets

O N2    44.1.1.0 [110/20] via 32.1.1.2, 00:00:31, FastEthernet0/1

     14.0.0.0/24 is subnetted, 1 subnets

O N2    14.1.1.0 [110/20] via 32.1.1.2, 00:01:02, FastEthernet0/1

该条路由变成了,O N2 也就是使用了lsa7的路由。也就是说没有按照区域内路由>区域外路由>ospf域外路由LSA5>OSPF域外路由LSA7这个规则。

 

 

总结:只有OSPF域内的ABR路由器才有可能同时收到类型LSA5和类型LSA7的同一条LSA,如果这俩条LSA都是以metric-tyoe 2的形式发布进去,并且metric相同的时候,该ABR路由器会优先选择LSA5产生的路由,但是当LSA7 metric大于LSA5  metric的时候 就会优先选择LSA7产生的路由。当lsa5metric-type 1的类型发布的时候,不管lsa5 metric大小,优先选择lsa5产生的路由。

 

 

本文出自 “冰河洗剑” 博客,转载请与作者联系!

你可能感兴趣的:(职场,休闲)