OSPF コスト

OSPFではメトリック(ネットワークで宛先までの経路の「距離」を示す指標)としてインターフェースに設定されたコストを用います。
送信元から宛先までのコストの合計が最も低い経路がルートとして採用されることになります。

OSPF_05_01
デフォルトの状態では上図のようにOPSFコストが設定されます。
使用しているGNS3上のルータではEthernetが10Mでリンクアップしているのでコストは「10」となり、ループバックインターフェースのコストは「1」になるようです。(※のコスト=100M/帯域幅)

RouterAから見たRouterBとRouterC間の「193.1.1.0/24」へのコストは、
-RuterBのe0/1のコスト「10」+RuterAのe0/1のコスト「10」=「20」
-RuterCのe0/1のコスト「10」+RuterAのe0/0のコスト「10」=「20」
で同じ値になり、ルートテーブルには両方記述されパケットはロードバランスされます。
なお、コストはインターフェースに着信した時点で加算される模様です。

RouterA#sh 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

     1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 192.1.1.2, 00:00:03, Ethernet0/1
     3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 10.1.1.1, 00:00:03, Ethernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Ethernet0/0
O 193.1.1.0/24 [110/20] via 192.1.1.2, 00:00:03, Ethernet0/1
        [110/20] via 10.1.1.1, 00:00:03, Ethernet0/0
C 192.1.1.0/24 is directly connected, Ethernet0/1

ここで「193.1.1.0/24」への経路を「RouterB」経由にするため、RouterAのe0/1のコストを手動で「5」にしてみます。

OSPF_05_02

RouterA(config-if)#ip ospf cost 5

反映されているかを確認します。

RouterA#sh ip ospf interface
Ethernet0/1 is up, line protocol is up
Internet Address 192.1.1.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 5
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 2.2.2.2, Interface address 192.1.1.2
Backup Designated router (ID) 1.1.1.1, Interface address 192.1.1.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:09
Supports Link-local Signaling (LLS)
Index 3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 2.2.2.2 (Designated Router)
Suppress hello for 0 neighbor(s)

ルートテーブルを確認すると「193.1.1.0/24」へのコストが15になり、ベストパスとして選択されていることを確認できました。

RouterA#sh 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

1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/6] via 192.1.1.2, 00:00:11, Ethernet0/1
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 10.1.1.1, 00:00:11, Ethernet0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Ethernet0/0
O 193.1.1.0/24 [110/15] via 192.1.1.2, 00:00:11, Ethernet0/1
C 192.1.1.0/24 is directly connected, Ethernet0/1

スポンサーリンク






シェアする

  • このエントリーをはてなブックマークに追加

フォローする