LoginSignup
2
1

More than 1 year has passed since last update.

[ConoHa VPS]SoftEther VPN ServerをCentOS Stream8にインストール

Last updated at Posted at 2022-06-21

1. はじめに

前回はオンプレミスのLinuxサーバーにSoftEther VPN Serverを構築しました。
[オンプレ]SoftEther VPN ServerをUbuntuにインストール - Qiita

今回はConoHa VPSに構築します。
前回との違いは以下の通りです。

  • CentOS Stream8を使用
  • VPS上にDHCPサーバーを用意していないため、仮想DHCPサーバー機能を有効にしている

2. SoftEther VPN Serverをインストール

必要パッケージをインストールする。

sudo su
dnf install -y gcc make

作業用ディレクトリに移動する。

mkdir tmp
cd tmp

最新版をダウンロード、解凍する。
https://www.softether-download.com/ja.aspx?product=softether

wget https://~.tar.gz
tar -xzvf softether~.tar.gz

ビルドする。

cd vpnserver
make

ディレクトリを移動、パーミッションを設定する。

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

サービスに登録する。

nano /etc/systemd/system/vpnserver.service

次の通り編集する。

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

[Service]
Type=forking
User=root
ExecStart=/usr/local/vpnserver/vpnserver start
ExecStop=/usr/local/vpnserver/vpnserver stop
Restart=on-failure
RestartSec=3s

[Install]
WantedBy=multi-user.target

Ctrl + X → Y → Enterで保存。

systemctl daemon-reload
systemctl enable vpnserver
systemctl start vpnserver

サービスを有効化。

3. ファイアウォールの許可設定

nano /etc/firewalld/services/vpnserver.xml
/etc/firewalld/services/vpnserver.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
    <short>VPN</short>
    <description>SoftEther VPN Server</description>
    <port protocol="tcp" port="443"/>
</service>

Ctrl + X → Y → Enterで保存。

firewall-cmd --add-service=vpnserver --zone=public --permanent
firewall-cmd --add-service=ipsec --zone=public --permanent
firewall-cmd --reload
reboot #最後に、サーバー再起動しておきます。

4. 管理ツールからサーバーに接続、設定

クライアントPCにSoftEther Server Manager for Windowsをインストールする。
https://www.softether-download.com/ja.aspx?product=softether

  • リモートアクセスVPNサーバーを有効
  • 仮想ハブを作成
  • L2TPサーバー機能を有効
  • 事前共有キーを設定
  • VPN Azureは無効
  • ユーザーを作成
  • 仮想ハブと物理NIC(本記事の場合「eth0」)をローカルブリッジする
  • 「SecureNATの設定」>「仮想NAT機能を使用する」のチェックを外す
  • 「SecureNATを有効にする」をクリックする

以上で構築完了です。

※ローカルブリッジと仮想NATを同時に有効化するとパケットのループが発生してサーバーがハングアップする可能性があるので要注意。
VPNFAQ005. VPN Server のプロセスの CPU 使用率が何もしていないのに異常に高くなる - SoftEther VPN プロジェクト

※VPN接続時、VPNサーバー自身にアクセスしたい場合は下記サイトに記載の設定が必要です。
VPNサーバー構築(SoftEther VPN Server) - CentOSで自宅サーバー構築

5. 参考文献

【Centos7】SoftEther Server 構築手順【L2TP/IPsec】 - Qiita

2
1
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
2
1