LoginSignup
64
75

More than 5 years have passed since last update.

Ubuntu上でSoftEther VPN Server構築

Last updated at Posted at 2017-04-26

概要・背景

Ubuntu上でSoftEtherの環境を構築している人は多くいるのだが、Systemdを使わずinitスクリプトを使っていたり、tapインターフェイスを変な方法でブリッジしている人が多かったので個人的に納得のいく方法で構築した流れをここに示すことにした。

構築

環境

OS:Ubuntu Server 16.04
RAM:2GB

インストール

bridge-utils,make,gccのインストール

bridge-utilsはインストール後、tapインターフェイスがブリッジできていることを確認するためにbrctlを用いる時に必要。

パッケージ情報更新
sudo apt update

インストール
sudo apt install -y bridge-utils gcc make

SoftEther VPN Serverのダウンロード

最新版のURLをここから探してくる
cd /tmp
wget path-to-latest-version-of-SoftEther-Server
tar -xvf softether-vpnserver-(version).tar.gz
cd vpnserver/

SoftEther VPN Serverのインストール

make
使用権許諾契約書に同意する場合、1を入力

cd ../
sudo mv vpnserver/ /usr/local/
できたディレクトリを/usr/localに移動

cd /usr/local/vpnserver/
sudo chmod 600 *
sudo chmod 700 vpncmd vpnserver
パーミッション設定

Systemd用serviceファイルを作成

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

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

作成したサービスを読み込む
sudo systemctl daemon-reload

Softether VPN Serverを有効化、起動
sudo systemctl enable vpnserver.service
sudo systemctl start vpnserver.service

SoftEther VPN Serverの設定

SoftEther VPN Server Managerを使用して設定

  1. 管理者パスワード設定
  2. リモートアクセス VPN サーバーを選択
  3. 適当に仮想HUB名を決める
  4. 適当にDDNS名を決める
  5. L2TP/IPSecを使うならチェックして次に進む
  6. VPN Azureはどちらかを選択
  7. ユーザーを作成
  8. ローカルブリッジの設定はここでは行わずに次に進む(ブリッジ接続する~のまま置いておく)

tapインターフェイスを作成し、ブリッジする

  1. ローカルブリッジを選択
  2. 仮想HUBに先ほど決めた名前のものを選択する
  3. 「新しいtapデバイスとのブリッジ接続」を選択
  4. 新しいtapデバイス名に任意の名前を入力(例:softether)
  5. 「ローカルブリッジを追加」を選択

ブリッジインターフェイスを作成し、先ほど作成したtapインターフェイスとブリッジする

ここからは再びサーバー上で設定する

sudo vim /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto eth0
#iface eth0 inet dhcp


auto br0
iface br0 inet static
 #サーバーのIPアドレスを決め、入力
 address 192.168.x.y
 netmask 255.255.255.0
 gateway 192.168.x.a
 bridge_ports eth0 tap_(先ほど決めたインターフェース名)
 #例 bridge_ports eth0 tap_softether
 dns-nameservers 192.168.x.a

再起動
sudo reboot

再起動後、ブリッジできているかどうか確かめる
brctl show

bridge name     bridge id               STP enabled     interfaces
br0             8000.00155d01a504       no              eth0
                                                        tap_softether

上のようになっていれば正常

64
75
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
64
75