FortiGate における主要な BGP 設定まとめ(v6.0.9)

ファイアウォール(UTM)

BGP の主要な設定について FortiGate で実施する場合の設定方法について記載します。

作業環境

  • 型番:FortiGate 60E
  • ファームウェアバージョン:v6.0.9

BGP コンフィグについて

コンフィグ構造

config router bgp
    #BGPグローバル設定--------------
    set ...
    #------------------------------

    #ネイバー設定-------------------
    config neighbor
        edit "ネイバーIP"
            #ネイバー設定
        next
    end
    #------------------------------

    #ネットワーク設定----------------
    config network
        edit "id"
            #ネットワーク設定
        next
    end
    #------------------------------

    #再配送設定---------------------
    config redistribute "connected"
    end
    config redistribute "rip"
    end
    config redistribute "ospf"
    end
    config redistribute "static"
    end
    config redistribute "isis"
    end
    #略
    #------------------------------

    #オプションの config 設定--------
    #------------------------------
end

#config のオプション
FGT (bgp) # config
aggregate-address     BGP aggregate address table.
aggregate-address6    BGP IPv6 aggregate address table.
neighbor              BGP neighbor table.
neighbor-group        BGP neighbor group table.
neighbor-range        BGP neighbor range table.
neighbor-range6       BGP IPv6 neighbor range table.
network               BGP network table.
network6              BGP IPv6 network table.
redistribute          BGP IPv4 redistribute table.
redistribute6         BGP IPv6 redistribute table.
admin-distance        Administrative distance modifications.

グローバル設定について

keepalive-timer と holdtime-timer

#設定項目ヘルプ
keepalive-timer                  Frequency to send keep alive requests.
holdtime-timer                   Number of seconds to mark peer as dead.
  • keepalive-timer 秒ごとに Keepalive メッセージを送信している。デフォルト 60 秒。
  • holdtime-timer 秒以内に Keepalive メッセージを受信できなかった場合、ネイバーのダウンとみなす。デフォルト 180 秒。
  • RFC1771 では BGP の Keepalive メッセージの間隔は holdtime の「1/3」の値が推奨されている

ネイバー設定について

loopback インターフェースを使用した IBGP ピア接続

  • IBGPピア接続する時は一般的にネイバーアドレスに loopback インターフェースを指定する
  • デフォルトでは BGP メッセージの送信元 IP アドレスは送出インターフェースの IP アドレスとなる
  • BGP メッセージの送信元 IP アドレスを loopback インターフェースの IP アドレスにするために BGP メッセージの送信元 IP アドレスを変更する設定をする
    • Cisco でいうと neighbor update-source コマンドに該当
    • FortiGate ではネイバー設定の set update-source で設定する
#指定ネイバー宛の BGP メッセージの送信元 IP アドレスをインターフェース loopback の IP アドレスにする場合
config router bgp
    config neighbor
        edit "ネイバーIP"
            set update-source "loopback"
        next
    end
end

#設定項目のヘルプ
update-source                    Interface to use as source IP/IPv6 address of TCP connections.

※ネイバーの loopback インターフェースへのルートは BGP 以外の方法で学習させる必要がある
※EBGP ピア接続の場合は TTL がデフォルトで 1 のため TTL を変更する必要がある

  • Cisco でいうと ebgp-multihop コマンド
  • FortiGate でいうとネイバー設定の ebgp-enforce-multihop

MD5 ネイバー認証設定

  • Cisco でいう neighbor password コマンドに該当する設定
  • FortiGate ではネイバー設定の set password で設定する
#指定ネイバーについての MD5 認証のパスワードを password に設定する場合
config router bgp
    config neighbor
        edit "ネイバーIP"
            set password "password"
        next
    end
end

#設定項目のヘルプ
password                         Password used in MD5 authentication.

next-hop-self

IBGP ピアにアドバタイズするルートのネクストホップを自身の IPアドレス にしたい場合に設定する。

#指定ネイバーについて next-hop-self を有効に設定する場合
config router bgp
    config neighbor
        edit "ネイバーIP"
            set next-hop-self enable
        next
    end
end

#設定項目のヘルプ
next-hop-self                    Enable/disable IPv4 next-hop calculation for this neighbor.

AS_PATH プリペンド

パスアトリビュートの AS_PATH の先頭に AS 番号を追加する場合は以下の設定を行う。

  1. prefix-list の作成
  2. route-map の作成
  3. ネイバーに route-map を設定

prefix-list の作成

config router prefix-list
    edit "hoge_prefix"
        config rule
            edit 1
                set prefix 10.10.1.0 255.255.255.0
                unset ge
                unset le
            next
        end
    next
end

route-map の作成

config router route-map
    edit "hoge_route-map"
        config rule
            edit 1
                set match-ip-address "hoge_prefix"
                set set-aspath "1 2 3 4 5"
            next
        end
    next
end

  • set set-aspath で追加する AS 番号を指定

ネイバーに route-map を設定

config router bgp
        config neighbor
            edit "10.200.30.2"
                set route-map-out "hoge_route-map"
            next
        end
end

BGP のリフレッシュ

ネイバーに route-map を設定後、設定を反映させるために以下コマンドを実行。

■ 全てのネイバーについてリフレッシュする場合

# execute router clear bgp all soft out

■ 特定 IP のネイバーのみリフレッシュする場合(例:IP 10.200.30.2 の場合)

# execute router clear bgp ip 10.200.30.2 soft out

リフレッシュ後にネイバーの BGP テーブルを確認。

RT#sh ip bgp
BGP table version is 9, local router ID is 10.200.30.2
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.200.30.1                   100      0 1 2 3 4 5 i
 *>  10.10.3.0/24     0.0.0.0                  0         32768 i

ルートリフレクタ設定

グローバル設定

以下の設定はグローバル設定で実施。

  • リフレクションの有効/無効設定
  • クラスタ ID 設定
config router bgp
    set client-to-client-reflection enable
    set cluster-id 0.0.0.0
end

#設定項目のヘルプ
client-to-client-reflection      Enable/disable client-to-client route reflection.
cluster-id                       Route reflector cluster ID.

ネイバーのクライアント設定

ネイバーをクラスタのクライアントとするかどうかの設定はネイバー設定で実施。

#指定ネイバーをクライアントに設定する場合
config router bgp
    config neighbor
        edit "ネイバーIP"
            set route-reflector-client enable
        next
    end
end

#設定項目のヘルプ
route-reflector-client           Enable/disable IPv4 AS route reflector client.

参考ページ

BGPの技術
BGPの技術
Technical Tip: How to configure BGP AS prepending
Description This article provides a configuration example of BGP AS prepending. Solution BGP AS-path prepending is useful in cases when there are two sites anno...
Technical Tip: BGP soft reset to refresh BGP routing table without tearing down existing peering sessions
Description   This articles describes how to refresh a BGP routing table without disturbing a BGP peering session.   Scope   Any supported version of FortiGate....

―――――――――――――

タイトルとURLをコピーしました