OSPF Forwarding Address 引起的環路

拓撲爲兩臺路由器通過ethernet直連,運行OSPF
R1----R2
R1上寫一條靜態路由,下一跳關聯到R2以太網的IP地址,重發布進OSPF,R2不會接收這個外部路由,因爲R1的forwarding address 符和non-0.0.0.0的條件,R2所看到的這條外部路由的forwarding address是它自己的以太網接口地址。

These conditions set the forwarding address field to a non−zero address:
OSPF is enabled on the ASBR's next hop interface AND
ASBR's next hop interface is non−passive under OSPF AND
ASBR's next hop interface is not point−to−point AND
ASBR's next hop interface is not point−to−multipoint AND
ASBR's next hop interface address falls under the network range specified in the router ospf command.

這時候把R1的以太網接口的網絡類型換成P2P的,R2收到的T5的LSA中轉發地址爲0.0.0.0,這時R2會將路由指回到R1,造成環路。

R1原始配置:
interface Loopback0
 ip address 1.1.1.1 255.255.255.255

interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0

router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 redistribute static subnets route-map S
 network 1.1.1.1 0.0.0.0 area 0
 network 192.168.12.1 0.0.0.0 area 0

ip route 12.12.12.12 255.255.255.255 192.168.12.2 tag 1

route-map S permit 10
 match tag 1

R2原始配置:
interface Loopback0
 ip address 2.2.2.2 255.255.255.255

interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0

router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.12.2 0.0.0.0 area 0


R2show ip ospf database external

            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: 272
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 12.12.12.12 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x9A59
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 192.168.12.2
        External Route Tag: 1

將R1-R2之間的鏈路類型改爲p2p
interface FastEthernet0/0
 ip ospf network point-to-point

R2show ip ospf database external

            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: 88
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 12.12.12.12 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000004
  Checksum: 0xABBC
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 1

R1show 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

C    192.168.12.0/24 is directly connected, FastEthernet0/0
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 192.168.12.2, 00:01:52, FastEthernet0/0
     12.0.0.0/32 is subnetted, 1 subnets
S       12.12.12.12 [1/0] via 192.168.12.2

R2show 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

C    192.168.12.0/24 is directly connected, FastEthernet0/0
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 192.168.12.1, 00:01:46, FastEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
     12.0.0.0/32 is subnetted, 1 subnets
O E2    12.12.12.12 [110/20] via 192.168.12.1, 00:01:46, FastEthernet0/0

如果R1的靜態路由寫爲:
ip route 12.12.12.12 255.255.255.255 f0/0 tag 1
那麼也會產生0.0.0.0的forwarding address,造成環路。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章