YAMAHAの仮想ルータ vRX for VMware ESXiを試用する - IPsec設定編 (original) (raw)

前回は、VMware ESXiにデプロイしたYAMAHA vRXのWAN側およびLAN側にIPアドレスのアサインやsshログインの為のsshサーバ設定、時刻情報を外部のNTPサーバから取得する為の設定など初期設定を実施した後、トライアル用の基本ライセンスとオプションライセンス(VPNライセンス)を適用させ、YAMAHA vRXの試用の為の環境を構築した。
今回はYAMAHA vRXの拠点間通信の対向先としてYAMAHA RTX810を使用し、拠点間のVPN通信を確立させてみた。
YAMAHA vRXとRTX810にIPsec VPNの簡単な設定を投入し、自側と至側のYAMAHAルータにてステータス確認のコマンドの実行および自側から至側に対しpingで疎通確認を実施した。
尚、VMware ESXiのインストールやYAMAHA vRXのデプロイおよび初期設定に関しては、当記事の下部に有る「関連記事」を参照。

IPsec VPNとは
ネットワーク層レベルでパケットの暗号化や認証を行い、接続先の間で安全な通信を行うためのプロトコルである。接続先との間でIPsec VPNの接続が確立すると、仮想的に接続先と直結するような形となる。

当方の環境
ホスト機:macOS 13.5.2 / MacBook Pro 2020 / RAM: 16GB / CPU: Intel Core i5 2.0GHz
VMware Fusion 12.2.5
VMware ESXi 7.0U3n
ゲスト機:YAMAHA vRX 19.01.09

今回の構成
YAMAHA vRXの接続先としてYAMAHA RTX810をヤフオクで調達。OpenBSD(jpmtkrpsv99)とYAMAHA RTX810が居る拠点をユーザサイト、YAMAHA vRX(jpmtkvmrt99)とAlpine Linux(jpmtkvmsv99)が居る拠点をデータセンタとした。OpenBSDとAlpine Linuxは既にインストールやデプロイ、対向先との間の通信の設定等は既に完了した状態である。

自側(YAMAHA RTX810)の設定

1.トンネルの設定
管理者モードに移行しtunnel select [トンネル番号]コマンドを叩くと、トンネルの設定モードに移行する。
...しまった。ホスト名とtunnel1の文字列がくっついてプロンプトの表記が汚い感じになっている。前記事でホスト名を設定した際、ホスト名の後ろにアンダースコア(_)等あまり目立たないような文字を入れていたら、もう少し見栄えが良くなっていたかもしれない。

jpmtkigrt01# tunnel select 1 jpmtkigrt01tunnel1# ipsec tunnel 1 jpmtkigrt01tunnel1# tunnel enable 1

2.IPsecとIKEの設定
IKE設定は事前共有鍵と自側や至側のIPアドレスを指定。
IPsec設定は暗号化アルゴリズムを指定。今回のIPsec設定およびIKE設定はYAMAHAルータの事始めという事でIPsec VPN通信で必要な最低限の設定のみ投入している。
tunnel select noneコマンドを打つ事で、トンネルの設定モードから抜ける事が出来る。

jpmtkigrt01tunnel1# ipsec sa policy 1 1 esp 3des-cbc md5-hmac jpmtkigrt01tunnel1# ipsec ike local address 1 192.168.3.249 jpmtkigrt01tunnel1# ipsec ike pre-shared-key 1 text yamaha jpmtkigrt01tunnel1# ipsec ike remote address 1 192.168.3.250 jpmtkigrt01tunnel1# tunnel select none jpmtkigrt01#

3.設定の反映とスタティックルートの追加
ipsec use onコマンドを打ちIPsecの利用を宣言、ipsec auto refresh onコマンドを打ち設定を定期的に反映させるよう設定。
最後に、対向先のLAN側のネットワークへの到達性を確保する為、スタティックルートを1本追加し、saveコマンドで設定内容を保存。

jpmtkigrt01# ipsec use on jpmtkigrt01# ipsec auto refresh on jpmtkigrt01# ip route 192.168.10.0/24 gateway tunnel 1 jpmtkigrt01# jpmtkigrt01# save Saving ... CONFIG0 Done . jpmtkigrt01#

4.YAMAHA RTX810の設定内容
RTX810側の設定は完了。現段階でのRTX810のConfigの内容は以下のとおり。

jpmtkigrt01# show config

RTX810 Rev.11.01.34 (Tue Nov 26 18:39:12 2019)

MAC Address : 00:a0:de:83:ab:77, 00:a0:de:83:ab:78

Memory 128Mbytes, 2LAN

main: RTX810 ver=00 serial=S3K042126 MAC-Address=00:a0:de:83:ab:77 MAC-Address=00:a0:de:83:ab:78

Reporting Date: Sep 24 12🔞41 2023

administrator password * login user hoge * console character ascii console prompt jpmtkigrt01 ip route default gateway 192.168.3.1 ip route 192.168.10.0/24 gateway tunnel 1 ip lan1 address 192.168.20.1/24 ip lan2 address 192.168.3.249/24 ip lan2 nat descriptor 1 tunnel select 1 ipsec tunnel 1 ipsec sa policy 1 1 esp 3des-cbc md5-hmac ipsec ike local address 1 192.168.3.249 ipsec ike pre-shared-key 1 text yamaha ipsec ike remote address 1 192.168.3.250 tunnel enable 1 nat descriptor type 1 nat-masquerade nat descriptor address outer 1 192.168.3.202-192.168.3.210 nat descriptor address inner 1 192.168.20.1-192.168.20.10 ipsec use on ipsec auto refresh on telnetd service off telnetd host lan dhcp service server dhcp server rfc2131 compliant except remain-silent dhcp scope 1 192.168.20.2-192.168.20.191/24 sshd service on sshd host key generate * jpmtkigrt01#

至側(YAMAHA vRX)の設定

1.トンネルの設定
RTX810と同様に、管理者モードに移行しtunnel select [トンネル番号]コマンドを叩くと、トンネルの設定モードに移行する。
トンネルの設定モードに移行すると、vRXもホスト名とtunnel1の文字列がくっついている。設定コマンドconsole prompt xxxxxxが言っているとおり、コンソール画面で設定対象機器を判別する為の設定なんだな。

jpmtkvmrt99# tunnel select 1 jpmtkvmrt99tunnel1# ipsec tunnel 1 jpmtkvmrt99tunnel1# tunnel enable 1

2.IPsecとIKEの設定
IKE設定は事前共有鍵と自側や至側のIPアドレスを指定。
IPsec設定は暗号化アルゴリズムを指定。
IKE設定とIPsec設定共に、コマンドはYAMAHA RTX810と同じである。

jpmtkvmrt99tunnel1# ipsec sa policy 1 1 esp 3des-cbc md5-hmac jpmtkvmrt99tunnel1# ipsec ike local address 1 192.168.3.250 jpmtkvmrt99tunnel1# ipsec ike pre-shared-key 1 text yamaha jpmtkvmrt99tunnel1# ipsec ike remote address 1 192.168.3.249 jpmtkvmrt99tunnel1# tunnel select none jpmtkvmrt99#

3.設定の反映とスタティックルートの追加
ipsec use onコマンドを打ちIPsecの利用を宣言、ipsec auto refresh onコマンドを打ち設定を定期的に反映させるよう設定。
最後に、対向先のLAN側のネットワークへの到達性を確保する為、スタティックルートを1本追加し、saveコマンドで設定内容を保存。
こちらもコマンドはYAMAHA RTX810と同じである。

jpmtkvmrt99# ipsec use on jpmtkvmrt99# ipsec auto refresh on jpmtkvmrt99# ip route 192.168.20.0/24 gateway tunnel 1 jpmtkvmrt99# jpmtkvmrt99# save Saving ... CONFIG0 Done . jpmtkigrt01#

4.YAMAHA vRXの設定内容
YAMAHA vRXの設定は完了。現段階でのConfigの内容は以下のとおり。

jpmtkvmrt99# show config

vRX Rev.19.01.09 (Mon Dec 13 20:58:00 2021) ** Compact Mode **

MAC Address : 00:0c:29:96:d7:cc, 00:0c:29:96:d7:d6

Memory 3778Mbytes, 4LAN

main: vRX MAC-Address=00:0c:29:96:d7:cc MAC-Address=00:0c:29:96:d7:d6

Reporting Date: Sep 24 12:38:28 2023

administrator password encrypted * login user hoge * console prompt jpmtkvmrt99 vrx user jpmtkvmrt99 * ip route default gateway 192.168.3.1 ip route 192.168.20.0/24 gateway tunnel 1 ip lan1 address 192.168.10.1/24 ip lan2 address 192.168.3.250/24 ip lan2 nat descriptor 1 tunnel select 1 ipsec tunnel 1 ipsec sa policy 1 1 esp 3des-cbc md5-hmac ipsec ike local address 1 192.168.3.250 ipsec ike pre-shared-key 1 text yamaha ipsec ike remote address 1 192.168.3.249 tunnel enable 1 nat descriptor type 1 nat-masquerade nat descriptor address outer 1000 192.168.3.102-192.168.3.110 nat descriptor address inner 1000 192.168.10.2-192.168.10.10 ipsec use on ipsec auto refresh on dhcp service server dhcp server rfc2131 compliant except remain-silent dhcp scope 1 192.168.10.2-192.168.10.10/24 dns server 8.8.8.8 sshd service on sshd host key generate * jpmtkvmrt99#

設定後の動作確認
まずは自側(YAMAHA RTX810)にてshow ipsec saコマンドを叩き、IPsecのトンネルが張れている事を確認。
1行目のISAKMP SA(鍵交換用のSA)、2行目のIPsec SA send(データ送信のSA)、3行目のIPsec SA recv(データ受信のSA)が出力されている事から、IPsecでVPN接続が張れている事が分かる。

jpmtkigrt01# show ipsec sa Total: isakmp:3 send:2 recv:2

sa sgw isakmp connection dir life[s] remote-id

1 1 - isakmp - 25762 192.168.3.250 4 1 1 tun[001]esp send 25764 192.168.3.250 5 1 1 tun[001]esp recv 25764 192.168.3.250 6 1 - isakmp - 25764 192.168.3.250 7 1 - isakmp - 26118 192.168.3.250 8 1 7 tun[001]esp send 26119 192.168.3.250 9 1 7 tun[001]esp recv 26119 192.168.3.250

jpmtkigrt01#

更に以下のコマンドを叩く事で、SAの中身を確認する事が出来る。
プロトコルとアルゴリズムと鍵(読めない状態で出力)が表示されている事が分かる。

jpmtkigrt01# show ipsec sa gateway 1 detail SA[1] Duration: 26424s Local ID: 192.168.3.249 Remote ID: 192.168.3.250 Protocol: IKE Algorithm: 3DES-CBC, SHA-1, MODP 1024bit SPI: a4 86 ae 35 3b 8d ed f8 d4 c8 1e 4f 03 fa d3 30 Key: ** ** ** ** ** (confidential) ** ** ** ** **

SA[4] Duration: 26426s Local ID: 192.168.3.249 Remote ID: 192.168.3.250 Direction: send Protocol: ESP (Mode: tunnel) Algorithm: 3DES-CBC (for Auth.: HMAC-MD5) SPI: fc 30 95 ca Key: ** ** ** ** ** (confidential) ** ** ** ** **

SA[5] Duration: 26426s Local ID: 192.168.3.249 Remote ID: 192.168.3.250 Direction: receive Protocol: ESP (Mode: tunnel) Algorithm: 3DES-CBC (for Auth.: HMAC-MD5) SPI: e9 a2 09 dd Key: ** ** ** ** ** (confidential) ** ** ** ** **

SA[6] Duration: 26426s Local ID: 192.168.3.249 Remote ID: 192.168.3.250 Protocol: IKE Algorithm: 3DES-CBC, SHA-1, MODP 1024bit SPI: 96 33 35 b7 be 28 4d 81 ee 4b cb f9 e3 c4 02 7d Key: ** ** ** ** ** (confidential) ** ** ** ** **

SA[7] Duration: 26780s Local ID: 192.168.3.249 Remote ID: 192.168.3.250 Protocol: IKE Algorithm: 3DES-CBC, SHA-1, MODP 1024bit SPI: 53 0f a4 0e c1 2e 72 5d 72 61 ea 79 20 56 da 63 Key: ** ** ** ** ** (confidential) ** ** ** ** **

SA[8] Duration: 26781s 2000000kbyte Local ID: 192.168.3.249 Remote ID: 192.168.3.250 Direction: send Protocol: ESP (Mode: tunnel) Algorithm: 3DES-CBC (for Auth.: HMAC-MD5) SPI: 71 f9 a1 59 Key: ** ** ** ** ** (confidential) ** ** ** ** **

SA[9] Duration: 26781s 2000000kbyte Local ID: 192.168.3.249 Remote ID: 192.168.3.250 Direction: receive Protocol: ESP (Mode: tunnel) Algorithm: 3DES-CBC (for Auth.: HMAC-MD5) SPI: 01 57 4e 9e Key: ** ** ** ** ** (confidential) ** ** ** ** **

jpmtkigrt01#

続けて、至側(YAMAHA vRX)もshow ipsec saコマンドを叩き、IPsecのトンネルが張れている事を確認。
自側と同様に、1行目のISAKMP SA(鍵交換用のSA)、2行目のIPsec SA send(データ送信のSA)、3行目のIPsec SA recv(データ受信のSA)が出力されている事から、IPsecでVPN接続が張れている事が分かる。

jpmtkvmrt99# show ipsec sa Total: isakmp:1 send:1 recv:1

sa sgw isakmp connection dir life[s] remote-id

1 1 - isakmp - 26046 192.168.3.249 2 1 1 tun[0001]esp send 26048 192.168.3.249 3 1 1 tun[0001]esp recv 26048 192.168.3.249

jpmtkvmrt99#

至側でも以下のコマンドを叩き、SAの中身を確認。
こちらもプロトコルとアルゴリズムと鍵(読めない状態で出力)が表示されている事が分かる。

jpmtkvmrt99# show ipsec sa gateway 1 detail SA[1] 寿命: 26001秒 自分側の識別子: 192.168.3.250 相手側の識別子: 192.168.3.249 プロトコル: IKE アルゴリズム: 3DES-CBC, SHA-1, MODP 1024bit SPI: 53 0f a4 0e c1 2e 72 5d 72 61 ea 79 20 56 da 63 鍵 : ** ** ** ** ** (confidential) ** ** ** ** **

SA[2] 寿命: 26003秒 2000000キロバイト 自分側の識別子: 192.168.3.250 相手側の識別子: 192.168.3.249 送受信方向: 送信 プロトコル: ESP (モード: tunnel) アルゴリズム: 3DES-CBC (認証: HMAC-MD5) SPI: 01 57 4e 9e 鍵 : ** ** ** ** ** (confidential) ** ** ** ** **

SA[3] 寿命: 26003秒 2000000キロバイト 自分側の識別子: 192.168.3.250 相手側の識別子: 192.168.3.249 送受信方向: 受信 プロトコル: ESP (モード: tunnel) アルゴリズム: 3DES-CBC (認証: HMAC-MD5) SPI: 71 f9 a1 59 鍵 : ** ** ** ** ** (confidential) ** ** ** ** **

jpmtkvmrt99#

自側のサーバから至側のサーバまでpingを飛ばす前に、至側のサーバのIPアドレスを確認する。
至側のサーバのIPアドレスは自側から見てNATで変換されたIPアドレスである為、至側のルータ(YAMAHA vRX)にてNATでアサインされたIPアドレスを確認する。
show nat descripter addressコマンドを至側のルータで打つと、至側のサーバのIPアドレス192.168.10.2に対し、192.168.3.103がアサインされている事が分かる。

jpmtkvmrt99# show nat descriptor address NAT/IPマスカレード 動作タイプ : 2 参照NATディスクリプタ : 1, 適用インタフェース : LAN2(1) 外側アドレス(Outer) 内側アドレス(Inner) TTL(秒) 192.168.3.103 192.168.10.2 860 192.168.3.104 auto - 192.168.3.105 auto - 192.168.3.106 auto - 192.168.3.107 auto - 192.168.3.108 auto - 192.168.3.109 auto - 192.168.3.110 auto - Masqueradeテーブル 外側アドレス: 192.168.3.102 ポート範囲: 60000-64095, 49152-59999, 44096-49151

有効なNATディスクリプタテーブルが1個ありました jpmtkvmrt99#

至側のサーバのIPアドレスが分かったところで、自側のサーバから至側のサーバまでpingを飛ばす。
遅延値が少々大きめな事が気になるものの、100%リプライ有り。

[hoge@jpmtkrpsv99 ~]$ ping -c 5 192.168.3.103 PING 192.168.3.103 (192.168.3.103): 56 data bytes 64 bytes from 192.168.3.103: seq=0 ttl=42 time=20.283ms 64 bytes from 192.168.3.103: seq=1 ttl=42 time=113.120ms 64 bytes from 192.168.3.103: seq=2 ttl=42 time=34.155ms 64 bytes from 192.168.3.103: seq=3 ttl=42 time=57.052ms 64 bytes from 192.168.3.103: seq=4 ttl=42 time=80.211ms

--- 192.168.10.2 ping statistics --- 5b packets transmitted, 5 packets received, 0% paclet loss round-trip min/avg/max = 20.283/60.964/113.120 ms [hoge@jpmtkvmsv99 ~]$