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,造成环路。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: OSPF转发地址是一个在OSPF路由协议中的参数,被用来指定一种备用的路由。在OSPF协议中,可能会出现一个路由器无法到达下一跳的情况,此时就可以使用转发地址来指定另一条可到达下一跳的路由。具体来说,转发地址是在网络拓扑中,一个可到达下一跳的路由器指定的一个IP地址。这个地址可以被作为备用的下一跳地址,以便路由器在主路径无法通信时能够选择备用路径进行通信。 ### 回答2: OSPF转发地址是指用于指导OSPF路由选择算法的地址。在OSPF中,路由器收到一个数据包时会根据OSPF协议选择一个最佳的转发路径。在选择路径时,OSPF会参考多个因素,包括链路带宽、网络拓扑、路径状态以及OSPF转发地址等因素。 OSPF转发地址通常用于定义路由器在向外路由数据包时应该选择的路径。在这种情况下,OSPF路由器会评估所有可用路径,并选择一个最优路径来转发数据包。这个最优路径可以通过多种因素来决定,包括OSPF转发地址。 在OSPF中,每个接口都有一个IP地址和一个OSPF指向地址。OSPF指向地址是用于指示路由器在发送路由更新时应该使用的接口地址。例如,如果一个路由器有两个接口,并且OSPF转发地址是10.0.1.1,则路由器可能会选择使用这个地址来发送路由信息。这样可以确保其他路由器上的OSPF进程能够正确识别信息来源,并更新其路由表。 总之,OSPF转发地址是用于指导OSPF路由器在选择最佳路径时参考的重要因素之一。它使路由器能够更好地评估不同路径的优缺点,并选择最优路径,从而提高网络性能和可靠性。 ### 回答3: OSPF(开放最短路径优先)是一种由Internet Engineering Task Force(IETF)制定的动态路由协议。它允许路由器动态地构建网络拓扑图,并根据选择到目标地址的最短路径来交换路由信息。使用OSPF路由协议可以实现多种级别的高可用性和灵活性,使得路由器有意义地选择路径。 在OSPF中,当一个路由器收到另一个路由器的LSA(链路状态广告)消息时,它会根据消息中包含的所有路由器和它们之间的距离来更新其路由表。在处理LSA消息时,OSPF可以使用“forwarding address”机制来确定下一跳路由器。该机制是将LSA消息中所包含的目标网络地址的下一跳路由器的IP地址与“forwarding address”关联。路由器在将数据包发送到目标网络地址时,会首先将数据包路由到此关联的下一跳的“forwarding address”,而不是发送到目标网络地址的直接连接。 这种机制对于某些网络环境非常有用,例如当两个相邻的路由器之间存在多个不同的网络时,这些网络都将通过相同的链路发送。在这种情况下,可以使用“forwarding address”机制来告诉路由器在数据包到达目标网络时将数据包转发到哪一个链路上。 需要注意的是,“forwarding address”机制并不是OSPF路由协议中的必要机制,并且在某些情况下可能会引起问题。因此,在配置OSPF时需要根据具体网络环境的不同来决定是否使用这种机制。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值