ubuntu18.04にSoftEther VPN Clientをインストール
基本的に7.3 Linux へのインストールと初期設定の、VPN ServerをVPN Clientに読み替えて、書いてあるとおりにやればいいのだが、「7.3.8 スタートアップスクリプトへの登録」からは古いinit.dでの設定説明になっているのでsystemd用のセットアップを備忘録。
SoftEather Clientを以下のサイトからダウンロード
筑波大学大学院研究プロジェクト
ダウンロードセンター
[選択]
コンポーネント:SoftEther VPN Client
プラットフォーム:Linux
CPU: Intel x64 / AMD64(64bit)tarコマンドで解凍
$ tar xvf softether-vpnclient-v4.28-9669-beta-2018.09.11-linux-x64-64bit.tar.gz
- 解凍するとvpnclientというフォルダができる。その中へ移動してmake
$ cd vpnclient
$ make
--------------------------------------------------------------------
SoftEther VPN Client (Ver 4.22, Build 9634, Intel x64 / AMD64) 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. No
Please choose one of above number:
- ライセンスの同意を求められるのですべて'1'と入力してエンター、エンターと続けていく(3回求められる)
Did you read and understand the License Agreement ?
(If you couldn't read above text, Please read 'ReadMeFirst_License.txt'
file with any text editor.)
1. Yes
2. No
Please choose one of above number:
1
Did you agree the License Agreement ?
1. Agree
2. Do Not Agree
Please choose one of above number:
1
make[1]: Entering directory `/home/ec2-user/Installer/vpnclient'
Preparing SoftEther VPN Client...
ranlib lib/libcharset.a
ranlib lib/libcrypto.a
ranlib lib/libedit.a
ranlib lib/libiconv.a
ranlib lib/libintelaes.a
ranlib lib/libncurses.a
ranlib lib/libssl.a
ranlib lib/libz.a
ranlib code/vpnclient.a
gcc code/vpnclient.a -O2 -fsigned-char -pthread -m64 -lm -ldl -lrt -lpthread -L./ lib/libssl.a lib/libcrypto.a lib/libiconv.a lib/libcharset.a lib/libedit.a lib/libncurses.a lib/libz.a lib/libintelaes.a -o vpnclient
ranlib code/vpncmd.a
gcc code/vpncmd.a -O2 -fsigned-char -pthread -m64 -lm -ldl -lrt -lpthread -L./ lib/libssl.a lib/libcrypto.a lib/libiconv.a lib/libcharset.a lib/libedit.a lib/libncurses.a lib/libz.a lib/libintelaes.a -o vpncmd
--------------------------------------------------------------------
The preparation of SoftEther VPN Client is completed !
*** How to switch the display language of the SoftEther VPN Client Service ***
SoftEther VPN Client supports the following languages:
- Japanese
- English
- Simplified Chinese
You can choose your prefered language of SoftEther VPN Client at any time.
To switch the current language, open and edit the 'lang.config' file.
*** How to start the SoftEther VPN Client Service ***
Please execute './vpnclient start' to run the SoftEther VPN Client Background Service.
And please execute './vpncmd' to run the SoftEther VPN Command-Line Utility to configure SoftEther VPN Client.
Of course, you can use the VPN Server Manager GUI Application for Windows / Mac OS X on the other Windows / Mac OS X computers in order to configure the SoftEther VPN Client remotely.
*** For Windows users ***
You can download the SoftEther VPN Server Manager for Windows
from the http://www.softether-download.com/ web site.
This manager application helps you to completely and easily manage the VPN server services running in remote hosts.
*** For Mac OS X users ***
In April 2016 we released the SoftEther VPN Server Manager for Mac OS X.
You can download it from the http://www.softether-download.com/ web site.
VPN Server Manager for Mac OS X works perfectly as same as the traditional Windows versions. It helps you to completely and easily manage the VPN server services running in remote hosts.
--------------------------------------------------------------------
make[1]: Leaving directory `/home/ec2-user/Installer/vpnclient'
- makeでビルドされたvpnclientフォルダを/usr/localに移す。
$ cd ../
$ sudo mv vpnclient /usr/local/
$ ls -l /usr/local/vpnclient/
total 10476
-rwxrwxr-x 1 ec2-user ec2-user 2784 Nov 27 07:03 Authors.txt
drwxrwxr-x 2 ec2-user ec2-user 4096 Mar 16 05:13 code
-rwxrwxr-x 1 ec2-user ec2-user 1296225 Nov 27 07:03 hamcore.se2
drwxrwxr-x 2 ec2-user ec2-user 4096 Mar 16 05:13 lib
-rwxrwxr-x 1 ec2-user ec2-user 2873 Nov 27 07:03 Makefile
-rwxrwxr-x 1 ec2-user ec2-user 30801 Nov 27 07:03 ReadMeFirst_Important_Notices_cn.txt
-rwxrwxr-x 1 ec2-user ec2-user 36296 Nov 27 07:03 ReadMeFirst_Important_Notices_en.txt
-rwxrwxr-x 1 ec2-user ec2-user 50695 Nov 27 07:03 ReadMeFirst_Important_Notices_ja.txt
-rwxrwxr-x 1 ec2-user ec2-user 58932 Nov 27 07:03 ReadMeFirst_License.txt
-rwxrwxr-x 1 ec2-user ec2-user 4608379 Mar 16 05:13 vpnclient
-rwxrwxr-x 1 ec2-user ec2-user 4612305 Mar 16 05:13 vpncmd
- パーミッションを変更
$ cd /usr/local
$ sudo chown -R root:root vpnclient
$ cd vpnclient
$ sudo chmod 600 *
$ sudo chmod 700 vpncmd
$ sudo chmod 700 vpnclient
$ ls -l
total 10476
-rw------- 1 root root 2784 Nov 27 07:03 Authors.txt
drw------- 2 root root 4096 Mar 16 05:13 code
-rw------- 1 root root 1296225 Nov 27 07:03 hamcore.se2
drw------- 2 root root 4096 Mar 16 05:13 lib
-rw------- 1 root root 2873 Nov 27 07:03 Makefile
-rw------- 1 root root 30801 Nov 27 07:03 ReadMeFirst_Important_Notices_cn.txt
-rw------- 1 root root 36296 Nov 27 07:03 ReadMeFirst_Important_Notices_en.txt
-rw------- 1 root root 50695 Nov 27 07:03 ReadMeFirst_Important_Notices_ja.txt
-rw------- 1 root root 58932 Nov 27 07:03 ReadMeFirst_License.txt
-rwx------ 1 root root 4608379 Mar 16 05:13 vpnclient
-rwx------ 1 root root 4612305 Mar 16 05:13 vpncmd
- vpncmd の check コマンドによる動作チェック
$ sudo ./vpncmd
vpncmd コマンド - SoftEther VPN コマンドライン管理ユーティリティ
SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド)
Version 4.28 Build 9669 (Japanese)
Compiled 2018/09/11 12:23:27 by yagi at pc33
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
systemdサービスへの登録
- vpnclient.serviceファイルを作成する
$ sudo vim /etc/systemd/system/vpnclient.service
/etc/systemd/system/vpnclient.serviceを以下のように記述。
[Unit]
Description=SoftEther VPN Client
After=network.target network-online.target
[Service]
ExecStart=/usr/local/vpnclient/vpnclient start
ExecStop=/usr/local/vpnclient/vpnclient stop
Type=forking
RestartSec=3s
[Install]
WantedBy=multi-user.target
- systemctlコマンドでサービスの開始と有効化
$ sudo systemctl start vpnclient
$ sudo systemctl enable vpnclient
- 確認
$ sudo systemctl status vpnclient
● vpnclient.service - SoftEther VPN Client
Loaded: loaded (/etc/systemd/system/vpnclient.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-01-30 15:29:31 JST; 1s ago
Process: 30654 ExecStop=/usr/local/vpnclient/vpnclient stop (code=exited, status=0/SUCCESS)
Process: 30666 ExecStart=/usr/local/vpnclient/vpnclient start (code=exited, status=0/SUCCESS)
Main PID: 30668 (vpnclient)
Tasks: 8 (limit: 4915)
CGroup: /system.slice/vpnclient.service
├─30668 /usr/local/vpnclient/vpnclient execsvc
└─30669 /usr/local/vpnclient/vpnclient execsvc
- 再起動後、確認
$ systemctl list-unit-files --type=service | grep vpn
vpnclient.service enabled