【SSLVPN】OPNsense on Azure

クラウドへリモートアクセス環境を準備する場合,クラウドネイティブな方法もあるがVPN仮想アプライアンスをたててオンプレライクにSSLVPNで乗り込みたいシーンがよくある。(私の案件では)
クラウドにアカウントを作りたくない,プロトコルが対応していない等いくつか理由があるが,一番の理由は「クラウド構築担当している人がVPNとか全然分からんからNW部隊に丸投げしてくる。そんでもってユーザ管理や運用はそっちでやってね。」というもの。(

ぼやいても仕方ないので毎度VPN対応のFW仮想マシンをたてて構築するのだけれど,まぁ高いのなんの。そこで丁度よさそうなのがOPNsenseだったので構築手順を残しておく。

公式ドキュメントがあるので基本それに従って進めていく。
https://docs.opnsense.org/manual/how-tos/installazure.html

構成イメージ

バージョンは以下の通り。

サーバ側
OPNsense 24.1.1-amd64
FreeBSD 13.2-RELEASE-p9
OpenSSL 3.0.13

クライアント側
OpenVPN GUI v11.47.0.0

仮想マシン作成

ユーザ設定で認証を証明書にするとデプロイ失敗するのでパスワードを設定する。
パブリックIPとネットワークセキュリティグループを適切に設定してデプロイ完了したらHTTPSでログイン。

続いてSSLVPNの設定へ。

OPNsense設定

まずは認証関連の設定。今回は自己証明書で構成を組む。

CA作成

System: Trust: Authorities
※ 中身は省略

サーバ証明書作成

System: Trust: Certificates
※ 中身は省略

2FA用のGoogleAuth登録

System: Access: Servers
サーバ名を入れて,TypeでLocal+OTP。それ以外はそのまま。

SSLVPN Server作成

Serverを作成して~という流れはLegacyとあるのでインスタンスの作成。その前にTLS Keyを作成する。

認証用なのでAuthオンリーで。

入力したパラメータ一覧は以下の通り。それ以外は空欄ないしはデフォルトのまま。

GeneralSetting

  • Role: Server
  • Description: 適宜
  • Server(IPv4):172.16.1.0/24

Trust

  • Certificate: SSLVPN CRT(作成したサーバ証明書)
  • Certificate Authority: SSLVPN CA(作成したローカルCA)
  • Verify Client Certificate: none
  • Certificate Depth:One(Client+Server)
  • TLS static key: TSL-Key(作成したもの)
  • Auth:SHA256
  • Data Ciphers: AES-256-GCM

Authentication

  • Authentication: Google Auth(先ほど作成したもの)
  • Renegotiate time: 0 ※ OTP認証のため再接続になるとTokenが切れているため認証エラーとなってしまう。そのため,ここは「0」に設定する必要がある。OTPでなければ不要。

Routing

  • Local Network: 10.0.0.0/16 (VNetにアクセスできれば良いのでVNetに割り当てたセグメント指定)

SNAT設定

VPNのトラフィックをインタフェースでSNATする。
Modeをマニュアルへ変更。

Interface,Source addressをそれぞれ設定。

結果。

リモートアクセスユーザ作成

ユーザ名,パスワードを入力し,OTP用の設定を入力する。

ここでSaveをするとユーザ証明書作成ページに跳ぶ。自己証明書作成を選択し、その他項目も適宜入力して作成する。

その後,GoogleAuthenticatorへ登録するためのQRコードが生成されるのでスマホアプリで登録する。

OpenVPNClient設定エクスポート

TypeはFileonly。Windowsの証明書ストアのオプションは外す。

一番下にあるユーザ用の構成ファイルをダウンロードして完了。

FW設定

今回,Azure上で構築しているので通信制御はNetworkSecurityGroupで対応することとして,OPNsenseのルールは全許可とした。よってここは省略。(LANとOpenVPNのIFにIN全許可ルールを1行入れたのみ)

接続試験(Windows11)

サーバ側でも設定した再認証させない設定をダウンロードしたファイルにも追記する必要がある。

dev tun
persist-tun
persist-key
auth SHA256
client
verb 5  # デバッグ用
ping-restart 0  # これ0に指定する必要がある
resolv-retry infinite

保存した設定ファイルをOpenVPNクライアントにインポートし,接続すると認証画面が出るので「 Token + Password 」の並びで入力する。これが分からなくてサーバ設定見直したりキャプチャ眺めたり,VM作り直したりとかなり迷走した orz。

無事に成功するとIPアドレスが割り当てられAzure内に通信できるようになる。

疎通確認

無事Pingも通った。

ping 172.16.1.1  # Tunnel対向

172.16.1.1 に ping を送信しています 32 バイトのデータ:
172.16.1.1 からの応答: バイト数 =32 時間 =187ms TTL=64
172.16.1.1 からの応答: バイト数 =32 時間 =186ms TTL=64

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

>ping 10.0.0.5 -t # VPNサーバAzure内部IP

10.0.0.5 に ping を送信しています 32 バイトのデータ:
10.0.0.5 からの応答: バイト数 =32 時間 =187ms TTL=64
10.0.0.5 からの応答: バイト数 =32 時間 =187ms TTL=64

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

>ping 10.0.0.4 -t # Azure内同一Subnet別インスタンス

10.0.0.4 に ping を送信しています 32 バイトのデータ:
10.0.0.4 からの応答: バイト数 =32 時間 =189ms TTL=63
10.0.0.4 からの応答: バイト数 =32 時間 =189ms TTL=63

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

以上で完了。おつかれさまでした。

Microsoft Azure Fundamentals

先日,Microsoftのオンラインセミナー受講したらバウチャーを配布してくれたので受験してきました。
Azureの初級という位置づけで,「クラウド初めてさわる」「これからAzure案件に関わる予定」という人向けのようです。(個人的には新人のスキルアップに丁度良い教材&資格ではないかと思っています。)

私自身は初心者ではありませんが,Azureというクラウドサービスを理解するというきっかけには丁度良い試験でした。もちろんセミナーを受けただけでは受からないので

  • Microsoftのラーニングパスを通して理解を深める。
  • Azureアカウントを作成して一通り操作や見方を覚える。

と,ある程度対策をしたうえで受験し,無事に合格しました。

個人的にオススメラーニングパスは以下の通り。

Microsoft Azure クラウドの概念について調べる (AZ-900) ・・・ 4つのモジュールがあり,これはオンラインセミナーと結構重複していたので,復習のためやっておくと良い。

Azure の基礎 ・・・ 12個のモジュールがある。実際にAzureを操作してVMや可用性ペアを作るなどのハンズオンが盛り込まれている。まったくのクラウド初心者だと,これくらいまでは最低限やっておかないと厳しいかもしれない。

以下のモジュールでさらに理解を深めておくと余裕をもっていけるはず。ただ,受けた感想として,クラウド一般的な技術の話というよりは,Azureに特化したサービス(ポリシー/課金/サポート)に重点を置いて対策をとったほうがよいと感じた。

Azureを触ってみてAWSとは違う使いやすいさ,チュートリアルの豊富さが良いと感じたので今後個人的にも使ってみよう。

WordPress構築

Bloggerを使っていたけれど,使い勝手がよいWiki形式へ切り替えたいと思い,勉強がてらWordpressを自前で立ててこちらへ引っ越し。

1発目はWordpress構築メモ。

構想

イメージ
構成概要

構成イメージはこのような感じ。GCP上にCentOS8の仮想マシンを1つたて,その上で完結させる。DBは分けた方がよいのだろうが,まずは無事に立ち上がるところまで。

ドメインはさくらインターネットで取得。.comドメインで年間1886円。GCPでグローバルIPアドレスを確保した後,設定画面でDNS登録をする。

大まかな流れ

  1. DBインストール,設定
  2. PHPインストール,設定
  3. HTTPDインストール,設定
  4. HTTPS化

いざゆかん。

とその前に,構築中は自宅からのみアクセス可能とするためGCPのファイアウォールでソースIPアドレスを限定する。

DBインストール,設定

オフィシャルサイトを参考。

$ sudo dnf install mariadb-server.x86_64

DBセキュア化

$ sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

wordpress用DB設定。

MariaDB [(none)]> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.004 sec)


MariaDB [(none)]>


MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO "DBアドミン名"@"localhost" IDENTIFIED BY "パスワード";
Query OK, 0 rows affected (0.004 sec)


MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.002 sec)

ログに認証エラーが出た。ケルベロス認証などは使わないので無効化で対処する。

[ERROR] mysqld: Server GSSAPI error (major 851968, minor 2529639093) : gss_acquire_cred failed -Unspecified GSS failure. Minor code may provide more information. Keytab FILE:/etc/krb5.keytab is nonexistent or empty.
/var/log/mariadb/mariadb.log の内容
$ sudo mv /etc/my.cnf.d/auth_gssapi.cnf /etc/my.cnf.d/auth_gssapi.cnf.org

起動設定。

$ systemctl enable mariadb
$ systemctl start mariadb

PHPインストール,設定

$ sudo dnf install php php-mysqlnd php-mbstring.x86_64 php-json php-gd php-xml php-zip php-dom

php-gdがないとwordpress上で画像の編集ができない

推奨

参考) https://qiita.com/kogache/items/00dc37774dfe20f03a72

/etc/php-fpm.d/www.conf 編集。httpdとしてnginxを使うのでユーザとグループを修正する。

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache user chosen to provide access to the same directories as httpd
;user = apache
user = nginx
; RPM: Keep a group allowed to write in log dir.
;group = apache
group = nginx

nginxインストール,設定

$ sudo dnf install nginx

wordpress設定

wordpressもあわせてインストールをする。今回は /usr/share/nginx の下に WP というディレクトリを作成して,そこへwordpressを配置する。

$ wget https://ja.wordpress.org/latest-ja.tar.gz
$ tar xvfz latest-ja.tar.gz ./
$ sudo chown -R nginx:nginx /usr/share/nginx/WP
$ sudo mv wordpress/* /usr/share/nginx/WP/

nginx設定ファイル変更。 /etc/nginx/conf.d/wp.conf として編集。TLS1.2 と1.3に限定する。こちらを参考。

# HTTPSへリダイレクト
server {
        listen 80;
        server_name zassoul.com;
        return 301 https://$host$request_uri;
}
server {
        listen 443 ssl;
        server_name zassoul.com;
        root /usr/share/nginx/WP;
        index index.php;
        charset utf-8;

        ssl_certificate /etc/letsencrypt/live/zassoul.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/zassoul.com/privkey.pem;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        # Deny to wp-config.php
        location ~* /wp-config.php {
                deny all;
        }

        #php-fpm
        location ~ \.php$ {
                try_files $uri = 404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include fastcgi_params;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass php-fpm;
        }

        location ~* \.(js|css|png|jpg|jpgeg|gif|ico)$ {
               expires max;
               log_not_found off;
        }
}

wp-config.php を編集する。(オフィシャルサイトを参考)

// ** MySQL 設定 - この情報はホスティング先から入手してください。 ** //
/** WordPress のためのデータベース名 */
define( 'DB_NAME', 'wordpress' );

/** MySQL データベースのユーザー名 */
define( 'DB_USER', '上で設定したユーザ名' );

/** MySQL データベースのパスワード */
define( 'DB_PASSWORD', '上で設定したパスワード' );

/** MySQL のホスト名 */
define( 'DB_HOST', 'localhost' );

/** データベースのテーブルを作成する際のデータベースの文字セット */
define( 'DB_CHARSET', 'utf8mb4' );

/** データベースの照合順序 (ほとんどの場合変更する必要はありません) */
define( 'DB_COLLATE', '' );

/**#@+
 * 認証用ユニークキー
 */
define( 'AUTH_KEY',         'ジェネレートしたキー' );
define( 'SECURE_AUTH_KEY',  'ジェネレートしたキー' );
define( 'LOGGED_IN_KEY',    'ジェネレートしたキー' );
define( 'NONCE_KEY',        'ジェネレートしたキー' );
define( 'AUTH_SALT',        'ジェネレートしたキー' );
define( 'SECURE_AUTH_SALT', 'ジェネレートしたキー' );
define( 'LOGGED_IN_SALT',   'ジェネレートしたキー' );
define( 'NONCE_SALT',       'ジェネレートしたキー' );

/**#@-*/

HTTPS化

常時HTTPSもするのでLet’s EncryptでSSL証明書を発行する。サイト認証のため80番ポートでアクセスしてくる必要があるということで,一時的に80番ポート全解放をする。

こちらを参考にLet’s Encryptで証明書発行を実施。

Certbotのインストール。

$ sudo dnf install epel-release
$ sudo dnf install certbot

お試しdry-run。

$ sudo certbot certonly --dry-run --standalone -w /usr/share/nginx/WP/ -d zassoul.com -m "Email-Address"

本番実行。

$ sudo certbot certonly  --standalone -d zassoul.com -m "Email-Address" --agree-tos
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for zassoul.com
Using the webroot path /usr/share/nginx/WP for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Subscribe to the EFF mailing list (email: "Email-Address").


IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/zassoul.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/zassoul.com/privkey.pem
   Your cert will expire on 2020-12-07. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - If you like Certbot, please consider supporting our work by:


   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

ここで80番を閉じる。nginx起動設定。

$ sudo systemctl enable nginx
$ sudo systemctl start nginx

完了。

GNS3 on GCP

EVE-NGにならってGNS3もGCP上に立てる。
イメージは18.04のbionicを選択。
# 現時点でcosmicだとDockerやiouguiのインストールですんなり行かない。
# 北米より高いけど, 日本リージョンで建てることをおすすめします

>gcloud compute images create nested-ubuntu-1804-lts --source-image-project=ubuntu-os-cloud --source-image=ubuntu-1804-bionic-v20181120  --licenses="https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"

このイメージを使いインスタンスを起動→SSHでログイン。

あとはオフィシャルの手順通りやっていけば完了。
インストール手順(オフィシャル)

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo add-apt-repository ppa:gns3/ppa
$ sudo apt-get update
$ sudo apt-get install gns3-gui
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt install gns3-iou
$ sudo apt install dynamips:i386 #Bug対応

途中, Wiresharkを非ルートユーザでの実行を許可するかどうかを聞かれるので「Yes」を選択。続いてGNS3を非ルートユーザでの実行を許可するかどうかを聞かれるので「Yes」を選択する。(ここはデフォルトでNoが選択されている)

$ sudo apt-get install 
apt-transport-https
ca-certificates
curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
$ sudo apt-get install docker-ce
$ sudo usermod -a -G docker gns3
$ # gns3 はログインユーザ名
$ sudo usermod -a -G docker gns3
$ sudo usermod -a -G ubridge gns3
$ sudo usermod -a -G libvirt gns3
$ sudo usermod -a -G kvm gns3
$ sudo usermod -a -G wireshark gns3
$ gns3 --version

2.1.11

完了。

無事起動

EVE-NG on GCP

GCPでネストを有効化する。(Google Cloud SDK shell を使う)
ネストが利用できるのはHaswell以降のCPUが実装されているリージョン。
EVE-NGはベアメタルのデプロイを参考にする。
http://www.eve-ng.net/documentation/installation/bare-install

1. インスタンス作成

まず最初にUbuntu 1604.ltsをベースにNestedのイメージを作る。

GoogleCloud SDK>gcloud compute images create nested-ubuntu-1604-lts --source-image-project=ubuntu-os-cloud --source-image=ubuntu-1604-xenial-v20181004  --licenses="https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"
Created [https://www.googleapis.com/compute/v1/projects/propane-passkey-xxxxx/global/images/nested-ubuntu-1604-lts].
NAME PROJECT FAMILY DEPRECATED STATUS
nested-ubuntu-1604-lts propane-passkey-xxxxx READY

このイメージを使い仮想マシンを立てる

EVE-NGのシステム要件
http://www.eve-ng.net/documentation/installation/system-requirement

インスタンス作成

作成したイメージからインスタンスを作成する
項目編集。ひとまずvCPU 2 メモリ 8G。
シリアルポートへのアクセスを許可する。

ログインして仮想化に対応しているか念の為確認。

~$ grep vmx /proc/cpuinfo 
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti tpr_shadow flexpriority ept fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arch_capabilities
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti tpr_shadow flexpriority ept fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arch_capabilities

OK。

2. EVE-NG インストール事前準備

ログイン後, ベアメタルインストールの手順に従って設定の修正を行っていく。
・/etc/hosts 修正
・sshd設定 修正
・Grub設定 修正
・インタフェース名をethへ変更

# cat /etc/udev/rules.d/70-persistent-net.rules 
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="42:01:0a:8e:00:02", NAME="ens4"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="42:01:0a:8e:00:02", NAME="eth0"

・適用のため一度再起動

root@eve-ng:~# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1460 qdisc mq state UP group default qlen 1000
link/ether 42:01:0a:8e:00:02 brd ff:ff:ff:ff:ff:ff
inet 10.142.0.2/32 brd 10.142.0.2 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::4001:aff:fe8e:2/64 scope link
valid_lft forever preferred_lft forever

OK。

3. EVE-NG インストール

# wget -O - http://www.eve-ng.net/repo/install-eve.sh | bash -i
# reboot

ここに従って初期設定をする。
http://www.eve-ng.net/index.php/documentation/howto-s/65-howto-configure-eve-during-first-boot

・アップデート

# apt-get update
# apt-get upgrade

・HTTPS化
https://zassoul.blogspot.com/2018/06/eve-nghttps.html

完了。
4. お試しアクセス
https://<インスタンスの外部IP>/ にアクセス。

初期ID・パス入力

無事成功

5. Firewall 設定

開放が必要なポートを開ける。
FAQには「ポッド(アカウント)数によって変わる」とあった。
Community版はAdminのみなので, 32769~32896まで開放する。

新規ルール作成

送信元IPは指定したほうが良いが, ひとまずANYで開放

最低限, adminのパスワードは変更しておく。

以上。

GCPとVPN接続する~その2~

GCPとのVPN接続で, ポリシーベースではなくルーティングベースでやってみる。

構成は前回とほぼ変わらず。
クラウドルータとの間のセグメントが増えた感じ。

GCP側にBGPルータができ, それとのルーティング設定が追加となる

前提条件(ポリシーベースの前提を大体引き継ぐ)

  • GCPのアカウント設定済み
  • (VPC作成済み, VPC作成後のインスタンスも作成済み)
  • 家側のNAT設定済み
  • ルーティングベースなので, VTIを採用

流れ

1. クラウドルータ設定
2. VPN設定(Cisco)

1. クラウドルータ設定

ネットワーキングから「ハイブリッド接続」を選択

「ルーターを作成」をクリック

必要事項を記入する。
今回, BGPのAS NoはGCP側は64512とした。

ルーター作成後, 「VPNトンネルを追加」する。

各項目を記入し, BGPセッションの編集ボタンをクリック。

ここでは家側のAS Noを65000とし, トンネル間のセグメント情報を記入する。

設定の結果を確認。

これでGCP側は完了。

2. VPN設定(Cisco)

VTIに準じた設定を入れていく。
関連Config抜粋

crypto ikev2 proposal GCP_proposal
encryption aes-cbc-256 aes-cbc-192 aes-cbc-128
integrity sha256
group 16
!
crypto ikev2 policy GCP_policy
proposal GCP_proposal
!
crypto ikev2 keyring GCP_Key
peer GCP
address <GCPのIPアドレス>
pre-shared-key <共有キー>
!
!
!
crypto ikev2 profile IKEv2_Profile
match identity remote address <GCPのIPアドレス> 255.255.255.255
identity local address <家のGlobal IP>
authentication remote pre-share
authentication local pre-share
keyring local GCP_Key
lifetime 3600
!
!
crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac
mode tunnel
!
crypto ipsec profile GCP_Profile
set transform-set TS
set pfs group16
set ikev2-profile IKEv2_Profile
!
crypto ipsec profile VTI
set transform-set TS
set pfs group16
!
interface Tunnel1
ip address 169.254.1.2 255.255.255.252
tunnel source Vlan100
tunnel mode ipsec ipv4
tunnel destination <GCPのIPアドレス>
tunnel protection ipsec profile GCP_Profile
!
!
router bgp 65000
bgp log-neighbor-changes
network 192.168.1.0
network 192.168.10.0
neighbor 169.254.1.1 remote-as 64512
!

通信確認

#ping 10.10.10.10 source 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.10, timeout is 2 seconds:
Packet sent with a source address of 192.168.1.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 160/160/160 ms

IPSecステータス

#show crypto session
Crypto session current status

Interface: Tunnel1
Profile: IKEv2_Profile
Session status: UP-ACTIVE
Peer: 35.231.219.234 port 4500
Session ID: 2209
IKEv2 SA: local 192.168.1.2/4500 remote 35.231.219.234/4500 Active
IPSEC FLOW: permit ip 0.0.0.0/0.0.0.0 0.0.0.0/0.0.0.0
Active SAs: 2, origin: crypto map

無事接続確認完了。

GCPとVPN接続する

GCPの$300クレジット(1年)があるのでAWSだけでなくGCPも触ってみる。

例によって自宅とVPN張って見る。構成はこんな感じ。

概略構成

前提条件

  • GCPのアカウント設定済み
  • (VPC作成後)インスタンスは作成済み
  • 家側のNAT等の転送ルールは設定済み
  • 今回はポリシーベースVPNとするので GRE over IPSec (訂正:GRE使いません)

流れ

1. VPC作成
2. サブネット作成
3. FW設定
4. インスタンス作成(ここでは省略)
5. VPN設定(GCP & Cisco)

Google Cloud Consoleにログインして, VPCネットワークを作成する。

1. VPC作成

「VPCネットワーク」から「VPCネットワーク」を選択

「VPCネットワークを作成」を選択

2.  サブネット作成

必要事項記入して「作成」

この後, 作成したサブネット上にインスタンスを作成する。(手順は省略)

3. FW設定

サブネットに対する通信許可設定を入れる。
VPCから作成したVPC「vpc01」を選択
ファイアウォールルールを選択し, ルールの追加をクリック
※画像は既に作成済み
ルールを記入していく
ここでは自宅の環境からサブネット全体に対して全て通信許可としている
完了

4. VPN作成

「VPCネットワーク」から「VPN」選択

「VPN接続を作成」をクリック

必要事項を記入する。IPアドレスはプルダウンをクリックして新規作成する。

名前を適当につけて「予約」

するとGlobal IP Addressが割当たる

内容確認して「完了」をクリック

GCP側はこれで準備完了

5. Ciscoルータの設定

GCPでサポートしている暗号化セットはここに記載されている。
Supported IKE Ciphers

関連Config抜粋

!
crypto ikev2 proposal GCP_proposal
encryption aes-cbc-256 aes-cbc-192 aes-cbc-128
integrity sha256
group 16
!
crypto ikev2 policy GCP_policy
proposal GCP_proposal
!
crypto ikev2 keyring GCP_Key
peer GCP
address <GCPのIPアドレス>
pre-shared-key <設定した共有キー>
!
!
!
crypto ikev2 profile IKEv2_Profile
match identity remote address <GCPのIPアドレス> 255.255.255.255
identity local address <家のGlobal IP>
authentication remote pre-share
authentication local pre-share
keyring local GCP_Key
lifetime 3600
!

crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac
mode tunnel
!
crypto ipsec profile GCP_Profile
set transform-set TS
set pfs group16
set ikev2-profile IKEv2_Profile
!
!
crypto map GCP_map 5 ipsec-isakmp
set peer <GCPのIPアドレス>
set transform-set TS
set pfs group16
set ikev2-profile IKEv2_Profile
match address GCP_ACL
!
!
interface Vlan100
description to 192.168.1.0/24
ip address 192.168.1.2 255.255.255.0
crypto map GCP_map
!
ip access-list extended GCP_ACL
permit ip 192.168.0.0 0.0.255.255 10.10.10.0 0.0.0.255
!
!

通信確認

Ping確認

#ping 10.10.10.10 source 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.10, timeout is 2 seconds:
Packet sent with a source address of 192.168.1.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 160/162/164 ms

IP-Secステータス

#show crypto session
Crypto session current status

Interface: Vlan100
Profile: IKEv2_Profile
Session status: UP-ACTIVE
Peer: 35.231.219.234 port 4500
Session ID: 2208
IKEv2 SA: local 192.168.1.2/4500 remote <GCPのIPアドレス>/4500 Active
IPSEC FLOW: permit ip 192.168.0.0/255.255.0.0 10.10.10.0/255.255.255.0
Active SAs: 2, origin: crypto map

以上。
次はルートベースのVPN設定を試す。

ちなみに, MTUサイズを確認してみるとトンネルのオーバーヘッド含めて1422だった。

$ ping 10.10.10.10  -s 1394 -M do
PING 10.10.10.10 (10.10.10.10) 1394(1422) bytes of data.
1402 bytes from 10.10.10.10: icmp_seq=1 ttl=63 time=162 ms
1402 bytes from 10.10.10.10: icmp_seq=2 ttl=63 time=161 ms
1402 bytes from 10.10.10.10: icmp_seq=3 ttl=63 time=160 ms
^C
--- 10.10.10.10 ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3001ms
rtt min/avg/max/mdev = 160.511/161.357/162.479/0.947 ms
$ ping 10.10.10.10 -s 1395 -M do
PING 10.10.10.10 (10.10.10.10) 1395(1423) bytes of data.
ping: sendmsg: Message too long
ping: sendmsg: Message too long
ping: sendmsg: Message too long
^C
--- 10.10.10.10 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2004ms

CiscoルータでのVTI+IKEv2設定(NAT越し)~対VyOS編~

ということで,Cisco~VyOS間でも試した。

検証した結果わかったことは以下の通り。

・VyOS1.1.x台ではVTI+IKEv2ではVPNは張れない。
   いや, 張れるんだけど(Phase2まで上がるんだけど) 疎通が取れない。
・EC2のElastic IPで,末尾が0だと(サブネットゼロだと)Cisco側でネットワークアドレスとしてみなされるらくしPhase2で失敗する。(たとえ ip subnet-zero が入っていたとしても)
<追記>
・改めてCisco~VyOS間のトラフィックを確認したら, 正常にトラフィックが流れていないことに気がついた。VyOSからソースIFをVTI指定してのPingでないとトラフィックがトンネルを通らない。Beta版のバグなのかな。
なので, 現時点ではVPNは張れるがまともに使えないという状況。要調査。

VyOSのBeta版はこちらからダウンロードする。
https://downloads.vyos.io/?dir=rolling/current/amd64
今回のバージョンはvyos-999.201802070337-amd64.iso
参考までにアップグレード方法を。
本家にやり方ありますが一応。

$ conf
# set system name-server 8.8.8.8 (Google先生スミマセン)
# commit
# exit
$ sudo su
# wget beta版URL
# exit
$ add system image file
$ show system image
The system currently has the following image(s) installed:

1: 999.201802070337- (default boot)
2: 1.1.8 (running image)
$ reboot

これでオッケー。
なお,設定はVTIのときとほぼ同じで至ってシンプル。

set interfaces vti vti1 address '10.10.10.1/30'
~途中省略~
set vpn ipsec esp-group ESP compression 'disable'
set vpn ipsec esp-group ESP lifetime '3600'
set vpn ipsec esp-group ESP mode 'tunnel'
set vpn ipsec esp-group ESP pfs 'dh-group14'
set vpn ipsec esp-group ESP proposal 1 encryption 'aes256'
set vpn ipsec esp-group ESP proposal 1 hash 'sha256'
set vpn ipsec ike-group IKE ikev2-reauth 'no'
set vpn ipsec ike-group IKE key-exchange 'ikev2'
set vpn ipsec ike-group IKE lifetime '3600'
set vpn ipsec ike-group IKE proposal 1 dh-group '14'
set vpn ipsec ike-group IKE proposal 1 encryption 'aes256'
set vpn ipsec ike-group IKE proposal 1 hash 'sha256'
set vpn ipsec ipsec-interfaces interface 'eth0'
set vpn ipsec site-to-site peer B.B.B.B authentication id '10.200.10.20'
set vpn ipsec site-to-site peer B.B.B.B authentication mode 'pre-shared-secret'
set vpn ipsec site-to-site peer B.B.B.B authentication pre-shared-secret 'password'
set vpn ipsec site-to-site peer B.B.B.B authentication remote-id '192.168.1.2'
set vpn ipsec site-to-site peer B.B.B.B connection-type 'initiate'
set vpn ipsec site-to-site peer B.B.B.B default-esp-group 'ESP'
set vpn ipsec site-to-site peer B.B.B.B ike-group 'IKE'
set vpn ipsec site-to-site peer B.B.B.B ikev2-reauth 'inherit'
set vpn ipsec site-to-site peer B.B.B.B local-address '10.200.10.20'
set vpn ipsec site-to-site peer B.B.B.B vti bind 'vti1'
set vpn ipsec site-to-site peer B.B.B.B vti esp-group 'ESP'

これでトンネル間の疎通が取れた。

vyos@VPN1:~$ ping 10.10.10.2 interface vti1 PING 10.10.10.2 (10.10.10.2) from 10.10.10.1 vti1: 56(84) bytes of data. 64 bytes from 10.10.10.2: icmp_seq=1 ttl=255 time=6.92 ms 64 bytes from 10.10.10.2: icmp_seq=2 ttl=255 time=6.86 ms

ちなみにVyOS1.1.8(以前)の場合,show crypto session や show vpn ipsec sa でステータスがアップになるが,疎通が取れない。VyOS側で確認するとトンネルインタフェースがAdmin Down状態となってしまう。(原因不明)

vyos@VPN2:~$ sh int vti vti1
vti1@NONE: mtu 1500 qdisc noqueue state DOWN group default
link/ipip 10.200.10.20 peer B.B.B.B
inet 10.10.20.1/30 scope global vti1
valid_lft forever preferred_lft forever

RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collisions
0 0 0 0 0 0

VyOS1.1.x系はIKEv2に対してはlimited supportということで,今回は現時点で最新のベータバージョンを利用した。

CiscoルータでのVTI+IKEv2設定(NAT越し)

EC2にCisco1000vを立て, 自宅とVPNを張る。
以前, VyOSとでGRE over IPSecVTIと2パターンやったが, 今回はVTI+IKEv2でやる。
まずはCisco同士でトライ。

はじめに

「何故IKEv2でやろうとしたか」
単純にv2だからより安全なんだろうと思ったから。
IKEv1と何が違うのかは様々なサイトに詳しく書いてある。
・UNIVERGE IXシリーズ FAQ「IKEv2に関するFAQ
・Cisco IOS セキュリティ コンフィギュレーション ガ イド「Cisco IOS セキュリティ コンフィギュレーション ガ イドインターネット キー エクスチェンジ バージョ ン 2(IKEv2)の設定
個人的には設定の可視化レベルがcrypto mapよりは高いと感じた。P1のポリシーもピア毎に指定できるのでこのあたりは便利だと思う。(Site-to-Siteだとあまり恩恵は感じられないかもしれない)

構成概要

2台のルータでIPSecをVTI+IKEv2で張る。
それぞれのルータはNAT越しに通信する。
鍵交換はPSK。
暗号化周りはAES256, SHA2-256, DH 14。

構成概略図

前提条件

・EC2上にインスタンス作成済
・そのインスタンスにElastic IP割当済
・適切にセキュリティグループは設定済(UDP500・4500は許可等)
・自宅のGlobal IPは固定前提
・ブロードバンドルータでポートフォワーディング設定済

設定手順

Config上から流し込んでいくイメージでOK。
・IKEv2のプロポーザル設定
・IKEv2のポリシー設定
・IKEv2のKey設定
・IKEv2のプロファイル設定
・トランスフォームセット設定
・IPSECプロファイル設定
・トンネルインタフェース作成
・VTI適用

いざ設定

Configを抜粋。
基本的にこのまま流し込めばOK。

C841M
C1000v
!プロポーザル設定
crypto ikev2 proposal IKEv2_Proposal
encryption aes-cbc-256
integrity sha256
group 14

! ポリシー設定
crypto ikev2 policy IKEv2_Policy
proposal IKEv2_Proposal

!キー設定
crypto ikev2 keyring IKEv2_Key_Cisco
peer C1000V
address A.A.A.A
pre-shared-key password

! プロファイル設定
crypto ikev2 profile IKEv2_Profile_Cisco
match identity remote address 10.200.10.12 255.255.255.255
identity local address 192.168.1.2
authentication remote pre-share
authentication local pre-share
keyring local IKEv2_Key_Cisco
lifetime 3600

! トランスフォームセット設定
crypto ipsec transform-set IPSEC esp-aes 256 esp-sha256-hmac
mode tunnel

! IPSECプロファイル設定
crypto ipsec profile VTI_Cisco
set transform-set IPSEC
set ikev2-profile IKEv2_Profile_Cisco

! Tunnelインタフェース設定
interface Tunnel1
ip address 172.16.10.1 255.255.255.0
tunnel source G0/0
tunnel mode ipsec ipv4
tunnel destination A.A.A.A
tunnel protection ipsec profile VTI_Cisco
! プロポーザル設定
crypto ikev2 proposal IKEv2_Proposal
encryption aes-cbc-256
integrity sha256
group 14

! ポリシー設定
crypto ikev2 policy IKEv2_Policy
proposal IKEv2_Proposal

!キー設定
crypto ikev2 keyring IKEv2_Key_Cisco
peer C841M
address B.B.B.B
pre-shared-key password

! プロファイル設定
crypto ikev2 profile IKEv2_Profile_Cisco
match identity remote address 192.168.1.2 255.255.255.255
identity local address 10.1.1.10
authentication remote pre-share
authentication local pre-share
keyring local IKEv2_Key_Cisco
lifetime 3600

! トランスフォームセット設定
crypto ipsec transform-set IPSEC esp-aes 256 esp-sha256-hmac
mode tunnel

! IPSECプロファイル設定
crypto ipsec profile VTI_Cisco
set transform-set IPSEC
set ikev2-profile IKEv2_Profile_Cisco

! Tunnelインタフェース設定
interface Tunnel1
ip address 172.16.10.2 255.255.255.0
tunnel source G0/0
tunnel mode ipsec ipv4
tunnel destination B.B.B.B
tunnel protection ipsec profile VTI_Cisco

確認

c1000v#sh crypto ikev2 sa
IPv4 Crypto IKEv2 SA

Tunnel-id Local Remote fvrf/ivrf Status
1 10.1.1.10/4500 B.B.B.B/4500 none/none READY
Encr: AES-CBC, keysize: 256, PRF: SHA256, Hash: SHA256, DH Grp:14, Auth sign: PSK, Auth verify: PSK
Life/Active Time: 3600/2111 sec

IPv6 Crypto IKEv2 SA

c1000v#sh crypto ipsec sa

interface: Tunnel1
Crypto map tag: Tunnel1-head-0, local addr 10.1.1.10

protected vrf: (none)
local ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
current_peer B.B.B.B port 4500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 10, #pkts encrypt: 10, #pkts digest: 10
#pkts decaps: 10, #pkts decrypt: 10, #pkts verify: 10
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0

local crypto endpt.: 10.1.1.10, remote crypto endpt.: B.B.B.B
plaintext mtu 1422, path mtu 1500, ip mtu 1500, ip mtu idb GigabitEthernet1
current outbound spi: 0x3478CA01(880331265)
PFS (Y/N): N, DH group: none

inbound esp sas:
spi: 0x9AF7C1FF(2599928319)
transform: esp-256-aes esp-sha256-hmac ,
in use settings ={Tunnel UDP-Encaps, }
conn id: 2068, flow_id: CSR:68, sibling_flags FFFFFFFF80000048, crypto map: Tunnel1-head-0
sa timing: remaining key lifetime (k/sec): (4607998/1485)
IV size: 16 bytes
replay detection support: Y
Status: ACTIVE(ACTIVE)

inbound ah sas:

inbound pcp sas:

outbound esp sas:
spi: 0x3478CA01(880331265)
transform: esp-256-aes esp-sha256-hmac ,
in use settings ={Tunnel UDP-Encaps, }
conn id: 2067, flow_id: CSR:67, sibling_flags FFFFFFFF80000048, crypto map: Tunnel1-head-0
sa timing: remaining key lifetime (k/sec): (4607999/1485)
IV size: 16 bytes
replay detection support: Y
Status: ACTIVE(ACTIVE)

outbound ah sas:

outbound pcp sas:

c1000v#sh crypto session
Crypto session current status

Interface: Tunnel1
Profile: IKEv2_Profile
Session status: UP-ACTIVE
Peer: B.B.B.B port 4500
Session ID: 6
IKEv2 SA: local 10.1.1.10/4500 remote B.B.B.B/4500 Active
IPSEC FLOW: permit ip 0.0.0.0/0.0.0.0 0.0.0.0/0.0.0.0
Active SAs: 2, origin: crypto map

以上, お疲れ様でした。

AWS上のVyosと家のC841とでIPSecを試す~VTI編~

VTIでも設定したのでメモ・・・。

ACLいらないし, GRE分のオーバーヘッド(24バイト)も減るしこっちのほうがなんかいいかも。
# IP以外のプロトコルなんてあんま使わないしな。

 ■ MTU
#sh int tu1
Tunnel1 is up, line protocol is up
  Hardware is Tunnel
  Internet address is 192.168.48.234/29
  MTU 17862 bytes, BW 100 Kbit/sec, DLY 50000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive set (5 sec), retries 3
  Tunnel linestate evaluation up
  Tunnel source 192.168.1.2 (Vlan100), destination 52.196.175.0
   Tunnel Subblocks:
      src-track:
         Tunnel1 source tracking subblock associated with Vlan100
          Set of tunnels with source Vlan100, 1 member (includes iterators), on interface <OK>
  Tunnel protocol/transport IPSEC/IP
  Tunnel TTL 255
  Tunnel transport MTU 1422 bytes
  Tunnel transmit bandwidth 8000 (kbps)
  Tunnel receive bandwidth 8000 (kbps)
  Tunnel protection via IPSec (profile “VTI”)
  Last input 19:27:49, output 18:54:11, output hang never
  Last clearing of “show interface” counters 3d17h
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 330
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     12728 packets input, 1119256 bytes, 0 no buffer
     Received 0 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     68893 packets output, 4199880 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 unknown protocol drops
     0 output buffer failures, 0 output buffers swapped out
 permit ip host 172.16.1.1 host 172.16.1.2

以下, Config抜粋。

■ Cisco 抜粋
!
crypto isakmp policy 5
 encr aes 256
 hash sha256
 authentication pre-share
 group 14
 lifetime 3600
crypto isakmp key aws address A.A.A.A  255.255.255.255
crypto isakmp keepalive 30 30
!
!
crypto ipsec transform-set IPSEC esp-aes 256 esp-sha256-hmac 
 mode tunnel
!
crypto ipsec profile VTI
 set transform-set IPSEC
 set pfs group14

!
!
!
interface Tunnel1
 ip address 192.168.254.1 255.255.255.0
 ip mtu 1422   ! ← いらないかも。 不要でした。 ※
 ip ospf network broadcast
 ip ospf hello-interval 5
 keepalive 5 3
 tunnel source Vlan100
 tunnel mode ipsec ipv4
 tunnel destination A.A.A.A
 tunnel protection ipsec profile VTI

!
interface Vlan100
 ip address 192.168.1.2 255.255.255.0
 ip virtual-reassembly in
!
!
!
router ospf 1
 network 192.168.10.0 0.0.0.255 area 0
 network 192.168.254.0 0.0.0.255 area 0
!
!
ip access-list extended AWS_GRE
!
 permit ip host 172.16.1.1 host 172.16.1.2

※ VTIはMTUを自動計算するから設定は不要(Ciscoのページ参照

■ Vyos 抜粋
set interfaces loopback lo address ‘172.16.1.2/32’
set interfaces vti vti1 address ‘192.168.48.233/29’
set interfaces vti vti1 ip ospf dead-interval ’20’
set interfaces vti vti1 ip ospf hello-interval ‘5’
set interfaces vti vti1 ip ospf network ‘broadcast’
set interfaces vti vti1 ip ospf priority ‘1’
set interfaces vti vti1 ip ospf retransmit-interval ‘5’
set interfaces vti vti1 ip ospf transmit-delay ‘1’
set interfaces vti vti1 mtu ‘1422’

set protocols ospf area 0 network ‘192.168.254.0/24’
set protocols ospf area 0 network ‘10.10.20.0/24′
set protocols ospf log-adjacency-changes ‘detail’
set protocols static route 0.0.0.0/0 next-hop 10.10.10.1 distance ‘1’
—-
set vpn ipsec esp-group ESP_AWS compression ‘disable’
set vpn ipsec esp-group ESP_AWS lifetime ‘3600’
set vpn ipsec esp-group ESP_AWS mode ‘tunnel’
set vpn ipsec esp-group ESP_AWS pfs ‘enable’
set vpn ipsec esp-group ESP_AWS proposal 1 encryption ‘aes256’
set vpn ipsec esp-group ESP_AWS proposal 1 hash ‘sha256’
set vpn ipsec ike-group IKE_AWS dead-peer-detection action ‘hold’
set vpn ipsec ike-group IKE_AWS dead-peer-detection interval ’30’
set vpn ipsec ike-group IKE_AWS dead-peer-detection timeout ‘120’
set vpn ipsec ike-group IKE_AWS lifetime ‘3600’
set vpn ipsec ike-group IKE_AWS proposal 1 dh-group ’14’
set vpn ipsec ike-group IKE_AWS proposal 1 encryption ‘aes256’
set vpn ipsec ike-group IKE_AWS proposal 1 hash ‘sha256’
set vpn ipsec ipsec-interfaces interface ‘eth0’
set vpn ipsec logging log-modes ‘all’
set vpn ipsec nat-traversal ‘enable’
set vpn ipsec site-to-site peer Global IP authentication mode ‘pre-shared-secret’
set vpn ipsec site-to-site peer Global IP authentication pre-shared-secret ‘aws’
set vpn ipsec site-to-site peer Global IP authentication remote-id ‘192.168.1.2’
set vpn ipsec site-to-site peer Global IP connection-type ‘respond’
set vpn ipsec site-to-site peer Global IP ike-group ‘IKE_BB’
set vpn ipsec site-to-site peer Global IP ikev2-reauth ‘inherit’
set vpn ipsec site-to-site peer Global IP local-address ‘10.200.10.50’
set vpn ipsec site-to-site peer Global IP vti bind ‘vti1’
set vpn ipsec site-to-site peer Global IP vti esp-group ‘ESP_BB’

トンネル張った後に, 「OSPFでネイバーがーーー」ってなったけどMTUサイズがあっていなかったから。合わせればState Fullになる。