OSPFでルートをやり取りする仕組みを調べる
・リンクステート型
各ルータがインターフェイスの
リンク情報を交換して経路を決定する。
リンク情報だけなんですね。
自分はこれまで、ルーティングプロトコルを全く知らなくて、
各ルータのスタティック等も含むルート情報を
共有するものだと思ってましたが、
そういうわけではないみたいです。
→<追記>
ウソでした。
再配布の設定を行えば、スタティックや
他のプロトコルで得たルーティング情報も共有可能
対になるのが、「ディスタンスベクター型」。
代表的なものは RIP や EIGRPで、
リンクステート型と並んでIGPの1タイプ。
ちなみに、ディスタンスベクター型は、
ルート情報を交換するタイプらしいですが、
諸々の詳細は割愛して、OSPFの動作を見ていきます。
環境は、前回同様、
Cisco C841M (以下、C841側)
Debian に入れたQuagga(以下、debian側)
を使います。
○現在の状態
●ネイバー ・C841側で確認 Router#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 192.168.11.100 1 FULL/DR 00:00:38 192.168.11.100 GigabitEthernet0/4.1 ・debian側で確認 ospfd# sh ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL 192.168.11.50 1 Full/Backup 35.054s 192.168.11.50 eth0:192.168.11.100 0 0 0 ●ルート ・C841側 Router#show ip route Codes: L - local, 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, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is 192.168.11.1 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 192.168.11.1 192.168.11.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.11.0/24 is directly connected, GigabitEthernet0/4.1 L 192.168.11.50/32 is directly connected, GigabitEthernet0/4.1 ・debian側 Router# show ip route (※) Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, A - Babel, > - selected route, * - FIB route K>* 0.0.0.0/0 via 192.168.11.1, eth0 C>* 127.0.0.0/8 is directly connected, lo K>* 169.254.0.0/16 is directly connected, eth0 O 192.168.11.0/24 [110/10] is directly connected, eth0, 01:51:40 C>* 192.168.11.0/24 is directly connected, eth0
debian側(DR)とC841側(BDR)で
ネイバーを張っている状態。
ルートはそれぞれ、
普段使う用に設定していた、デフォルトルートと、
“directly connected”だけです。
※Quaggaで “show ip route” を確認するには、
zebra(telnet でポート2601にアクセス)上でコマンドを実行する。
それぞれ、ルートの表示形式が違いますね。
debian側では、OSPFとしての 192.168.11.0/24 のルートが、
表示されていますが、(selected : “>”マークが付いていない)
C841では採用されていないルートは表示されないみたい。
参考キーワード:
アドミニストレーティブディスタンス(AD)値
ちなみに、OSPF分だけのルーティング情報も見られます。
・C841側 Router#show ip route ospf (~中略~) Gateway of last resort is 192.168.11.1 to network 0.0.0.0 ・debian側 ----- zebra上 -------- Router# show ip route ospf (~中略~) O 192.168.11.0/24 [110/10] is directly connected, eth0, 01:52:01 ----- ospfd上 -------- ospfd# show ip ospf route ============ OSPF network routing table ============ N 192.168.11.0/24 [10] area: 0.0.0.0 directly attached to eth0 ============ OSPF router routing table ============= ============ OSPF external routing table ===========
この場合でもC841側には、
OSPFの 192.168.11.0/24 は表示されない。
では、これに設定を加えて、
ルートが追加される様子を見ていきます。
○ルートの追加
C841で、SVI(Vlan 2)を立ち上げて、
それを OSPF area 0 に追加する
Router(config)#interface vlan 2 (SVIにIPアドレスを設定) Router(config-if)#ip address 192.168.2.1 255.255.255.0 Router(config-if)#exit Router(config)#interface GIgabitEthernet 0/1 Router(config-if)#switchport access vlan 2 (GiE 0/1に対応するvlanを割当→リンクアップさせるため) Router(config-if)#exit Router(config)#router ospf 1 Router(config-router)#network 192.168.2.0 0.0.0.255 area 0 Router(config-router)#end
改めてルーティングテーブルの確認
・C841側 Router#show ip route (~中略~) Gateway of last resort is 192.168.11.1 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 192.168.11.1 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.2.0/24 is directly connected, Vlan2 L 192.168.2.1/32 is directly connected, Vlan2 192.168.11.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.11.0/24 is directly connected, GigabitEthernet0/4.1 L 192.168.11.50/32 is directly connected, GigabitEthernet0/4.1 ・debian側 ----- zebra -------- Router# show ip route (中略) K>* 0.0.0.0/0 via 192.168.11.1, eth0 C>* 127.0.0.0/8 is directly connected, lo K>* 169.254.0.0/16 is directly connected, eth0 O>* 192.168.2.0/24 [110/11] via 192.168.11.50, eth0, 00:02:17 O 192.168.11.0/24 [110/10] is directly connected, eth0, 02:05:14 C>* 192.168.11.0/24 is directly connected, eth0
C841側では、directly connected で、
debian側ではOSPFで、192.168.2.0/24 のルートが
ルーティングテーブルに追加されました。
debian側から見て、
AD値は、OSPFデフォルトの110、
コストは11、
next hopはC841のIPアドレス、
出力インターフェイスは eth0 です。
この時のやり取りを見てみると、
設定を施したC841側から、
“LS Update(LSU)”のパケットが飛んでいます。
その中に、新しく設定したリンクの情報が入っている。
LSAタイプや、リンクのタイプについては、
一旦、割愛します。
で、受け取ったdebian側から、
“LS Acknowledge(LSAck)”が飛んでますね。
では、ルート以外のOSPF関係の
ステータスも見ていきます。
show ip ospf
OSPFの全般的な情報を表示。
とりあえず今回は、”Number of interfaces in this area”が、
C841側で”2″、debian側で”1″になっていることに注目。
・C841側 Router#show ip ospf Routing Process "ospf 1" with ID 192.168.11.50 Start time: 00:07:14.800, Time elapsed: 01:45:17.692 (~中略~) Number of areas in this router is 1. 1 normal 0 stub 0 nssa Number of areas transit capable is 0 External flood list length 0 IETF NSF helper support enabled Cisco NSF helper support enabled Reference bandwidth unit is 100 mbps Area BACKBONE(0) Number of interfaces in this area is 2 Area has no authentication SPF algorithm last executed 00:01:10.468 ago SPF algorithm executed 9 times Area ranges are Number of LSA 3. Checksum Sum 0x01BFF4 Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 2 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 ・debian側 ospfd# show ip ospf OSPF Routing Process, Router ID: 192.168.11.100 (~中略~) Area ID: 0.0.0.0 (Backbone) Number of interfaces in this area: Total: 1, Active: 1 Number of fully adjacent neighbors in this area: 1 Area has no authentication SPF algorithm executed 19 times Number of LSA 3 Number of router LSA 2. Checksum Sum 0x00013a7a Number of network LSA 1. Checksum Sum 0x0000857a Number of summary LSA 0. Checksum Sum 0x00000000 Number of ASBR summary LSA 0. Checksum Sum 0x00000000 Number of NSSA LSA 0. Checksum Sum 0x00000000 Number of opaque link LSA 0. Checksum Sum 0x00000000 Number of opaque area LSA 0. Checksum Sum 0x00000000
show ip ospf database
LSDB(Link State Database)の要約を表示
・C841側 Router#show ip ospf database OSPF Router with ID (192.168.11.50) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 192.168.11.50 192.168.11.50 51 0x80000011 0x009445 2 192.168.11.100 192.168.11.100 930 0x8000000C 0x00A635 1 (以下略)
Area 0 の Router Link States に、
ルータID:192.168.11.50 と 192.168.11.100 の
LSAが入っています。
192.168.11.50 はリンク数2、
192.168.11.100 はリンク数1です。
※厳密には Link ID と ルータID(ADV Router)は異なるが、
Router Link States の場合は、Link ID=ルータID
debian側で見ても同じような内容。
show ip protocols
動作中のIPルーティングプロトコルに関する情報を表示。
・C841側 Router#show ip protocols *** IP Routing is NSF aware *** (~中略~) Routing Protocol is "ospf 1" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 192.168.11.50 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 192.168.2.0 0.0.0.255 area 0 192.168.11.0 0.0.0.255 area 0 Routing Information Sources: Gateway Distance Last Update Distance: (default is 110) ※debian側(Quagga)ではコマンドが存在しない
“Routing for Networks”にOSPFのルーティング情報。
他の機器からのLSAでルートが追加された場合は、
“Routing Information Sources”にソースが表示される。(↓↓)
○ルートの追加 その②
debianでループバックインターフェイス(lo)に
IPアドレスを設定し、OSPFに追加
設定コマンド
----- zebra -------- Router(config)# interface lo Router(config-if)# ip address 1.1.1.1/32 Router(config-if)# end ----- ospfd -------- ospfd(config)# router ospf ospfd(config-router)# network 1.1.1.1/32 area 0 ospfd(config-router)# end
C841側のルートの確認
Router#show ip route (~中略~) Gateway of last resort is 192.168.11.1 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 192.168.11.1 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/11] via 192.168.11.100, 00:07:42, GigabitEthernet0/4.1 192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.2.0/24 is directly connected, Vlan2 L 192.168.2.1/32 is directly connected, Vlan2 192.168.11.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.11.0/24 is directly connected, GigabitEthernet0/4.1 L 192.168.11.50/32 is directly connected, GigabitEthernet0/4.1
OSPFにより、1.1.1.1 宛てのルートが追加されました。
ループバックインターフェイスに ping が通ることを確認
C841側で、
Router#ping 1.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
ついでに、さっきの”show ip protocols”で見た、
“Routing Information Sources”のところも確認。
・C841側 Router#show ip protocols *** IP Routing is NSF aware *** (~中略~) Routing Protocol is "ospf 1" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 192.168.11.50 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 192.168.2.0 0.0.0.255 area 0 192.168.11.0 0.0.0.255 area 0 Routing Information Sources: Gateway Distance Last Update 192.168.11.100 110 00:09:11 Distance: (default is 110)
“Routing Information Sources”に追加されていることが
確認できました。
●参考
![]() |
(スマホ問題集付)徹底攻略Cisco CCNA Routing & Switching教科書 ICND2編[200-105J][200-125J]V3.0対応 |