UbuntuにSoftEther VPNをインストールする

サーバー
新しい接続を作成

Ubuntu 20.04.3をインストールしましたが、ここにVPNシステムのSoftEtherをインストールしようと思います。個人の作ったリポジトリからインストールすれば簡単なようですが、ちょっと怖いので自分で入れてみようと思います。

VPNサーバー

VPNを作るサーバープログラムはSoftEther以外にも多くありますが、日本国内で開発されているっぽいことに加えて、利用料無料で利用できそうなことが選んだ理由です。

日本語ドキュメントが豊富で日本語のブログ等がたくさん見つかるのは使いやすそうですが、海外からの情報が少ないのが微妙なところで英語の比較サイトではレビューがなかったりします。

Just a moment...

OpenVPNが一番人気っぽく、ProtonVPN、NordVPN等も使われていそうな感じです。

SoftEtherの商用版

SoftEther自体、商用利用可能なようです。

SoftEther VPN は フリーウェア です。本ソフトウェアの使用、複製、改変、結合、転載、配布、サブライセンス、および有償での販売に制限はありません。

ダウンロード - SoftEther VPN プロジェクト

ただ、PacketiXという商用版が販売されています。

購入方法 - ソフトイーサ Web サイト

SoftEtherのUbuntu用PPA

Ubuntuは公式サポート外ですが、SoftEtherのUbuntu用リポジトリが公開されています。ただ、個人の作成したリポジトリ(PPA)で、使用されている元のビルドもよくわかりません。

SoftEtherVPN Daily Builds : Dmitry Verkhoturov
SoftEtherVPN Daily Builds. NO LONGER SUPPORTED AND UPDATED. Ubuntu 21.04 ( imports package from Debian ( so please use these package instead. If you still w...

このPPAを利用したインストール例もあってとても簡単そうですが、今回は公式からダウンロードして使用しようと思います。

Ubuntu 20.04でSoftEther VPN Serverを建てる

SoftEtherのインストール

幸いにしてUbuntuへのSoftEtherインストールを例示してくれている先人がいるので、例に従ってやってみます。

[Ubuntu Server]SoftEther VPNの構築方法
外出時に自宅に置いているサーバにアクセスしたいことがあるため、「SoftEther VPN」を使って、VPNサーバを構築しました。この記事では、 UbuntuServerにSoftEtherVPNサーバを構築方法 Windows/Lin

KVMでUbuntuの仮想サーバーをたて、UbuntuのGUIからブリッジ接続を設定して起動すると、ホストのUbuntuサーバーと物理ネットワークカードは共用しつつ別サーバーっぽく外から接続できるようになります。

ダウンロードとmake

ssh サーバーユーザー名@サーバーホスト名(少なくとも初回は ssh サーバーホスト名 -l サーバーユーザー名)
cd /tmp
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.38-9760-rtm/softether-vpnserver-v4.38-9760-rtm-2021.08.17-linux-x64-64bit.tar.gz
tar -xvf softether-vpnserver-v4.38-9760-rtm-2021.08.17-linux-x64-64bit.tar.gz
cd vpnserver
sudo apt-get install -y make gcc
make

でインストールは完了です。インストールするファイルのURLは、ウェブサイトからコピペで持ってきますので、SSH接続したWindowsマシンから行いました。SSH接続中、普段GUIで使っているCTRL+Vのコピペが使えず、Windowsマシンの何かをコピーしたら右クリックでペーストです。

The command completed successfully.


*** How to switch the display language of the SoftEther VPN Server Service ***
SoftEther VPN Server supports the following languages:
– Japanese
– English
– Simplified Chinese

You can choose your prefered language of SoftEther VPN Server at any time.
To switch the current language, open and edit the ‘lang.config’ file.

Note: the administrative password is not set on the VPN Server. Please set your own administrative password as soon as possible by vpncmd or the GUI manager.

*** How to start the SoftEther VPN Server Service ***

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 / Mac OS X on the other Windows / Mac OS X computers in order to configure the SoftEther VPN Server 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.

*** PacketiX VPN Server HTML5 Web Administration Console (NEW) ***
This VPN Server / Bridge has the built-in HTML5 Web Administration Console.

After you start the server daemon, you can open the HTML5 Web Administration Console is available at

https://127.0.0.1:5555/
or
https://ip_address_of_the_vpn_server:5555/

This HTML5 page is obviously under construction, and your HTML5 development contribution is very appreciated.


 

インストールと権限設定

cd ..
sudo mv vpnserver/ /usr/local/
cd /usr/local/vpnserver
sudo chmod 600 *
sudo chmod 700 vpncmd vpnserver

次も前述サイトのものをそのまま使います。

サービス登録

次のステップが参考にした2サイトで異なっています。「TOSHIO-WEB」様のブログではinit.dを介してサービス登録しており、「komeの備忘録」様ではsystemd/system/vpnserver.serviceを作ってサービス起動しています。

どちらでも動くとは思いますが、どちらが良いかというと、多分現在ではsystemd/system/vpnserver.serviceを使ったほうが良さそうです。

Difference between systemctl init.d and service
I am new to linux and have been testing myself using an Amazon Lightsail instance (Ubuntu 16.04 LTS). Going through the many guides I have came across, I see p...

ということで、

に従って、/etc/systemd/system/vpnserver.serviceを作成します。

sudo nano /etc/systemd/system/vpnserver.service

vi、vimは使い慣れないので、よりユーザーフレンドリーな「nano」を使います。

# /etc/systemd/system/vpnserver.service
[Unit]
Description=SoftEther VPN Server
After=network.target network-online.target

[Service]
ExecStart=/usr/local/vpnserver/vpnserver start
ExecStop=/usr/local/vpnserver/vpnserver stop
Type=forking
RestartSec=3s

[Install]
WantedBy=multi-user.target

保存時にはファイル名の確認が出るので「ENTER」を押せば保存できます。

sudo systemctl daemon-reload
sudo systemctl enable vpnserver.service
sudo systemctl start vpnserver.service

VPNサーバー設定(SoftEther VPN Server Manager)

サーバー本体側で設定する方法もあるはずですが、Windows/MacOSで利用できる「SoftEther VPN Server Manager」が良く紹介されていますし便利っぽいので利用します。

サーバーへの接続

新しい接続を作成

まず、作成したVPNサーバーへの接続を行います。「ホスト名」に現在のVPNサーバーのIPアドレス(今回の場合はプライベートIP、192.168.68.60)を入力します。

管理モードはとりあえず触るところはありません。仮想HUB管理モードは、次のステップ以降で作成することになる仮想HUBにのみ接続する場合に設定するようなので初回設定時には選択しません。管理モードのパスワードも同様で初回接続時に設定することになり、設定すると次回以降ここに保存されることになります。忘れてもVPN接続は利用できますが、VPN接続設定が利用不能になります。サーバーのどこかに保存されているはずですが・・・。

簡易セットアップ

管理パスワードを設定して接続すると、簡易セットアップ画面が表示されます。一度簡易セットアップを終了するともう出てこない感じです。(どこかにあるのかも?)

ユーザー設定

次にサーバー側のユーザー作成を行います。

サーバーへの接続を行うためには、ここで設定したユーザーを指定します。

ここで、ローカルユーザーを作成する以外にも、証明書を利用したものが表示されていますが、これらは現バージョンのSoftEtherでは使用できないようです。

調べてみると、ビルド時のオプション設定の問題だけのようです。

softetherのちょっとしたセキュリティ向上設定 - Qiita
はじめに Softether VPNは手軽でL2VPNを構築できるオープンソースのソフトウェアである。 手軽とは言え、デフォルトのままではセキュリティレベルが低いままになっている箇所が存在するので、気づいたところをつぶしていこう...
diff -up src/Cedar/Server.c.orig src/Cedar/Server.c
bool SiIsEnterpriseFunctionsRestrictedOnif (StrCmpi(region, “JP”) == 0 || StrCmpi(region, “CN”) == 0)
{
オリジナル- ret = true;
改変版+ // ret = true;
}
return ret;

日本と中国でだけ無効化・・・。

DDNS搭載

DDNSが無料で簡単に利用できるのがSoftEtherのすごいところです。

softether.netドメインのDDNSが簡単に使える

Ubuntu上の仮想サーバーとして利用する上の問題点

接続設定をした際に、警告ダイアログが出てきます。

この「プロミスキャスモード」はLANカードに割り当てられたIPへの通信以外を受信するモードのようで、LANカードを別のIPとしても利用するので必要になるようです。この設定がないと、VPN接続できたはいいけれど正常な通信ができなくなっていました。

一部のディストリビューションでは再起動後も有効な設定が簡便にできるようなのですが、Ubuntuでは以前から要望はあるものの実装予定がないまま来ているようです。

 

コメント

タイトルとURLをコピーしました