概要
Fortigateを使用してOCIにIPSec VPNでBGPを使用して接続する設定例です。
Static Routeを使用した設定例は以下で検証しました。
Fortigateを使用したOCI IPSec VPN接続例
構成
設定例
OCI
OCIメニューからネットワーキング>>サイト間VPNを選択します。
作成については以下のサイトをご参照ください。
サイト間VPNの設定
https://docs.oracle.com/ja-jp/iaas/Content/Network/Tasks/settingupIPsec.htm
ここでは作成済みの設定となります。
Fortigate
FortiGate 50E ファームウェアバージョンは6.2.12 build 1319です。
Policyや冗長化等環境に応じて設定が必要です。
-
VPN 2経路の重みづけ 方法1(LOCAL_PREF, AS_PATHプリペンド)
BGP peerはルートの重みづけを行わないと非対称ルーティングになる可能性があります。
Tunnnel1に対しての送信にLocal Preferenceを設定しTunnnel2に対して受信のPathを1追加することによって優先度を調整しています。
#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)となります
トンネル2が受信したASパスは3(64512+Prependの64512+OCIが追加した65515)となります
ASパスが短いトンネル1(Home-Rtr-VPN-tun1)が優先されています
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
#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)となります
トンネル2が受信したASパスは3(64512+Prependの64512+OCIが追加した65515)となります
参考URL:
Routing Details for Connections to Your On-Premises Network
ASパスが短いトンネル1(Home-Rtr-VPN-tun1)が優先されています
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調整する必要がある場合は以下で変更が可能です。
#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結果
[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結果
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:\>