SoftEther VPN是SoftEthernet项目正在进行开发和发布。SoftEther VPN版权为Apache License 2.0,是一款可免费使用、支持多个平台以及多个VPN协议的VPN软件。

介绍在Amazon Linux2上安装SoftEther VPN的方法。

在AWS上启动EC2之后,首先把Check soure/destination设定为Stop状态。

下载SoftEtherVPN服务器

访问SoftEther官网,获取SoftEther VPN的下载地址。

https://www.softether.org/

点击 Download SoftEther VPN

选择信息后获取 最新版的tar.gz文件的下载地址。

2021/09/08的最新版本下载地址如下。

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

安装SoftEtherVPN服务器

安装SoftEther VPN的方法可参照SoftEther官网。

首先安装SoftEther VPN服务运行所需的Libraries。

# yum install gcc binutils libc zlib readline ncurses

下载SoftEther VPN软件至服务器。

# 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.gz文件解压至 /usr/lobal 目录下。

# tar zxvf softether-vpnserver-v4.38-9760-rtm-2021.08.17-linux-x64-64bit.tar.gz -C /usr/local

确认tar.gz文件已解压至/usr/local/vpnserver 目录。

# ll /usr/local/vpnserver
total 2100
-rwxrwxrwx 1 root root      82 Aug 17  2021 Authors.txt
drwxrwxrwx 2 root root      41 Aug 17  2021 code
-rwxrwxrwx 1 root root 2009248 Aug 17  2021 hamcore.se2
drwxrwxrwx 2 root root     170 Aug 17  2021 lib
-rwxrwxrwx 1 root root    3577 Aug 17  2021 Makefile
-rwxrwxrwx 1 root root   32256 Aug 17  2021 ReadMeFirst_Important_Notices_cn.txt
-rwxrwxrwx 1 root root   37747 Aug 17  2021 ReadMeFirst_Important_Notices_en.txt
-rwxrwxrwx 1 root root   52554 Aug 17  2021 ReadMeFirst_Important_Notices_ja.txt
-rwxrwxrwx 1 root root    3587 Aug 17  2021 ReadMeFirst_License.txt

使用make生成可执行的vpnserver文件。

# cd /usr/local/vpnserver
# make

修改文件的权限。

# chmod 600 *
# chmod 700 vpncmd
# chmod 700 vpnserver

启动vpnserver之前确认是否正确安装。

# /usr/local/vpnserver/vpncmd
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.38 Build 9760   (English)
Compiled 2021/08/17 22:32:49 by buildsan at crosswin
Copyright (c) SoftEther VPN Project. All Rights Reserved.

By using vpncmd program, the following can be achieved.

1. Management of VPN Server or VPN Bridge
2. Management of VPN Client
3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)

Select 1, 2 or 3: 3

VPN Tools has been launched. By inputting HELP, you can view a list of the commands that can be used.

VPN Tools>check
Check command - Check whether SoftEther VPN Operation is Possible
---------------------------------------------------
SoftEther VPN Operation Environment Check Tool

Copyright (c) SoftEther VPN Project.
All Rights Reserved.

If this operation environment check tool is run on a system and that system passes, it is most likely that SoftEther VPN software can operate on that system. This check may take a while. Please wait...

Checking 'Kernel System'...
              Pass
Checking 'Memory Operation System'...
              Pass
Checking 'ANSI / Unicode string processing system'...
              Pass
Checking 'File system'...
              Pass
Checking 'Thread processing system'...
              Pass
Checking 'Network system'...
              Pass

All checks passed. It is most likely that SoftEther VPN Server / Bridge can operate normally on this system.

The command completed successfully.

VPN Tools>exit

将SoftEther VPN设定为系统的服务。

# vi /etc/systemd/system/vpnserver.service
[Unit] 
Description=SoftEther Server 
After=network.target 
[Service] 
Type=forking 
ExecStart=/usr/local/vpnserver/vpnserver start 
ExecStop=/usr/local/vpnserver/vpnserver stop

[Install] 
WantedBy=multi-user.target

systemctl status vpnserver命令确认服务状态。

systemctl start vpnserver启动服务。

systemctl status vpnserver命令确认服务状态为 active(running)。

systemctl enable vpnserver将vpnserver设定为开机自动启动。

下载SoftEther VPN Server Manager&初期配置

访问SoftEther VPN下载中心下载 SoftEther VPN Server Manger for Windows。

点击下载zip文件后进行解压,双击 vpnsmgr.exe 启动SoftEther VPN Manager后,点击 New Setting。

Setting Name输入任意名称,HostName输入SoftEther VPN服务器的IP地址后,点击OK。

选择AWS VPNServer后,点击Connect。

输入管理员密码后点击OK。

显示成功修密码。

勾选 Other Advanced Configuration of VPN 后,点击 Close。

点击 Yes。

勾选 Enable L2TP Server Function(L2TP over IPsec),在IPsec Pre-Shared Key输入共享秘钥后,点击OK。

在这里被推荐预共享秘钥使用少于9个字母,本次设定了12个字符,因此点击 No。

配置SecureNAT

点击 Manage Virtual Hub。

点击 Virtual NAT and Virtual DHCP Server(SecureNAT)。

首先点击 Enable SecureNAT进行激活。

点击 SecureNAT Configuration。

在这里修改 DNS Server Address 1的地址为SoftEther VPN服务器上 /etc/resolv.conf 的nameserver地址。


修改为 10.10.48.2 后点击OK。

创建VPN用户

点击 Manage Virtual Hub。

点击 Manage Users 开始创建用户。

点击 New 创建新用户。

User Name输入任意名称,认证方式选择 Password Authentication 后输入密码,并点击OK。

显示用户创建成功。

下载SoftEther VPN Client

SoftEther VPN下载中心,下载SoftEther VPN Client后,双击安装客户端。

点击 New VPN Connection Setting进行设定。

输入以下信息后,点击OK。

  • Setting Name:输入任意的名称
  • Host Name:输入SoftEther VPN服务器IP地址
  • Prot Number:443
  • Virtual Hub Name:DEFAULT # 必须和服务器上的Virtual Hub Name保持一致,服务器上的Hub Name默认名是DEFAULT
  • User Name:用户名
  • Password:密码

双击创建的AWS VPNServer进行连接。

连接成功后的Status为Connected。

断开VPN连接选择该连接后,点击Disconnect即可。