Raspberry PiにVPNサーバを構築する (1)インストール編
環境情報
PC : Raspberry Pi Model B
OS : Raspbian
VPNとは?
こちらのサイトを参考に
http://www.atmarkit.co.jp/fsecurity/special/22fivemin/fivemin00.html
インストールするVPNソフトウェア
SoftEther VPN(https://ja.softether.org/)
インストール手順
手順は公式マニュアルを参考に
https://ja.softether.org/4-docs/1-manual/7/7.3
1. パッケージのダウンロード
https://ja.softether.org/5-download
# wget http://jp.softether-download.com/files/softether/v4.06-9437-beta-2014.04.09-tree/Linux/SoftEther%20VPN%20Server/32bit%20-%20ARM%20EABI/softether-vpnserver-v4.06-9437-beta-2014.04.09-linux-arm_eabi-32bit.tar.gz
2. パッケージの解凍
# tar xzvf softether-vpnserver-v4.06-9437-beta-2014.04.09-linux-arm_eabi-32bit.tar.gz
3. 実行可能ファイルの生成
vpnserverフォルダに移動し、makeコマンドを実行する
# cd vpnserver/ # make
4. VPNサーバの配置
vpnserver ディレクトリを、/usr/local ディレクトリに移動する
# mv vpnserver /usr/local
5. 権限の設定
# cd /usr/local/vpnserver # chmod 600 * # chmod 700 vpncmd vpnserver # ll -tr total 7500 -rw------- 1 root root 58227 Apr 9 10:22 ReadMeFirst_License.txt -rw------- 1 root root 47041 Apr 9 10:22 ReadMeFirst_Important_Notices_ja.txt -rw------- 1 root root 33209 Apr 9 10:22 ReadMeFirst_Important_Notices_en.txt -rw------- 1 root root 28351 Apr 9 10:22 ReadMeFirst_Important_Notices_cn.txt -rw------- 1 root root 2097 Apr 9 10:22 Makefile -rw------- 1 root root 1009450 Apr 9 10:22 hamcore.se2 -rw------- 1 root root 1838 Apr 9 10:22 Authors.txt drw------- 2 root root 4096 May 3 23:49 lib -rwx------ 1 root root 3216345 May 3 23:50 vpnserver drw------- 2 root root 4096 May 3 23:50 code -rwx------ 1 root root 3216349 May 3 23:50 vpncmd -rw------- 1 root root 867 May 3 23:50 lang.config drw------- 2 root root 4096 May 3 23:50 chain_certs
6. check コマンドによる動作確認
下記のように全てのチェックに合格すればOK
# ./vpncmd vpncmd command - SoftEther VPN Command Line Management Utility SoftEther VPN Command Line Management Utility (vpncmd command) Version 4.06 Build 9437 (English) Compiled 2014/04/09 10:10:41 by yagi at pc25 Copyright (c) SoftEther VPN Project. All Rights Reserved. By using vpncmd program, the following can be achieved. 1. Management of VPN Server or VPN Bridge 2. Management of VPN Client 3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool) Select 1, 2 or 3: 3 VPN Tools has been launched. By inputting HELP, you can view a list of the commands that can be used. VPN Tools>check Check command - Check whether SoftEther VPN Operation is Possible --------------------------------------------------- SoftEther VPN Operation Environment Check Tool Copyright (c) SoftEther VPN Project. All Rights Reserved. If this operation environment check tool is run on a system and that system passes, it is most likely that SoftEther VPN software can operate on that system. This check may take a while. Please wait... Checking 'Kernel System'... Pass Checking 'Memory Operation System'... Pass Checking 'ANSI / Unicode string processing system'... Pass Checking 'File system'... Pass Checking 'Thread processing system'... Pass Checking 'Network system'... Pass All checks passed. It is most likely that SoftEther VPN Server / Bridge can operate normally on this system. The command completed successfully.
7. init.dスクリプトの作成
# vi /etc/init.d/vpnserver
以下の内容を記載する
#!/bin/sh # chkconfig: 2345 99 01 # description: SoftEther VPN Server DAEMON=/usr/local/vpnserver/vpnserver LOCK=/var/lock/subsys/vpnserver test -x $DAEMON || exit 0 case "$1" in start) $DAEMON start touch $LOCK ;; stop) $DAEMON stop rm $LOCK ;; restart) $DAEMON stop sleep 5 $DAEMON start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0
権限を付与する
# chmod 775 /etc/init.d/vpnserver
8. chkconfigによるサービスの自動起動設定
# chkconfig -add vpnserver insserv: warning: script 'vpnserver' missing LSB tags and overrides insserv: warning: script 'mathkernel' missing LSB tags and overrides vpnserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
9. 起動と停止
# service vpnserver start SoftEther VPN Server Service Started. # service vpnserver stop Stopping SoftEther VPN Server Service... SoftEther VPN Server Service Stopped.