RTX1210で拠点間VPN接続(IPsec+L2TP)
先日YAMAHAのRTX1210にて、固定IP-動的IPにてVPN接続する案件があったので、設定をご紹介します。
拠点1 本社(固定グローバルIP)
拠点2 支社(普通のインターネット接続(動的グローバルIP/PPPoE))
接続構成
片方が固定IP、もう片方は通常のプロバイダ接続(動的IP)での接続です。
RTX1210インタフェース構成
・拠点1
・拠点2
LAN1・・・VPN経由で共有するネットワーク(10.0.1.0/24)
LAN2・・・WAN側インタフェース(PPPoE or 固定グローバルIP)
LAN3・・・VPNを経由せずにインターネット接続できるネットワーク
仮に、ユーザー名は両方”testadmin”としています。
拠点1 設定内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
login password * administrator password * login user testadmin * user attribute connection=serial ip route default gateway <<固定IPデフォルトゲートウェイ>> ip filter source-route on ip filter directed-broadcast on ip keepalive 1 icmp-echo 10 5 <<固定IPデフォルトゲートウェイ>> bridge member bridge1 lan1 tunnel1 //VPN経由で共有するプライベートNWのインタフェースとVPNインタフェース(tunnel1)を含める ip bridge1 address 10.0.1.5/24 //Lan1インタフェースではなく、bridgeインタフェースへIPを設定する description lan2 OCN //接続するプロバイダ名をコメントで入れておく ip lan2 address <<ルーター(Lan2)に設定する固定グローバルIP>> ip lan2 secure filter in 5000 5001 5006 5007 5008 5100 5101 5102 5103 20020 20021 20022 20023 20024 20025 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 ip lan2 secure filter out 15000 15001 15002 15003 20020 20021 20022 20023 20024 20025 15026 15027 9999 ip lan2 nat descriptor 200 ip lan3 address 192.168.10.1/24 //Lan3は予備NW。なくてもOK tunnel select 1 tunnel encapsulation l2tpv3 //L2TPver3を指定 ipsec tunnel 101 ipsec sa policy 101 1 esp aes-cbc sha-hmac ipsec ike keepalive log 1 on ipsec ike keepalive use 1 on ipsec ike local address 1 10.0.1.5 //自分側のbridgeインタフェースのIP ipsec ike nat-traversal 1 on ipsec ike pre-shared-key 1 text testtest //Keyは仮に”testtest”としています ipsec ike remote address 1 any //相手側は動的IPで不明のため、”any”とします ipsec ike remote name 1 osaka key-id //any接続のため、相手側の名前を設定します。仮に”osaka”とします l2tp always-on on l2tp hostname tokyo //自分側の名前は仮に”tokyo”とします l2tp tunnel auth on testtest //トンネル認証パスワードは仮に”testtest”とします l2tp tunnel disconnect time off l2tp keepalive use on 60 3 l2tp keepalive log on l2tp syslog on l2tp local router-id 10.0.1.5 //自分側のbridgeインタフェースのIP l2tp remote router-id 10.0.1.10 //相手側のbridgeインタフェースのIP l2tp remote end-id testtest //remote end-idは仮に”testtest”とします ip tunnel tcp mss limit auto tunnel enable 1 ip filter 1 pass-log * * * * * ip filter 5000 pass * * udp 4500 * ip filter 5001 pass * * udp * 4500 ip filter 5006 pass * * ah,esp ip filter 5007 pass * * udp 500 * ip filter 5008 pass * * udp * 500 ip filter 5030 pass * 192.168.10.0/24 icmp * * ip filter 5031 pass * 192.168.10.0/24 established * * ip filter 5032 pass * 192.168.10.0/24 tcp * ident ip filter 5033 pass * 192.168.10.0/24 tcp ftpdata * ip filter 5034 pass * 192.168.10.0/24 tcp,udp * domain ip filter 5035 pass * 192.168.10.0/24 udp domain * ip filter 5036 pass * 192.168.10.0/24 udp * ntp ip filter 5037 pass * 192.168.10.0/24 udp ntp * ip filter 5038 pass * 10.0.1.0/24 icmp * * ip filter 5039 pass * 10.0.1.0/24 established * * ip filter 5040 pass * 10.0.1.0/24 tcp * ident ip filter 5041 pass * 10.0.1.0/24 tcp ftpdata * ip filter 5042 pass * 10.0.1.0/24 tcp,udp * domain ip filter 5043 pass * 10.0.1.0/24 udp domain * ip filter 5044 pass * 10.0.1.0/24 udp * ntp ip filter 5045 pass * 10.0.1.0/24 udp ntp * ip filter 5100 reject 10.0.0.0/8 * * * * ip filter 5101 reject 172.16.0.0/12 * * * * ip filter 5102 reject 192.168.0.0/16 * * * * ip filter 5103 reject 192.168.10.0/24 * * * * ip filter 9999 pass * * * * * ip filter 15000 reject * 10.0.0.0/8 * * * ip filter 15001 reject * 172.16.0.0/12 * * * ip filter 15002 reject * 192.168.0.0/16 * * * ip filter 15003 reject * 192.168.10.0/24 * * * ip filter 15026 restrict * * tcpfin * www,21,nntp ip filter 15027 restrict * * tcprst * www,21,nntp ip filter 20020 reject * * udp,tcp 135 * ip filter 20021 reject * * udp,tcp * 135 ip filter 20022 reject * * udp,tcp netbios_ns-netbios_ssn * ip filter 20023 reject * * udp,tcp * netbios_ns-netbios_ssn ip filter 20024 reject * * udp,tcp 445 * ip filter 20025 reject * * udp,tcp * 445 ip filter 500000 restrict * * * * * ip filter dynamic 101080 * * ftp ip filter dynamic 101081 * * domain ip filter dynamic 101082 * * www ip filter dynamic 101083 * * smtp ip filter dynamic 101084 * * pop3 ip filter dynamic 101085 * * submission ip filter dynamic 101098 * * tcp ip filter dynamic 101099 * * udp nat descriptor type 200 masquerade nat descriptor address outer 200 primary nat descriptor address inner 200 auto nat descriptor masquerade static 200 1 10.0.1.5 udp 500 //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT nat descriptor masquerade static 200 2 10.0.1.5 esp //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT nat descriptor masquerade static 200 3 10.0.1.5 udp 4500 //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT nat descriptor masquerade static 200 4 10.0.1.5 tcp telnet //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT ipsec auto refresh on ipsec ike retry 10 5 ipsec transport 1 101 udp 1701 syslog notice on syslog debug on telnetd service on telnetd host 10.0.1.1-10.0.1.254 dhcp service server dhcp server rfc2131 compliant except remain-silent dhcp scope 1 192.168.10.2-192.168.10.191/24 dns host lan3 dns server <<プロバイダのDNSサーバーのIP>> dns server select 500201 <<プロバイダのDNSサーバーのIP>> any . dns private address spoof on l2tp service on l2tpv3 httpd service on httpd host 10.0.1.1-10.0.1.254 sshd service off sshd host 10.0.1.1-10.0.1.254 dashboard accumulate traffic on |
拠点2 設定内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
login password encrypted * administrator password * login user testadmin * user attribute connection=serial ip route default gateway pp 1 ip filter source-route on ip filter directed-broadcast on bridge member bridge1 lan1 tunnel1 //VPN経由で共有するプライベートNWのインタフェースとVPNインタフェース(tunnel1)を含める ip bridge1 address 10.0.1.10/24 //Lan1インタフェースではなく、bridgeインタフェースへIPを設定する ip lan3 address 192.168.30.1/24 //Lan3は予備NW。なくてもOK pp select 1 description pp OCN //接続するプロバイダ名をコメントで入れておく pp keepalive interval 30 retry-interval=30 count=12 pp always-on on pppoe use lan2 pppoe auto disconnect off pp auth accept pap chap pp auth myname <<PPPoEアカウントID>> <<PPPoEアカウントパスワード>> ppp lcp mru on 1454 ppp ipcp ipaddress on ppp ipcp msext on ppp ccp type none ip pp mtu 1454 ip pp secure filter in 5000 5001 5006 5007 5008 5100 5101 5102 5103 20020 20021 20022 20023 20024 20025 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 ip pp secure filter out 15000 15001 15002 15003 20020 20021 20022 20023 20024 20025 15026 15027 9999 ip pp nat descriptor 1000 pp enable 1 tunnel select 1 tunnel encapsulation l2tpv3 //L2TPver3を指定 tunnel endpoint address 10.0.1.10 <<拠点1の固定グローバルIP>> ipsec tunnel 101 ipsec sa policy 101 1 esp aes-cbc sha-hmac ipsec ike keepalive log 1 on ipsec ike keepalive use 1 on ipsec ike local address 1 10.0.1.10 //自分側のbridgeインタフェースのIP ipsec ike local name 1 osaka key-id //any接続VPNのKeyを設定。相手側の”ipsec ike remote name 1 osaka key-id”と同じ文字列 ipsec ike nat-traversal 1 on ipsec ike pre-shared-key 1 text testtest //Keyは仮に”testtest”としています ipsec ike remote address 1 <<拠点1の固定グローバルIP>> l2tp always-on on l2tp hostname osaka //自分側の名前は仮に”osaka”とします l2tp tunnel auth on testtest //トンネル認証パスワードは仮に”testtest”とします l2tp tunnel disconnect time off l2tp keepalive use on 60 3 l2tp keepalive log on l2tp syslog on l2tp local router-id 10.0.1.10 //自分側のbridgeインタフェースのIP l2tp remote router-id 10.0.1.5 //相手側のbridgeインタフェースのIP l2tp remote end-id testtest //remote end-idは仮に”testtest”とします ip tunnel tcp mss limit auto tunnel enable 1 ip filter 1 pass-log * * * * * ip filter 5000 pass <<拠点1の固定グローバルIP>> * udp 4500 * ip filter 5001 pass <<拠点1の固定グローバルIP>> * udp * 4500 ip filter 5006 pass <<拠点1の固定グローバルIP>> * ah,esp ip filter 5007 pass <<拠点1の固定グローバルIP>> * udp 500 * ip filter 5008 pass <<拠点1の固定グローバルIP>> * udp * 500 ip filter 5030 pass * 192.168.30.0/24 icmp * * ip filter 5031 pass * 192.168.30.0/24 established * * ip filter 5032 pass * 192.168.30.0/24 tcp * ident ip filter 5033 pass * 192.168.30.0/24 tcp ftpdata * ip filter 5034 pass * 192.168.30.0/24 tcp,udp * domain ip filter 5035 pass * 192.168.30.0/24 udp domain * ip filter 5036 pass * 192.168.30.0/24 udp * ntp ip filter 5037 pass * 192.168.30.0/24 udp ntp * ip filter 5038 pass * 10.0.1.0/24 icmp * * ip filter 5039 pass * 10.0.1.0/24 established * * ip filter 5040 pass * 10.0.1.0/24 tcp * ident ip filter 5041 pass * 10.0.1.0/24 tcp ftpdata * ip filter 5042 pass * 10.0.1.0/24 tcp,udp * domain ip filter 5043 pass * 10.0.1.0/24 udp domain * ip filter 5044 pass * 10.0.1.0/24 udp * ntp ip filter 5045 pass * 10.0.1.0/24 udp ntp * ip filter 5100 reject 10.0.0.0/8 * * * * ip filter 5101 reject 172.16.0.0/12 * * * * ip filter 5102 reject 192.168.0.0/16 * * * * ip filter 5103 reject 192.168.30.0/24 * * * * ip filter 9999 pass * * * * * ip filter 15000 reject * 10.0.0.0/8 * * * ip filter 15001 reject * 172.16.0.0/12 * * * ip filter 15002 reject * 192.168.0.0/16 * * * ip filter 15003 reject * 192.168.30.0/24 * * * ip filter 15026 restrict * * tcpfin * www,21,nntp ip filter 15027 restrict * * tcprst * www,21,nntp ip filter 20020 reject * * udp,tcp 135 * ip filter 20021 reject * * udp,tcp * 135 ip filter 20022 reject * * udp,tcp netbios_ns-netbios_ssn * ip filter 20023 reject * * udp,tcp * netbios_ns-netbios_ssn ip filter 20024 reject * * udp,tcp 445 * ip filter 20025 reject * * udp,tcp * 445 ip filter 500000 restrict * * * * * ip filter dynamic 200080 * * ftp ip filter dynamic 200081 * * domain ip filter dynamic 200082 * * www ip filter dynamic 200083 * * smtp ip filter dynamic 200084 * * pop3 ip filter dynamic 200085 * * submission ip filter dynamic 200098 * * tcp ip filter dynamic 200099 * * udp nat descriptor type 1000 masquerade nat descriptor address outer 1000 ipcp nat descriptor address inner 1000 auto nat descriptor masquerade static 1000 1 10.0.1.10 udp 500 //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT nat descriptor masquerade static 1000 2 10.0.1.10 esp //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT nat descriptor masquerade static 1000 3 10.0.1.10 udp 4500 //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT nat descriptor masquerade static 1000 4 10.0.1.10 tcp telnet //VPNの接続に必要な通信をbridgeインタフェースのIPへ固定NAT ipsec auto refresh on ipsec ike retry 10 5 ipsec ike log key-info message-info payload-info ipsec transport 1 101 udp 1701 syslog notice on syslog debug on telnetd service on telnetd host 10.0.1.1-10.0.1.254 dhcp service server dhcp server rfc2131 compliant except remain-silent dhcp scope 1 192.168.30.3-192.168.30.191/24 gateway 192.168.20.1 dns host lan3 dns server pp 1 dns server select 500001 pp 1 any . restrict pp 1 dns private address spoof on l2tp service on l2tpv3 httpd service on httpd host 10.0.1.1-10.0.1.254 sshd service off sshd host 10.0.1.1-10.0.1.254 dashboard accumulate traffic on |
L2TPのVPNですが、同じネットワークを離れた拠点で共有できるので、大変便利です。
ファイルサーバーを共有できたり、社内のネットワークカメラを離れた拠点に設置できたり、
少し強引ですが、IP対応のビジネス電話であれば、VPN越しに内線転送も可能です。
IPsec/L2TPのVPNが7万円くらいのルーター2台で実現できるなんて、いい時代になりましたね。
参考になれば幸いです。