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?

More than 5 years have passed since last update.

GCP と SEIL で VPN 接続

Posted at

はじめに

IIJ の提供する SEIL と GCP を VPN 接続したので忘備録としてまとめておきます。環境としては以下のとおりです。アドレスは適時環境に合わせて読み替えてください。
設定のポイントとしては

  • IKEv1 を使用(SEIL が IKEv2 サポート外のため)
  • ルーティングベース IPsec を使用(ポリシーベース <-> ルーティングベースではエラーになる)
test server (192.168.0.2/24)
 |
 |(192.168.0.1/24)
VPC
 |VPN(10.0.0.1)
 |
 |(10.0.0.2)
SEIL
 (192.168.1.1/24)

SEIL の設定

必要な部分だけ抜粋します。GCP IKEv1 の設定と合わせる必要があるため注意が必要です。
interface ipsec1 description to_gcp interface ipsec1 mtu 1280 interface ipsec1 tcp-mss 1228 interface ipsec1 tunnel 10.0.0.2 10.0.0.1 interface ipsec1 unnumbered route add 192.168.0.0/24 ipsec1 distance 10 ike auto-initiation enable ike randomize-padding-value enable ike randomize-padding-length disable ike maximum-padding-length 20 ike strict-padding-byte-check disable ike exclusive-tail enable ike preshared-key add 10.0.0.1 "pass" ike proposal add IKEP01 encryption aes128 hash sha1 authentication preshared-key dh-group modp1024 lifetime-of-time 08h ike peer add TUNNEL01 address 10.0.0.1 exchange-mode main proposals IKEP01 dpd enable tunnel-interface enable ipsec security-association proposal add SAP01 pfs-group modp1024 authentication-algorithm hmac-sha1 encryption-algorithm aes128 lifetime-of-time 01h ipsec security-association add TUNNEL01 tunnel-interface ipsec1 ipv6 block ike SAP01 esp enable

GCP の設定

GCP の設定を行う時の注意点としてはインスタンス、VPC、VPN、静的アドレスすべてを同じリージョンから選択する必要があります(多少違っても大丈夫かもしれないけど、合わせるのが無難?)

VPC ネットワーク

グローバルアドレスの予約

実際には SEIL の設定前に取得する必要があります。
GCP の VPC ネットワークの外部 IP アドレスから「静的アドレスを予約」を選択、ネットワークサービス階層は標準、IPバージョンは v4 、タイプはリージョンで予約します。

VPCの設定

VPCネットワークから「VPCネットワークの作成」を選択します。サブネットはカスタムでIPアドレスを設定。

ファイアウォールの設定

「ファイアウォールルールを作成」から新しいルールを追加します。ネットワークはVPCで設定したネットワークを選択、トラフィックは上り(incoming)で一致した時のアクションは許可、ターゲット(あて先)は今回は「ネットワーク上のすべてのインスタンス」にします。
ソース IP の範囲は SEIL のローカルアドレス 192.168.1.0/24 を指定。ポートは試験用なのですべて許可。

VPN の設定

ハイブリット接続から「VPN設定ウィザード」を選択します。今回は可用性は必要ないので Classic VPN を選択、VPCネットワークとリージョンは同じものを選択します。IP アドレスは「グローバルアドレスの予約」で作成したものを選択します。
続いて VPN トンネルを作成します。リモートピア IP アドレスは SEIL の外側を記入、IKEのバージョンは v1、ルーティングオプションはルートベースを選択します。

test server の設定

テスト用なので Debian 、fi-micro でいいです。ネットワークインターフェースには VPC ネットワークで作成したものを選択します。インターフェースアドレスはカスタムでも自動でもどちらでも問題ないです。
今回は 192.168.0.2/24 を指定します。

確認

確認は ping コマンドを使用して相互に確認します。
注意点としてはGCP で提供される VPC に設定されるデフォルトゲートウェイは icmp に反応しないので、今回の環境では 192.168.0.1/24 に ping を飛ばしても応答はありません。

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?