LoginSignup
0
0

More than 1 year has passed since last update.

SoftEther VPNをパフォーマンスが出るようにビルドしてセットアップした

Last updated at Posted at 2023-02-01

SoftEther vpnのビルド

https://jp.softether-download.com/ja.aspx のSoftEther VPN Server/Bridgeアプリケーションは、Linuxサーバにおいては、CPUリソースをフルに使ってくれないので、ソースコードからビルドし、これを解決するため、いちからビルドしてインストールするようにしたい。

必須パッケージのインストール

RHEL系

RHEL系OSの場合
$ sudo dnf install wget make gcc readline-devel ncurses-devel openssl-devel zlib-devel

Debian系

Debian系OSの場合
$ sudo apt install build-essential libz-dev

ビルド

最新版を拾ってくる

https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/ から、最新バージョンのソースコードをDLしてくる。

v4.39-9772-betaだと、https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.39-9772-beta/softether-src-v4.39-9772-beta.tar.gz となる。

$ wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.39-9772-beta/softether-src-v4.39-9772-beta.tar.gz

展開

$ tar xzvf softether-src-v4.39-9772-beta.tar.gz
$ cd v4.39-9772
$ ./configure
---------------------------------------------------------------------
SoftEther VPN for Unix

Copyright (c) Daiyuu Nobori.
Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
Copyright (c) SoftEther Corporation.
Copyright (c) all contributors on SoftEther VPN project in GitHub.

License: The Apache License, Version 2.0

Read and understand README.TXT, LICENSE.TXT and WARNING.TXT before use.
---------------------------------------------------------------------

Welcome to the corner-cutting configure script !

The Makefile is generated. Run 'make' to build SoftEther VPN.
$ make -j$(nproc)

インストール

以下はVPN bridgeをインストールする場合。VPN Serverなどの場合は、適宜置き換える。

vpnbridge.service
$ sudo cp -r bin/vpnbridge /usr/local/bin/
$ sudo cp -r bin/vpncmd/* /usr/local/bin/
$ sudo chown `whoami`: /usr/local/bin/hamcore.se2
$ sudo cat << 'EOT' | sudo tee /etc/systemd/system/softether-vpnbridge.service
[Unit]
Description=SoftEther VPN Bridge
After=network.target auditd.service
ConditionPathExists=!/usr/local/bin/do_not_run

[Service]
Type=forking
EnvironmentFile=-/usr/local/bin/vpnbridge/vpnbridge
ExecStart=/usr/local/bin/vpnbridge/vpnbridge start
ExecStop=/usr/local/bin/vpnbridge/vpnbridge stop
KillMode=process
Restart=on-failure

# Hardening
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-/usr/local
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID

[Install]
WantedBy=multi-user.target

EOT

$ sudo systemctl daemon-reload
$ sudo systemctl enable --now softether-vpnbridge

設定を構成する

あとは適宜設定をする。

最後に

正直めんどくさいのでこんなことするならtailscaleとか使ったりしてよしなにしたほうが良い。どうしてもVPN使うならpritunlとかでもいいし。

0
0
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
0
0