家とかオフィスに専用線があればいいのになぁ、とか、外からLANに接続したいなぁとか、そんな軽い感じで、VPNを張ってみたという話なんですけど。
ソフトウェアVPNだとSoftEtherが今のところクロスプラットフォームで使い勝手がいいので、SoftEtherを入れてみることにしました
1.インストール
依存パッケージの解決をする必要があるかもしれませんので
sudo apt-get -y install bridge-utils
とやって、ブリッジ用のライブラリを入れておいてください
cd /opt wget "http://jp.softether-download.com/files/softether/v4.04-9412-rtm-2014.01.15-tree/Linux/SoftEther%20VPN%20Server/32bit%20-%20ARM%20EABI/softether-vpnserver-v4.04-9412-rtm-2014.01.15-linux-arm_eabi-32bit.tar.gz" tar xzvf softether-vpnserver-v4.04-9412-rtm-2014.01.15-linux-arm_eabi-32bit.tar.gz cd /opt/vpnserver/ make
と入力。ライセンスに同意(Yes)でビルド完了、次に、システムがさわれる位置に移動します
mv vpnserver /usr/local cd /usr/local/vpnserver/ chmod 600 * chmod 700 vpncmd chmod 700 vpnserver
サービス化のスクリプトを書く
vim /etc/init.d/vpnserver
内容は以下のように
#!/bin/sh ### BEGIN INIT INFO # Provides: vpnserver # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: SoftEther VPN RC2 # Description: Start vpnserver daemon SoftEther VPN Server ### END INIT INFO DAEMON=/usr/local/vpnserver/vpnserver LOCK=/var/lock/vpnserver . /lib/lsb/init-functions test -x $DAEMON || exit 0 case "$1" in start) sleep 3 log_daemon_msg "Starting SoftEther VPN Server" "vpnserver" $DAEMON start >/dev/null 2>&1 touch $LOCK log_end_msg 0 sleep 3 ;; stop) log_daemon_msg "Stopping SoftEther VPN Server" "vpnserver" $DAEMON stop >/dev/null 2>&1 rm $LOCK log_end_msg 0 sleep 2 ;; restart) $DAEMON stop sleep 2 $DAEMON start sleep 5 ;; status) if [ -e $LOCK ] then echo "vpnserver is running." else echo "vpnserver is not running." fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0
実行権限を与える。
sudo chmod +x /etc/init.d/vpnserver
vpnserverの起動
sudo /etc/init.d/vpnserver start
SoftEther VPNサーバ管理マネージャのインストール
次にサーバー管理ツールのみをインストールします。
http://jp.softether-download.com/files/softether/v4.04-9412-rtm-2014.01.15-tree/Windows/SoftEther%20VPN%20Client/softether-vpnclient-v4.04-9412-rtm-2014.01.15-windows-x86_x64-intel.exe http://jp.softether-download.com/files/softether/v4.04-9412-rtm-2014.01.15-tree/Windows/SoftEther%20VPN%20Server%20and%20VPN%20Bridge/softether-vpnserver_vpnbridge-v4.04-9412-rtm-2014.01.15-windows-x86_x64-intel.exe
管理パスワードとポートの指定をします
解放ポート 443ポート(TCP) 500ポート(UDP) 4500ポート(UDP)
端末側の例としてiPhoneでの設定
設定→一般→VPN→VPN構成を追加→L2TPのタブを選択 説明:識別する名前(例:自宅) サーバ:DDNS(○○.softether.net)やグローバルIPアドレス アカウント:サーバに登録したユーザ@ハブ名(例:test@vpn) RSA SecurID:オフ パスワード:ユーザに設定したパスワード シークレット:IPsec事前共有鍵 すべての信号を送信:オン
こんな感じでVPN完成、あとは自由に使おう、なお、有償版のPacketiX VPN や Desktop VPN のサーバやサーバブリッジは同様の手順でRasberry PIに設定できる