やりたいこと
Azureにある踏み台サーバとSite-to-Site VPN経由でAWSにあるリモートホストに接続する
設定内容
Azure
VNETピアリング
Azure VNET"10.30.0.0/16"⇒VNET"10.20.0.0/16"のピアリング設定
赤枠の設定でAzure VNET"10.20.0.0/16"のVirtual Network Gatewayを使用するようにする
逆方向のAzure VNET"10.30.0.0/16"←VNET"10.20.0.0/16"にも同様に設定
Virtual Network Gateway
通常の手順でAWSのVPN Gatewayと接続設定
AWS
VPN Gateway
通常の手順でAzureのVirtual Network Gatewayと接続設定
静的ルートはAzure VNET"10.30.0.0/16"を設定する
ルートテーブル
リモートホストが属するAWS VPN"10.10.0.0/16"のプライベートサブネットにアタッチされているルートテーブルの設定
送信先をAzure VNET"10.30.0.0/16"とし、ターゲットに上記VPN Gatewayを設定する
セキュリティグループ
リモートホストにアタッチされているセキュリティグループのインバウンドルール設定
接続確認
# ローカルクライアントから踏み台に接続してポートフォワード設定
ssh azureuser@<踏み台サーバのパブリックIP> -L 10022:10.10.0.128:22 -N
# ローカルクライアントでもう一つターミナルを開いてリモートホストに接続
ssh ec2-user@localhost -i <リモートホストの秘密鍵のパス> -p 10022