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