2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Fortigateを使用したOCI IPSec VPN接続例(BGP編)

Last updated at Posted at 2023-07-03

概要

Fortigateを使用してOCIにIPSec VPNでBGPを使用して接続する設定例です。
Static Routeを使用した設定例は以下で検証しました。
Fortigateを使用したOCI IPSec VPN接続例

構成

image.png

設定例

OCI

OCIメニューからネットワーキング>>サイト間VPNを選択します。
作成については以下のサイトをご参照ください。
サイト間VPNの設定
https://docs.oracle.com/ja-jp/iaas/Content/Network/Tasks/settingupIPsec.htm
ここでは作成済みの設定となります。

  • 顧客構内機器
    image.png
  • サイト間VPN
    image.png
    image.png
  • トンネル1の詳細
    image.png
    image.png
  • トンネル2の詳細
    image.png
    image.png

Fortigate

FortiGate 50E ファームウェアバージョンは6.2.12 build 1319です。
Policyや冗長化等環境に応じて設定が必要です。

  • IPSec Tunnel設定
    image.png
    image.png
    image.png

  • Interface設定
    image.png
    image.png
    image.png

  • Static Route設定
    VPN初期設定時に自動登録されたStatic routeはdisableにしています。
    image.png

  • BGP設定
    image.png

  • IPV4 Policy設定
    image.png

  • VPN 2経路の重みづけ 方法1(LOCAL_PREF, AS_PATHプリペンド)
    BGP peerはルートの重みづけを行わないと非対称ルーティングになる可能性があります。
    Tunnnel1に対しての送信にLocal Preferenceを設定しTunnnel2に対して受信のPathを1追加することによって優先度を調整しています。

Fortigate.
#route-map設定済みの表示
FortiGate-50E # config router route-map
FortiGate-50E (route-map) # show
config router route-map
    edit "routemap-prepend-out"
        config rule
            edit 1
                set set-aspath "64512"
            next
        end
    next
    edit "routemap-local-pref"
        config rule
            edit 1
                set set-local-preference 200
            next
        end
    next
end

#bgp設定済みの表示
FortiGate-50E # config router bgp
FortiGate-50E (bgp) # show
config router bgp
    set as 64512
    config neighbor
        edit "192.168.0.10"
            set remote-as 31898
            set route-map-in "routemap-local-pref"
        next
        edit "192.168.0.14"
            set remote-as 31898
            set route-map-out "routemap-prepend-out"
        next
    end
    config network
        edit 1
            set prefix 192.168.100.0 255.255.255.0
        next
    end

設定を確認したらbgpリセット
FortiGate-50E # execute router clear bgp all

適用結果、トンネル1がルーティング優先されます。
OCI
トンネル1が受信したASパスは2(64512+OCIが追加した65515)となります
image.png
トンネル2が受信したASパスは3(64512+Prependの64512+OCIが追加した65515)となります
image.png
ASパスが短いトンネル1(Home-Rtr-VPN-tun1)が優先されています
image.png
Fortigate

Fortigate.
#トンネル2(192.168.0.14)のLocalPrefは200となります
FortiGate-50E # get router info bgp network
BGP table version is 2, local router ID is 192.168.179.102
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.105.1.0/24    192.168.0.10             0    200      0        0 31898 i <-/1>
*                   192.168.0.14             0             0        0 31898 i <-/->
略
FortiGate-50E #

#その結果トンネル1が優先されています
FortiGate-50E #  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

B       10.105.1.0/24 [20/0] via 192.168.0.10, Home-Rtr-tun1, 00:00:30
         ↑ トンネル1が優先されています
FortiGate-50E # 
  • VPN 2経路の重みづけ 方法2(AS_PATHプリペンド)
    Tunnnel2に対して送信と受信のPathを1追加することによって優先度を下げています。
    設定方法については以下を参照してください。
    Technical Tip: How to configure BGP AS prepending
Fortigate.
#route-map設定済みの表示
FortiGate-50E # config router route-map

FortiGate-50E (route-map) # show
config router route-map
    edit "routemap-prepend-out"
        config rule
            edit 1
                set set-aspath "64512"
            next
        end
    next
    edit "routemap-prepend-in"
        config rule
            edit 1
                set set-aspath "31898"
            next
        end
    next
end
#bgp設定済みの表示
FortiGate-50E # config router bgp

FortiGate-50E (bgp) # show
config router bgp
    set as 64512
    config neighbor
        edit "192.168.0.10"
            set remote-as 31898
        next
        edit "192.168.0.14"
            set remote-as 31898
            set route-map-in "routemap-prepend-in"
            set route-map-out "routemap-prepend-out"
        next
    end

#設定を確認したらbgpリセット
FortiGate-50E # execute router clear bgp all

適用結果、トンネル1がルーティング優先されます。
OCI
トンネル1が受信したASパスは2(64512+OCIが追加した65515)となります
image.png

トンネル2が受信したASパスは3(64512+Prependの64512+OCIが追加した65515)となります
image.png
参考URL:
Routing Details for Connections to Your On-Premises Network

ASパスが短いトンネル1(Home-Rtr-VPN-tun1)が優先されています
image.png

Fortigate

Fortigate.
#トンネル2(192.168.0.14)のASパスは2(OCIの31898+Prependの31898)となります。
FortiGate-50E # get router info bgp network
BGP table version is 2, local router ID is 192.168.100.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.105.1.0/24    192.168.0.14             0             0        0 31898 31898 i <-/->
*>                  192.168.0.10             0             0        0 31898 i <-/1>

略
FortiGate-50E #

#その結果トンネル1が優先されています
FortiGate-50E # 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

S*      0.0.0.0/0 [10/0] via 192.168.179.1, wan1
B       10.105.1.0/24 [20/0] via 192.168.0.10, Home-Rtr-tun1, 00:01:23
         ↑ トンネル1が優先されています
FortiGate-50E # 
  • IPSec tunnel mss調整
    mss調整する必要がある場合は以下で変更が可能です。
Fortigate.
#WAN IFのMTUを調整する場合の例
config system interface
    edit wan1
        set mtu-override enable
        set mtu 1340
end
#MSSを調整する場合はPolicyごとに設定が必要とのことです
以下はmss=1300に調整しています
config firewall policy
    edit 6
        set tcp-mss-sender 1300
        set tcp-mss-receiver 1300
end
    edit 7
        set tcp-mss-sender 1300
        set tcp-mss-receiver 1300
end

Pingテスト

OCIサーバーからオンプレへのping結果

Server.
[opc@instance]$ ping 192.168.100.103
PING 192.168.100.103 (192.168.100.103) 56(84) bytes of data.
64 bytes from 192.168.100.103: icmp_seq=1 ttl=125 time=200 ms
64 bytes from 192.168.100.103: icmp_seq=2 ttl=125 time=191 ms
64 bytes from 192.168.100.103: icmp_seq=3 ttl=125 time=192 ms
64 bytes from 192.168.100.103: icmp_seq=4 ttl=125 time=218 ms
^C
--- 192.168.100.103 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 191.126/200.481/218.087/10.759 ms
[opc@instance]$

オンプレからOCIサーバーへのping結果

Server.
C:\>ping 10.105.1.122 -t

Pinging 10.105.1.122 with 32 bytes of data:
Reply from 10.105.1.122: bytes=32 time=189ms TTL=60
Reply from 10.105.1.122: bytes=32 time=190ms TTL=60
Reply from 10.105.1.122: bytes=32 time=184ms TTL=60
Reply from 10.105.1.122: bytes=32 time=187ms TTL=60

10.105.1.122 の ping 統計:
    パケット数: 送信 = 4、受信 = 4、損失 = 0 (0% の損失)、
ラウンド トリップの概算時間 (ミリ秒):
    最小 = 184ms、最大 = 190ms、平均 = 187ms
Ctrl+C
^C
C:\>
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?