前提
- FortiGate バージョン:v6.0.9
BGP についての基礎知識
- IBGP ピアと EBGP ピア
- BGP の AS 番号が同じ ⇒ IBGP ピアになる
- BGP の AS 番号が異なる ⇒ EBGP ピアになる
項目 | IBGPピア | EBGPピア |
ピア間のAS番号 | 同じ | 異なる |
BGPパケットのTTL | 255 | 1 (※) |
アドバタイズされるルートのAD値 | 200 | 20 |
BGPループ回避の仕組み | BGPスプリットホライズン | AS_PATHアトリビュート |
(※) Cisco については ebgp-multihopコマンドで TTL を変更することが可能、FortiGate ではネイバー設定の ebgp-enforce-multihop を有効化で対応できそう
- network コマンドで BGP ルートとしてアドバタイズするネットワークを静的に指定
- そのルートをルーティングテーブルで学習していること
- 静的に指定する必要のあるネットワークが無い場合は指定しなくて良い
- BGP 以外で学習したルートをアドバタイズさせる場合は再配送を設定する
【準備】GUI で BGP 設定画面を表示させる
FortiGate の GUI ではデフォルトで BGP の設定画面が表示されない設定となっているため表示させるよう設定します。
以下の画像のように [システム]→[表示機能設定] と選択後、[高度なルーティング] を有効化した上で [適用] をクリックして設定を確定します。
その後 [ネットワーク] を選択してメニューの中に [BGP] が追加されたことを確認します。
FortiGate の BGP 設定例
作業環境
■ FortiGate
- 型番:FortiGate 60E
- バージョン:v6.0.9
■ルータ
- Cisco C891FJ-K9
- バージョン:15.3(3)M5
以下のネットワーク構成で FortiGate とルータを IBGP ピアとして、端末のセグメントをお互いにアドバタイズさせる設定をしてみます。
設定内容
- FortiGate 側の設定
- AS 番号:1
- ネイバー
- IP:10.10.2.2
- AS番号:1
- network:10.10.1.0/255.255.255.0
- ルータ側の設定
- AS 番号:1
- ネイバー
- IP:10.10.2.1
- AS番号:1
- network:10.10.3.0/255.255.255.0
- ルータの BGP コンフィグ
router bgp 1
bgp log-neighbor-changes
network 10.10.3.0 mask 255.255.255.0
neighbor 10.10.2.1 remote-as 1
FortiGate 設定手順
[ネットワーク]→[BGP] と選択し BGP 設定画面を表示させます。
[ローカルAS] 欄には FortiGate 側の AS 番号を入力します。[ルータID] 欄はここでは空にしておきます。その後、[ネイバー] 欄の [新規作成] をクリックします。
画面右側に [ネイバーの追加] 欄が表示されるため、ネイバーの IP と AS 番号を入力し [OK] をクリックします。
続いて [ネットワーク] 欄の [IP/ネットマスク] 欄にアドバタイズするネットワークを入力します。
[高度な設定] についてはここではデフォルトのままとしておきます。
ここまで設定できたら画面下部の [適用] をクリックします。
その後 BGP 設定画面をリロードして設定ができていることを確認します。
CLI での設定確認
コンフィグでは config router bgp が BGP 設定に該当します。
FGT # show router bgp
config router bgp
set as 1
config neighbor
edit "10.10.2.2"
set remote-as 1
next
end
config network
edit 1
set prefix 10.10.1.0 255.255.255.0
next
end
config redistribute "connected"
end
config redistribute "rip"
end
config redistribute "ospf"
end
config redistribute "static"
end
config redistribute "isis"
end
config redistribute6 "connected"
end
config redistribute6 "rip"
end
config redistribute6 "ospf"
end
config redistribute6 "static"
end
config redistribute6 "isis"
end
end
設定後の状態確認
FortiGate 側の確認
■ BGP サマリ確認
FGT # get router info bgp summary
BGP router identifier 10.10.2.1, local AS number 1
BGP table version is 2
1 BGP AS-PATH entries
0 BGP community entries
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.2.2 4 1 34 35 1 0 0 00:28:41 1
Total number of neighbors 1
■ BGP テーブル確認
FGT # get router info bgp network
BGP table version is 2, local router ID is 10.10.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight RouteTag Path
*> 10.10.1.0/24 0.0.0.0 100 32768 0 i
*>i10.10.3.0/24 10.10.2.2 0 100 0 0 i
Total number of prefixes 2
■ ルーティングテーブル確認
FGT # get router info routing-table bgp
Routing table for VRF=0
B 10.10.3.0/24 [200/0] via 10.10.2.2, wan1, 00:00:11
ルータ側の確認
■ BGP サマリ確認
RT#show ip bgp summary
BGP router identifier 10.10.3.254, local AS number 1
BGP table version is 3, main routing table version 3
2 network entries using 288 bytes of memory
2 path entries using 160 bytes of memory
2/2 BGP path/bestpath attribute entries using 288 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 736 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.2.1 4 1 27 27 3 0 0 00:21:53 1
■ BGP テーブル確認
RT#show ip bgp
BGP table version is 3, local router ID is 10.10.3.254
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*>i 10.10.1.0/24 10.10.2.1 100 0 i
*> 10.10.3.0/24 0.0.0.0 0 32768 i
■ ルーティングテーブル確認
RT#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, 5 subnets, 3 masks
B 10.10.1.0/24 [200/0] via 10.10.2.1, 00:03:01
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
BGP 設定の削除について
BGP 設定の削除については GUI では実施できないため(AS番号設定について「必須フィールドです。」と言われる)、コンフィグの config router bgp にて unset as を実行してください。
参考ページ
―――――――――――――