YAHAMAのブロードバンドルーターRTX1200を使用したVPN接続方法を紹介したいと思います。
RTX1200をそれぞれの拠点に設置し拠点間をVPN(IPSec)で接続するように設定をします。
構成は
[自宅PC(A)]—[RTX1200]—(インターネット)—[RTX1200]—[自宅PC(B)]
自宅(A)がVPNサーバー側(192.168.0.0/24、ルーターのIPアドレスは192.168.0.1)
自宅(B)がVPNクライアント側(192.168.100.0/24、ルーターのIPアドレスは192.168.100.1)
とします。
自宅(A)はグローバルアドレスは固定IPとします。
(例として10.0.0.1とする。)
自宅(A)のconfig例
(実際はコレにfilterなど追記します)
ip route default gateway pp 1 ip route 192.168.100.0/24 gateway tunnel 1 ip lan1 address 192.168.0.1/24 pp select 1 pp always-on on pppoe use lan2 pppoe auto connect on pppoe auto disconnect on pppoe disconnect time 600 pp auth accept pap chap pp auth myname username password ppp lcp mru on 1454 ppp ipcp ipaddress on ppp ipcp msext on ppp ccp type none ip pp address 10.0.0.1/32 ip pp mtu 1454 ip pp nat descriptor 1 pp enable 1
tunnel select 1 ipsec tunnel 101 ipsec sa policy 101 1 esp 3des-cbc md5-hmac ipsec ike duration ipsec-sa 1 600 ipsec ike duration isakmp-sa 1 600 ipsec ike keepalive use 1 auto heartbeat 5 2 ipsec ike local address 1 192.168.0.1 ipsec ike pre-shared-key 1 text TestSharedKey ipsec ike remote address 1 any ipsec ike remote name 1 TestRemoteName_B tunnel enable 2
nat descriptor type 1 nat-masquerade nat descriptor address outer 1 ipcp nat descriptor address inner 1 auto nat descriptor masquerade incoming 1 reject nat descriptor masquerade static 1 1 192.168.0.1 udp 500 nat descriptor masquerade static 1 2 192.168.0.1 esp
ipsec ike duration isakmp-sa 514 600
dhcp service server dhcp scope 1 192.168.0.2-192.168.0.63/24
dns server pp 1 dns private address spoof on
自宅(B)のconfig例
(実際はコレにfilterなど追記します)
ip route default gateway pp 1 ip route 192.168.0.0/24 gateway tunnel 1 ip lan1 address 192.168.100.1/24 pp select 1 pp name prov-name pp keepalive use off pp always-on on pppoe use lan2 pppoe auto connect on pppoe auto disconnect on pppoe disconnect time 600 pp auth accept pap chap pp auth myname username password ppp lcp mru on 1454 ppp ipcp ipaddress on ppp ipcp msext on ppp ccp type none ip pp mtu 1454 ip pp nat descriptor 1 pp enable 1tunnel select 1 ipsec tunnel 101 ipsec sa policy 101 1 esp 3des-cbc md5-hmac ipsec ike duration ipsec-sa 1 600 ipsec ike duration isakmp-sa 1 600 ipsec ike keepalive use 1 auto heartbeat 5 2 ipsec ike local address 1 192.168.100.1 ipsec ike local name 1 TestRemoteName_B key-id ipsec ike pre-shared-key 1 text TestSharedKey ipsec ike remote address 1 10.0.0.1 ip tunnel tcp mss limit auto tunnel enable 1
nat descriptor type 1 nat-masquerade nat descriptor address outer 1 ipcp nat descriptor address inner 1 auto nat descriptor masquerade incoming 1 reject nat descriptor masquerade static 1 1 192.168.100.1 udp 500 nat descriptor masquerade static 1 2 192.168.100.1 esp
ipsec auto refresh on ipsec ike retry 10 5 dns server pp 1 dns private address spoof on
自宅(B)からのリクエストでVPNが確立します。
上記の設定では10分間無通信状態が続くとVPNが切断されますが
ipsec ike allways-on 1 on
とすることで常時接続状態にすることができます。
次回は、YAMAHAのソフトウェアVPNから自宅(A)に接続できるように設定を追記したいと思います。
お名前.comのVPSとRTX1000の間にOpenswanを使ってIPSec方式のVPNを設定した
Windows化したさくらVPSサーバーと固定IPプロバイダでつないだRTX1000の間にアグレッシブモード・メインモードのIPSecを張っていたわけだけど、今回はCentOS 6環境のお名前.com VPS(KVM)サーバーとの間にメインモードのIPSec VPNの設定を行った。 IPSecはオープンな規格であるものの、独自実装が多くて、なかなか相互互換が得られない困ったちゃん。 特にLinuxのIPSec実装には色々なソフトがあって、つながる組み合わせ、つながらない組み合わせが難しい。 …