ネットワークアドレスが同一な2拠点をVPNで接続

試験にさえよく出るが、実はあまり使う機会がない同一セグメントをVPNで接続する(IPマスカレードではない)のYAMAHAバージョンを試してみました。
企業買収や統合ではよくあった気がしますが、最近はそうでもない感じです。
CiscoだとNAT poolを使用する感じで2拠点のPC同士でも接続できる形を目指しました。
  • 2拠点での構成
項目拠点A拠点B
実LANアドレス192.168.1.0/24192.168.1.0/24 ←重複
仮想VPN内アドレス10.10.10.0/24 に変換
VPN方式IPsec(IKEv1)IPsec(IKEv1)
YAMAHA機種RTX830RTX1210

拠点B側(変換する側)の設定例
1.1. NATディスクリプタ定義

nat descriptor type 1 masquerade
nat descriptor address outer 1 <拠点BのWANグローバルIP>
nat descriptor masquerade static 1 10.10.10.0 192.168.1.0 255.255.255.0
この設定により、
192.168.1.0/24(実アドレス) → 10.10.10.0/24(VPN経由で見せる仮想アドレス) にSNATされます。

1.2. VPNトンネル設定(IPsec)
ipsec ike pre-shared-key 1 text vpnpassword

ipsec ike keepalive log 1 off
ipsec ike local address 1 <拠点BのWAN IP>
ipsec ike remote address 1 <拠点AのWAN IP>

ipsec sa policy 1 1 esp aes256 sha256
ipsec auto refresh 1 on

ipsec tunnel 1
ipsec tunnel 1 remote address <拠点AのWAN IP>
ipsec tunnel 1 local id 1
ipsec tunnel 1 remote id 1
ipsec tunnel 1 sa policy 1 1
ipsec tunnel 1 ike pre-shared-key 1
ipsec tunnel 1 nat-traversal on
ipsec tunnel 1 nat descriptor 1

1.3. ルーティング設定
ip route 10.10.10.0/24 gateway tunnel 1
VPN経由で仮想アドレスを通す。

拠点A側(変換を受ける側)
2.1.通常のVPN/IPsec設定

ipsec ike pre-shared-key 1 text vpnpassword

ipsec ike keepalive log 1 off
ipsec ike local address 1 <拠点AのWAN IP>
ipsec ike remote address 1 <拠点BのWAN IP>

ipsec sa policy 1 1 esp aes256 sha256
ipsec auto refresh 1 on

ipsec tunnel 1
ipsec tunnel 1 remote address <拠点BのWAN IP>
ipsec tunnel 1 local id 1
ipsec tunnel 1 remote id 1
ipsec tunnel 1 sa policy 1 1
ipsec tunnel 1 ike pre-shared-key 1
ipsec tunnel 1 nat-traversal on

2.2仮想アドレスへのルート追加
ip route 10.10.10.0/24 gateway tunnel 1
VPNを通って 10.10.10.x へアクセスすると、拠点Bの 192.168.1.x へ到達。

通信フロー
1.拠点AのPCが 10.10.10.100 にアクセス
2.VPNトンネルでパケットが拠点Bへ転送
3.拠点BのYAMAHAが 10.10.10.100 → 192.168.1.100 にNAT変換してLANへ通す

注意点

項目内容
通信方向NAT変換される側(拠点B)→ VPN内で仮想アドレスに見せる
逆方向の通信拠点Bから拠点Aへ戻す場合も同様にSNATされる
アクセス制限ACLで10.10.10.0/24を許可すること
DNS名前解決を仮想アドレスに合わせるとよい(静的hostsファイルなど)

確認コマンド
show ipsec sa
show nat descriptor address translation 1
show status tunnel 1

  • 3拠点での構成

データセンター(拠点A)をハブとして顧客Bと顧客Cのネットワークアドレスが重複している構成
SaaSとか提供すると割とありがちな形だと思います。

項目拠点A顧客B顧客C
WANアドレス203.0.113.1
192.168.10.1
192.168.10.2 203.0.113.3
実LANアドレス192.168.10.0/24192.168.1.0/24192.168.1.0/24 ←重複
仮想VPN内アドレス10.1.1.0/2410.1.2.0/24
接続専用線+VPN(顧客B)
インターネットVPN(顧客C)
L2専用線 + VPNインターネットVPN
VPN方式IPsec(IKEv1)IPsec(IKEv1)IPsec(IKEv1)
YAMAHA機種RTX830RTX830RTX830

拠点AのRTX830設定
ip route 10.1.1.0/24 gateway tunnel 1
ip route 10.1.2.0/24 gateway tunnel 2

ipsec ike pre-shared-key 1 text keyforB
ipsec ike pre-shared-key 2 text keyforC

ipsec ike local address 1 192.168.10.1 ; A側のL2アドレス
ipsec ike remote address 1 192.168.10.2 ; B側のL2アドレス

ipsec ike local address 2 203.0.113.1
ipsec ike remote address 2 203.0.113.3

ipsec sa policy 1 1 esp aes256 sha256
ipsec sa policy 2 1 esp aes256 sha256

ipsec tunnel 1
ipsec tunnel 1 remote address 192.168.10.2
ipsec tunnel 1 ike pre-shared-key 1
ipsec tunnel 1 sa policy 1 1
ipsec tunnel 1 nat descriptor 1
ipsec tunnel 1 nat-traversal off

ipsec tunnel 2
ipsec tunnel 2 remote address 203.0.113.3
ipsec tunnel 2 ike pre-shared-key 2
ipsec tunnel 2 sa policy 2 1
ipsec tunnel 2 nat descriptor 2
ipsec tunnel 2 nat-traversal on

拠点BのRTX830設定(L2+IPsec)
nat descriptor type 1 masquerade
nat descriptor masquerade static 1 10.1.1.0 192.168.1.0 255.255.255.0

ip route 192.168.10.0/24 gateway tunnel 1

ipsec ike pre-shared-key 1 text keyforB

ipsec ike local address 1 192.168.10.2
ipsec ike remote address 1 192.168.10.1

ipsec sa policy 1 1 esp aes256 sha256

ipsec tunnel 1
ipsec tunnel 1 remote address 192.168.10.1
ipsec tunnel 1 ike pre-shared-key 1
ipsec tunnel 1 sa policy 1 1
ipsec tunnel 1 nat descriptor 1
ipsec tunnel 1 nat-traversal off

拠点CのRTX830設定(インターネットVPN
nat descriptor type 1 masquerade
nat descriptor masquerade static 1 10.1.2.0 192.168.1.0 255.255.255.0

ip route 192.168.10.0/24 gateway tunnel 1

ipsec ike pre-shared-key 1 text keyforC

ipsec ike local address 1 203.0.113.3
ipsec ike remote address 1 203.0.113.1

ipsec sa policy 1 1 esp aes256 sha256

ipsec tunnel 1
ipsec tunnel 1 remote address 203.0.113.1
ipsec tunnel 1 ike pre-shared-key 1
ipsec tunnel 1 sa policy 1 1
ipsec tunnel 1 nat descriptor 1
ipsec tunnel 1 nat-traversal on

補足事項

設定項目解説
nat-traversal offL2内ではNAT不要なため、明示的にオフにします
local addressIPsec IKEの送信元IPとしてL2用IPを使います
NATディスクリプタ(descriptor)アドレス重複を避けるため仮想アドレスに変換します
VPNトンネルCとのVPNは通常通り NATを使って接続します

ご参考

関連記事

TOP