Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tracer8/744773b49e8fb1a04f14ce6fb4645428 to your computer and use it in GitHub Desktop.
Save tracer8/744773b49e8fb1a04f14ce6fb4645428 to your computer and use it in GitHub Desktop.
SoftEther VPN for Ubuntu 16.04 & 18.04
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y
apt-get -y install build-essential wget curl gcc make wget tzdata git libreadline-dev libncurses-dev libssl-dev zlib1g-dev
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.34-9745-beta/softether-vpnserver-v4.34-9745-beta-2020.04.05-linux-x64-64bit.tar.gz
tar xzf softether-vpnserver-v4.34-9745-beta-2020.04.05-linux-x64-64bit.tar.gz && rm softether-vpnserver-v4.34-9745-beta-2020.04.05-linux-x64-64bit.tar.gz
cd vpnserver && sudo make
cd ..
sudo mv vpnserver /usr/local && cd /usr/local/vpnserver/
sudo chmod 600 *
sudo chmod 700 vpnserver vpncmd
sudo ./vpnserver start
sudo ./vpncmd
ServerPasswordSet
sudo cat >> /lib/systemd/system/vpnserver.service << EOF
[Unit]
Description=SoftEther VPN Server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/vpnserver/vpnserver start
ExecStop=/usr/local/vpnserver/vpnserver stop
[Install]
WantedBy=multi-user.target
EOF
echo net.ipv4.ip_forward = 1 | ${SUDO} tee -a /etc/sysctl.conf
echo net.ipv6.ip_forward = 1 | ${SUDO} tee -a /etc/sysctl.conf
systemctl enable vpnserver
systemctl start vpnserver
systemctl stop vpnserver
systemctl restart vpnserver
systemctl status vpnserver
sudo ufw allow 500,4500/udp
ufw allow 443
ufw allow 1701
ufw allow 1194
ufw allow 5555
# Static Route Push
# Format:
<VPC Network>/<VPC Netmask>/<VPN Gateway IP>
# Example:
10.125.0.0/255.255.0.0/10.130.30.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment