[CentOS] SoftEther VPN サーバーをインストールし、動作チェックを行い、起動スクリプトを作成し、自動起動させる設定を行う。

SoftEther VPN Server のインストール

CentOS への SoftEther VPN Server のインストールは公式サイトのドキュメントを見ながら行うとスムーズです。以下のような流れでインストールを行います。ls でインストールイメージを確認し、tar で解凍・展開します。

[root@localhost ~]# ls -l softether-vpnserver-v4.12-9514-beta-2014.11.17-linux-x86-32bit.tar.gz
-rw-r–r–. 1 root root 5205599 11月 17 22:32 2014 softether-vpnserver-v4.12-9514-beta-2014.11.17-linux-x86-32bit.tar.gz
[root@localhost ~]# tar xzvf softether-vpnserver-v4.12-9514-beta-2014.11.17-linux-x86-32bit.tar.gz
vpnserver/
vpnserver/Makefile
vpnserver/.install.sh
vpnserver/ReadMeFirst_License.txt
vpnserver/Authors.txt
vpnserver/ReadMeFirst_Important_Notices_ja.txt
vpnserver/ReadMeFirst_Important_Notices_en.txt
vpnserver/ReadMeFirst_Important_Notices_cn.txt
vpnserver/code/
vpnserver/code/vpnserver.a
vpnserver/code/vpncmd.a
vpnserver/lib/
vpnserver/lib/libcharset.a
vpnserver/lib/libcrypto.a
vpnserver/lib/libedit.a
vpnserver/lib/libiconv.a
vpnserver/lib/libintelaes.a
vpnserver/lib/libncurses.a
vpnserver/lib/libssl.a
vpnserver/lib/libz.a
vpnserver/lib/License.txt
vpnserver/hamcore.se2
[root@localhost ~]#

tar で展開することで vpnserver というディレクトリができますのでそこに cd で移動し、make を実行します。make を実行するとライセンスへの同意などを聞かれますので、それに答えていくとインストールが進んでいきます。

[root@localhost ~]# cd vpnserver/
[root@localhost vpnserver]# make
——————————————————————–SoftEther VPN Server (Ver 4.12, Build 9514, Intel x86) for Linux Install Utility
Copyright (c) SoftEther Project at University of Tsukuba, Japan. All Rights Reserved.——————————————————————–Do you want to read the License Agreement for this software ?1. Yes
2. NoPlease choose one of above number:
1
(途中省略)
Please execute ‘./vpnserver start’ to run the SoftEther VPN Server Background Service.
And please execute ‘./vpncmd’ to run the SoftEther VPN Command-Line Utility to configure SoftEther VPN Server.
Of course, you can use the VPN Server Manager GUI Application for Windows on the other Windows PC in order to configure the SoftEther VPN Server remotely.
——————————————————————–make[1]: ディレクトリ `/root/vpnserver’ から出ます
[root@localhost vpnserver]#

プロンプトが帰って来たらインストール完了です。つづいて vpnserver ディレクトリを /usr/local に mv させます。

[root@localhost vpnserver]# cd ..
[root@localhost ~]# mv vpnserver /usr/local
[root@localhost ~]# ls -ltr /usr/local/vpnserver/
合計 7808
-rwxrwxrwx. 1 root root 1288770 11月 17 22:32 2014 hamcore.se2
-rwxrwxrwx. 1 root root 58227 11月 17 22:32 2014 ReadMeFirst_License.txt
-rwxrwxrwx. 1 root root 47041 11月 17 22:32 2014 ReadMeFirst_Important_Notices_ja.txt
-rwxrwxrwx. 1 root root 33209 11月 17 22:32 2014 ReadMeFirst_Important_Notices_en.txt
-rwxrwxrwx. 1 root root 28351 11月 17 22:32 2014 ReadMeFirst_Important_Notices_cn.txt
-rwxrwxrwx. 1 root root 2130 11月 17 22:32 2014 Makefile
-rwxrwxrwx. 1 root root 1881 11月 17 22:32 2014 Authors.txt
drwxrwxrwx. 2 root root 4096 1月 1 21:50 2015 lib
-rwxr-xr-x. 1 root root 3249145 1月 1 21:50 2015 vpnserver
drwxrwxrwx. 2 root root 4096 1月 1 21:50 2015 code
-rwxr-xr-x. 1 root root 3249085 1月 1 21:50 2015 vpncmd
-rw——-. 1 root root 867 1月 1 21:50 2015 lang.config
drwx——. 2 root root 4096 1月 1 21:50 2015 chain_certs
[root@localhost ~]#

mv させたら /usr/local/vpnserver に cd し、各ファイルの実行権限の変更を行います。root 権限でしか閲覧・書き込み・実行できない設定に変えていきます。

[root@localhost ~]# cd /usr/local/vpnserver
[root@localhost vpnserver]# chmod 600 *
[root@localhost vpnserver]# chmod 700 vpnserver
[root@localhost vpnserver]# chmod 700 vpncmd
[root@localhost vpnserver]# ls -trl
合計 7808
-rw——-. 1 root root 1288770 11月 17 22:32 2014 hamcore.se2
-rw——-. 1 root root 58227 11月 17 22:32 2014 ReadMeFirst_License.txt
-rw——-. 1 root root 47041 11月 17 22:32 2014 ReadMeFirst_Important_Notices_ja.txt
-rw——-. 1 root root 33209 11月 17 22:32 2014 ReadMeFirst_Important_Notices_en.txt
-rw——-. 1 root root 28351 11月 17 22:32 2014 ReadMeFirst_Important_Notices_cn.txt
-rw——-. 1 root root 2130 11月 17 22:32 2014 Makefile
-rw——-. 1 root root 1881 11月 17 22:32 2014 Authors.txt
drw——-. 2 root root 4096 1月 1 21:50 2015 lib
-rwx——. 1 root root 3249145 1月 1 21:50 2015 vpnserver
drw——-. 2 root root 4096 1月 1 21:50 2015 code
-rwx——. 1 root root 3249085 1月 1 21:50 2015 vpncmd
-rw——-. 1 root root 867 1月 1 21:50 2015 lang.config
drw——-. 2 root root 4096 1月 1 21:50 2015 chain_certs
[root@localhost vpnserver]#

SoftEther VPN Server の動作チェック

SoftEther VPN には動作チェックを行うユーティリティが含まれています。これを使ってインストール完了後、正常に動作するのかどうかをテストすることができるわけです。かゆいところに手が届いているなーと感心します。

vpncmd を実行して動作チェックを行います。

[root@localhost vpnserver]# ./vpncmd
vpncmd コマンド – SoftEther VPN コマンドライン管理ユーティリティ
SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド)
Version 4.12 Build 9514 (Japanese)
Compiled 2014/11/17 22:16:06 by yagi at pc25
Copyright (c) SoftEther VPN Project. All Rights Reserved.vpncmd プログラムを使って以下のことができます。1. VPN Server または VPN Bridge の管理
2. VPN Client の管理
3. VPN Tools コマンドの使用 (証明書作成や通信速度測定)1 – 3 を選択: 3
VPN Tools を起動しました。HELP と入力すると、使用できるコマンド一覧が表示できます。

VPN Tools>check
Check コマンド – SoftEther VPN の動作が可能かどうかチェックする
—————————————————
SoftEther VPN 動作環境チェックツールCopyright (c) SoftEther VPN Project.
All Rights Reserved.この動作環境チェックツールを実行したシステムがテストに合格した場合は、SoftEther VPN ソフトウェアが動作する可能性が高いです。チェックにはしばらく時間がかかる場合があります。そのままお待ちください…’カーネル系’ のチェック中…
[合格] ○
‘メモリ操作系’ のチェック中…
[合格] ○
‘ANSI / Unicode 文字列処理系’ のチェック中…
[合格] ○
‘ファイルシステム’ のチェック中…
[合格] ○
‘スレッド処理システム’ のチェック中…
[合格] ○
‘ネットワークシステム’ のチェック中…
[合格] ○すべてのチェックに合格しました。このシステム上で SoftEther VPN Server / Bridge が正しく動作する可能性が高いと思われます。コマンドは正常に終了しました。
VPN Tools>exit
[root@localhost vpnserver]#

上記のように SoftEther VPN Server / Bridge が正しく動作する可能性が高いと思われます。が表示されれば OK です。

起動スクリプトの作成

動作チェックが無事完了したら、あとは SoftEther VPN Server が自動起動するように設定を行っていきます。まず、/etc/init.d ディレクトリに移動し、SoftEther VPN Server を起動させるスクリプトを vi エディターで作成します。このファイル名も vpnserver としました。公式サイトのドキュメントに記載されていたスクリプトをそのまま拝借しています。cat で表示させてみます。

[root@localhost init.d]# cat 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 3
$DAEMON start
;;
*)
echo “Usage: $0 {start|stop|restart}”
exit 1
esac
exit 0
[root@localhost init.d]# chmod 755 vpnserver
[root@localhost init.d]# ls -tlr vpnserver
-rwxr-xr-x. 1 root root 353 1月 1 21:55 2015 vpnserver
[root@localhost init.d]#

vi vpnserver で起動スクリプトを作成後、chmod で実行権限を付与しています。

SoftEther VPN Server を自動起動させる設定

chkconfig –add でシステム起動時のスクリプトとして追加してやります。

[root@localhost init.d]# chkconfig –add vpnserver
[root@localhost init.d]# chkconfig –list
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iscsi 0:off 1:off 2:off 3:on 4:on 5:on 6:off
iscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
multipathd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off
vpnserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost init.d]#

一番下の行に vpnserver が表示されています。これで自動起動させる設定は完了です。

起動スクリプトの動作確認

最後に vi で作成した起動スクリプトの動作確認も行っておきましょう。起動スクリプトを使った SoftEther VPN Server の起動・終了が正常にできるかの確認です。

[root@localhost init.d]# ./vpnserver start
The SoftEther VPN Server service has been started.
[root@localhost init.d]# ./vpnserver stop
Stopping the SoftEther VPN Server service …
SoftEther VPN Server service has been stopped.
[root@localhost init.d]#

問題ないようですね。これで作成したスクリプトが正常であることが確認できました。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください