前提
- FortiGate バージョン:v6.0.9
OSPF についての基礎知識
- エリア 0 は「バックボーンエリア」と呼ばれる
- network 設定で OSPF を有効化するインターフェースとエリアを指定する
- DR、BDR の選出方法:
- プライオリティ値が大きい順に DR/BDR を選出
- プライオリティ値が同じ場合、ルータ ID の大きい順に DR/BDR を選出
- DR/BDR 以外のルータは DROTHER と呼ばれる
- アジャセンシーとネイバー
- DR/BDR 間とはアジャセンシーを確立
- DROTHER 間ではネイバーを確立
- OSPF のコスト値はデフォルトでリンク(インターフェース)の帯域幅に基づいて決まる
【準備】GUI で OSPF 設定画面を表示させる
FortiGate の GUI ではデフォルトで OSPF の設定画面が表示されない設定となっているため表示させるよう設定します。
以下の画像のように [システム]→[表示機能設定] と選択後、[高度なルーティング] を有効化した上で [適用] をクリックして設定を確定します。
その後 [ネットワーク] を選択してメニューの中に [OSPF] が追加されたことを確認します。
OSPF 設定例
作業環境
■ FortiGate
- 型番:FortiGate 60E
- バージョン:v6.0.9
■ ルータ
- Cisco C891FJ-K9
- バージョン:15.3(3)M5
以下のネットワーク構成で FortiGate とルータとの間で、端末のセグメントをお互いにアドバタイズさせる設定をしてみます。
設定内容
- FortiGate 側の設定
- ルータ ID:10.200.30.1
- エリア ID:0.0.0.0
- network:10.10.2.1/255.255.255.255
- インターフェース
- 名前:wan1
- コスト:1
- コネクテッドを再配送
- ルータ側の OSPF 設定
router ospf 1
redistribute connected subnets
network 10.10.2.2 0.0.0.0 area 0
FortiGate 設定手順
[ネットワーク]→[OSPF] と選択し OSPF 設定画面を表示させます。
まずルータ ID を設定します。ここでは例として 10.200.30.1 とします。
次にエリアを設定します。[エリア] 欄の [新規作成] をクリックします。
以下の画面となるため画像の通り設定し [OK] をクリックします。
次にネットワークを設定します。[ネットワーク] 欄の [新規作成] をクリックします。
以下の画面となるため画像の通り設定し [OK] をクリックします。
次にインターフェースを設定します。[インターフェース] 欄の [新規作成] をクリックします。
以下の画面となるため画像の通り設定し [OK] をクリックします。
最後に再配送を設定します。[高度な設定] 欄を開き、[リディストリビューション] 欄の [コネクテッド] を有効化します。
ここまで設定できたら、OSPF 設定画面下部の [適用] をクリックします。
以上で OSPF の設定は完了です。
CLI での設定確認
コンフィグでは config router ospf が OSPF 設定に該当します。
FGT # show router ospf
config router ospf
set router-id 10.200.30.1
config area
edit 0.0.0.0
next
end
config ospf-interface
edit "wan1"
set interface "wan1"
set cost 1
set dead-interval 40
set hello-interval 10
next
end
config network
edit 1
set prefix 10.10.2.1 255.255.255.255
next
end
config redistribute "connected"
set status enable
end
config redistribute "static"
end
config redistribute "rip"
end
config redistribute "bgp"
end
config redistribute "isis"
end
end
設定後の状態確認
FortiGate 側の確認
■ ネイバー確認
FGT # get router info ospf neighbor
OSPF process 0, VRF 0:
Neighbor ID Pri State Dead Time Address Interface
10.200.30.2 1 Full/DR 00:00:35 10.10.2.2 wan1
■ OSPF ルート確認
FGT # get router info ospf route
OSPF process 0:
Codes: C - connected, D - Discard, 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
C 10.10.2.0/30 [1] is directly connected, wan1, Area 0.0.0.0
E2 10.10.3.0/24 [1/20] via 10.10.2.2, wan1
E2 10.200.30.2/32 [1/20] via 10.10.2.2, wan1
※ 10.200.30.2/32 はルータのループバックアドレス
■ ルーティングテーブル確認
FGT # get router info routing-table all
Routing table for VRF=0
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
C 10.10.1.0/24 is directly connected, internal2
C 10.10.2.0/30 is directly connected, wan1
O E2 10.10.3.0/24 [110/20] via 10.10.2.2, wan1, 00:33:06
C 10.200.30.1/32 is directly connected, loopback
O E2 10.200.30.2/32 [110/20] via 10.10.2.2, wan1, 00:33:06
ルータ側の確認
■ ネイバー確認
RT02#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.200.30.1 1 FULL/BDR 00:00:36 10.10.2.1 GigabitEthernet8
■ OSPF ルート確認
RT02#show ip ospf rib
OSPF Router with ID (10.200.30.2) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
*> 10.10.1.0/24, Ext2, cost 10, tag 0
via 10.10.2.1, GigabitEthernet8
* 10.10.2.0/30, Intra, cost 1, area 0, Connected
via 10.10.2.2, GigabitEthernet8
*> 10.200.30.1/32, Ext2, cost 10, tag 0
via 10.10.2.1, GigabitEthernet8
※ 10.200.30.1/32 は FortiGate のループバックアドレス
■ ルーティングテーブル確認
RT02#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
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks
O E2 10.10.1.0/24 [110/10] via 10.10.2.1, 00:39:07, GigabitEthernet8
C 10.10.2.0/30 is directly connected, GigabitEthernet8
L 10.10.2.2/32 is directly connected, GigabitEthernet8
C 10.10.3.0/24 is directly connected, Vlan103
L 10.10.3.254/32 is directly connected, Vlan103
O E2 10.200.30.1/32 [110/10] via 10.10.2.1, 00:18:09, GigabitEthernet8
C 10.200.30.2/32 is directly connected, Loopback0
おまけ
- FortiGate の OSPF 状態確認コマンド色々
FGT # get router info ospf
database show ospf database information
interface show ospf interfaces
route show ospf routing table
neighbor show ospf neighbors
border-routers show ospf border routers
status show ospf status
virtual-links show ospf virtual links
参考ページ
―――――――――――――