この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
mae3xx_tips:setup_openvpn:start [2014/09/10 10:15] admin |
mae3xx_tips:setup_openvpn:start [2019/02/25 14:50] (現在) admin |
||
---|---|---|---|
ライン 1: | ライン 1: | ||
+ | ====== OpenVPN の導入 ====== | ||
+ | |||
+ | [[https://openvpn.net/|{{:mae3xx_tips:setup_openvpn:openvpn_logo.png|OpenVPN}}]] | ||
+ | |||
+ | 『[[mae3xx_tips:connect_with_pptp:start]]』 で試したように、PPTP はお手軽で家庭用ルータにも接続できて便利なのですが、\\ | ||
+ | 下記のような問題点があります。 | ||
+ | |||
+ | 参考 | ||
+ | * [[http://www.tatsuyababa.com/NW-VPN/NW-200406-VPN04.pdf|PPTPを使用したリモートアクセスVPNの仕組み]] (PDF) | ||
+ | * [[http://japan.cnet.com/news/service/35019787/|DEFCON参加の専門家、「MS-CHAP v2」をクラックするツールを発表 - CNET Japan]] | ||
+ | |||
+ | 問題点 | ||
+ | * ルータに PPTP パススルー機能が必要 | ||
+ | * ルータのローカル側に、複数のクライアントが存在することができない | ||
+ | |||
+ | |||
+ | よりセキュアに、なおかつ、IPsec よりお手軽に VPN を、という場合、[[http://www.openvpn.jp/|OpenVPN]] という選択肢が考えられると思います。\\ | ||
+ | 比較表を作っているサイトもありました。 | ||
+ | |||
+ | [[https://www.ivpn.net/pptp-vs-l2tp-vs-openvpn|PPTP VS L2TP/IPSEC VS OPENVPN - IVPN]] より | ||
+ | |||
+ | <code> | ||
+ | Conclusion | ||
+ | |||
+ | OpenVPN is the best choice for all platforms. It is extremely fast, secure and reliable. | ||
+ | Additionally, the IVPN multihop network is only available when connecting via OpenVPN. | ||
+ | The only minor downside is the requirement to install the software client but on most | ||
+ | platforms this only takes a few minutes. | ||
+ | </code> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ここでは、VPS に MA-E3xx から OpenVPN で接続して、センサーデータをセキュアな経路で送信するというケースを想定し、セットアップを行ってみます。\\ | ||
+ | サーバは、[[http://vps.sakura.ad.jp/|さくらの VPS]] の メモリ2GiB, HDD 200GB, CPU 3core プラン(1522円/月, 月払い) を使用します。 | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ===== 設定 ===== | ||
+ | |||
+ | * [[.setup_server:start]] | ||
+ | * [[.setup_client:start]] | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ===== よくある質問 ===== | ||
+ | |||
+ | ==== PPP(PPPoE 含) 経由の接続が不安定 ==== | ||
+ | |||
+ | Flet's など PPP 経由では MTU が小さくなるため、OpenVPN デフォルトの MTU 1500bytes のままですと、不安定、もしくは接続されているのにパケットが通らないという結果になります。\\ | ||
+ | その場合、サーバ・クライアント双方の設定ファイルに、下記を追加することで解消されるケースがほとんどです。 | ||
+ | |||
+ | <code> | ||
+ | fragment 1426 | ||
+ | mssfix | ||
+ | </code> | ||
+ | |||
+ | ※ 1426 の数値は、環境により調整が必要な場合があります。[さくらの VPS] <-> [FOMA 回線 (DTI)] でパケットが通る (SSH 接続が可能) ことを確認しています。 | ||
+ | |||
+ | 参考: | ||
+ | * [[https://forums.openvpn.net/topic15930.html|achieving maximum efficiency - OpenVPN community support forum]] | ||
+ | * [[http://yamatamemo.blogspot.jp/2012/01/openvpn-1.html|OpenVPNのスループットと最適化 - 1 - yamata::memo]] | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ==== スループットの目安 ==== | ||
+ | |||
+ | === 固定回線使用 (光) === | ||
+ | |||
+ | 弊社回線から、さくらの VPS (石狩リージョン) へ iperf で測定してみた結果です。\\ | ||
+ | あくまでも **目安** です。 | ||
+ | |||
+ | * OpenVPN 経由せず | ||
+ | |||
+ | <code> | ||
+ | $ iperf -c 133.242.xxx.xxx | ||
+ | ------------------------------------------------------------ | ||
+ | Client connecting to 133.242.xxx.xxx, TCP port 5001 | ||
+ | TCP window size: 43.8 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 3] local 192.168.253.49 port 40814 connected with 133.242.xxx.xxx port 5001 | ||
+ | [ ID] Interval Transfer Bandwidth | ||
+ | [ 3] 0.0-10.0 sec 102 MBytes 85.1 Mbits/sec | ||
+ | </code> | ||
+ | |||
+ | * OpenVPN 経由 (MA-E3xx) | ||
+ | |||
+ | <code> | ||
+ | $ iperf -c 10.8.0.1 | ||
+ | ------------------------------------------------------------ | ||
+ | Client connecting to 10.8.0.1, TCP port 5001 | ||
+ | TCP window size: 43.8 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 3] local 10.8.0.30 port 50418 connected with 10.8.0.1 port 5001 | ||
+ | [ ID] Interval Transfer Bandwidth | ||
+ | [ 3] 0.0-10.0 sec 49.9 MBytes 41.7 Mbits/sec | ||
+ | </code> | ||
+ | |||
+ | * OpenVPN 経由 (PC, Core i7-860) | ||
+ | |||
+ | <code> | ||
+ | % iperf -c 10.100.0.1 | ||
+ | ------------------------------------------------------------ | ||
+ | Client connecting to 10.100.0.1, TCP port 5001 | ||
+ | TCP window size: 45.0 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 3] local 10.100.0.6 port 37776 connected with 10.100.0.1 port 5001 | ||
+ | [ ID] Interval Transfer Bandwidth | ||
+ | [ 3] 0.0-10.0 sec 47.6 MBytes 39.8 Mbits/sec | ||
+ | </code> | ||
+ | |||
+ | * OpenVPN 経由 (さくらの VPS 間) | ||
+ | |||
+ | <code> | ||
+ | $ iperf -c 10.100.0.1 | ||
+ | ------------------------------------------------------------ | ||
+ | Client connecting to 10.100.0.1, TCP port 5001 | ||
+ | TCP window size: 45.0 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 3] local 10.100.0.14 port 53649 connected with 10.100.0.1 port 5001 | ||
+ | [ ID] Interval Transfer Bandwidth | ||
+ | [ 3] 0.0-10.0 sec 143 MBytes 120 Mbits/sec | ||
+ | </code> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | === FOMA 経由 === | ||
+ | |||
+ | MA-E350/N (u-blox LISA-U200) でスループットを測定した結果です。 | ||
+ | |||
+ | * DTI 上り | ||
+ | |||
+ | <code> | ||
+ | root@plum:~# iperf -c 10.8.0.1 | ||
+ | ------------------------------------------------------------ | ||
+ | Client connecting to 10.8.0.1, TCP port 5001 | ||
+ | TCP window size: 43.8 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 3] local 10.8.0.30 port 49969 connected with 10.8.0.1 port 5001 | ||
+ | [ ID] Interval Transfer Bandwidth | ||
+ | [ 3] 0.0-10.2 sec 3.00 MBytes 2.47 Mbits/sec | ||
+ | </code> | ||
+ | |||
+ | * DTI 下り (MA-E350/N が server) | ||
+ | |||
+ | <code> | ||
+ | root@plum:~# iperf -s | ||
+ | ------------------------------------------------------------ | ||
+ | Server listening on TCP port 5001 | ||
+ | TCP window size: 85.3 KByte (default) | ||
+ | ------------------------------------------------------------ | ||
+ | [ 4] local 10.8.0.30 port 5001 connected with 10.8.0.1 port 53647 | ||
+ | [ ID] Interval Transfer Bandwidth | ||
+ | [ 4] 0.0-12.2 sec 1.12 MBytes 776 Kbits/sec | ||
+ | </code> | ||