介绍:
本试验测试OSPF路由器收到某个外部网络的LSA 5通告时,如果转发地址不为0.0.0.0,对路径选择的影响。
转发地址如何影响LSA5选路:
以下拓扑,除了R8,均在Area 0;R3\R4重发布进OSPF的静态路由的下一跳地址为172.16.3.x。
注意:R3/R4不将172.16.3.x/24接口运行OSPF
Router 3
|
---|
interface Ethernet0 ip address 172.16.3.3 255.255.255.0 ip ospf cost 15 ! interface Serial0 ip address 172.16.2.3 255.255.255.0 ! router ospf 7 redistribute static subnets network 172.16.2.0 0.0.0.255 area 0 ! ip route 200.200.200.0 255.255.255.0 172.16.3.8 |
Router 4
|
---|
interface Ethernet0 ip address 172.16.3.4 255.255.255.0 ! interface Serial0 ip address 172.16.7.4 255.255.255.0 ! router ospf 7 redistribute static subnets network 172.16.7.0 0.0.0.255 area 0 ! ip route 200.200.200.0 255.255.255.0 172.16.3.8 |
因为R3/R4对应静态路由的下一跳接口不运行OSPF,因此产生的LSA 5均将Forwarding Address表示为0.0.0.0
Router 5
|
---|
router-5# show ip ospf database external OSPF Router with ID (172.16.6.5) (Process ID 7) Type-5 AS External Link States Routing Bit Set on this LSA LS age: 1514 Options: (No TOS-capability, DC) LS Type: AS External Link Link State ID: 200.200.200.0 (External Network Number ) Advertising Router: 172.16.3.3 LS Seq Number: 80000030 Checksum: 0x93C0 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 Routing Bit Set on this LSA LS age: 1922 Options: (No TOS-capability, DC) LS Type: AS External Link Link State ID: 200.200.200.0 (External Network Number ) Advertising Router: 172.16.7.4 LS Seq Number: 80000027 Checksum: 0x83D4 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 |
R5选择到达外部路由,根据到最近ASBR原则,会选择从R3访问外部路由:
Router 5
|
---|
router-5# show ip ospf border-routers OSPF Process 7 internal Routing Table Codes: i - Intra-area route, I - Inter-area route i 172.16.7.4 [74] via 172.16.6.6, Ethernet0, ASBR, Area 0, SPF 15 i 172.16.3.3 [64] via 172.16.2.3, Serial0, ASBR, Area 0, SPF 15 router-5# |
Router 5
|
---|
router-5# show 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 O E2 200.200.200.0/24 [110/20] via 172.16.2.3, 19:59:25, Serial0 172.16.0.0/24 is subnetted, 3 subnets C 172.16.6.0 is directly connected, Ethernet0 O 172.16.7.0 [110/74] via 172.16.6.6, 19:59:25, Ethernet0 C 172.16.2.0 is directly connected, Serial0 router-5# |
到这一步,看不出有任何异常。
接下来,将R3的E0口运行OSPF,会导致R3发布出来的LSA 5携带不为0.0.0.0的转发地址。
Router 3
|
---|
interface Ethernet0 ip address 172.16.3.3 255.255.255.0 ip ospf cost 15 ! router ospf 7 network 172.16.3.0 0.0.0.255 area 0 ! 增加以上粗体部分命令1条 |
在R5查看收到的LSA 5,较之前发生一些变化:
Router 5
|
---|
router-5# show ip ospf database external OSPF Router with ID (172.16.6.5) (Process ID 7) Type-5 AS External Link States Routing Bit Set on this LSA LS age: 270 Options: (No TOS-capability, DC) LS Type: AS External Link Link State ID: 200.200.200.0 (External Network Number ) Advertising Router: 172.16.3.3 LS Seq Number: 80000033 Checksum: 0x5138 Length: 36 Network Mask: /24 Metric Type: 2 (Larger than any link state path) TOS: 0 Metric: 20 Forward Address: 172.16.3.8 External Route Tag: 0 Routing Bit Set on this LSA LS age: 258 Options: (No TOS-capability, DC) LS Type: AS External Link Link State ID: 200.200.200.0 (External Network Number ) Advertising Router: 172.16.7.4 LS Seq Number: 80000029 Checksum: 0x7FD6 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 router-5# |
发生变化的根本原因是,重发布的静态路由的下一跳地址172.16.3.8所在网段172.16.3.x/24,R3已经将该网段接口运行了OSPF。
现在查看到ASBR的开销,和之前一致,到R4的开销较大,为74
Router 5
|
---|
router-5# show ip ospf border-routers OSPF Process 7 internal Routing Table Codes: i - Intra-area route, I - Inter-area route i 172.16.7.4 [74] via 172.16.6.6, Ethernet0, ASBR, Area 0, SPF 15 i 172.16.3.3 [64] via 172.16.2.3, Serial0, ASBR, Area 0, SPF 15 router-5# |
但如果再进一步查看路由表,则会发现路由器选择到“开销较大"的ASBR
Router 5
|
---|
router-5# show 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 O E2 200.200.200.0/24 [110/20] via 172.16.6.6, 00:35:14, Ethernet0 172.16.0.0/24 is subnetted, 4 subnets C 172.16.6.0 is directly connected, Ethernet0 O 172.16.7.0 [110/74] via 172.16.6.6, 00:35:14, Ethernet0 C 172.16.2.0 is directly connected, Serial0 O 172.16.3.0 [110/79] via 172.16.2.3, 00:35:14, Serial0 |
出现这种情况的根本原因,在于开销一致的情况下(均为OE2,开销=20),OSPF先对比到LSA 5转发地址的开销,而到R3发布的LSA转发地址开销为79:
Router 5
|
---|
router-5# show ip route 172.16.3.8 Routing entry for 172.16.3.0/24 Known via "ospf 7", distance 110, metric 79, type intra area Last update from 172.16.2.3 on Serial0, 00:30:49 ago Routing Descriptor Blocks: * 172.16.2.3, from 172.16.3.3, 00:30:49 ago, via Serial0 Route metric is 79, traffic share count is 1 |
因此到R4的转发地址0.0.0.0的开销74反而显小了。
至于0.0.0.0代表什么地址呢?这个地址表示路由器本身,取到这个路由器最近的开销,show ip ospf border-routers,正是查看到这个路由本身最近的开销。而OSPF在进行选路计算时,如果有更详细的信息,转发地址,则直接针对这部分信息计算。
转载自我的公司[url]http://www.one-tom.com/index.asp[/url]