(Step by step) How to setup a ddos protected vpn on Ubuntu server using Openvpn:
Server Hosting:
Buy A DDoS Protected Game Server From OVH
Server Setup:
(As root Ubuntu 18.04 +)
**BEGIN**
apt update && apt upgrade -y
apt autoremove -y
apt -y install wget ca-certificates net-tools gnupg
wget -qO - https://as-repository.openvpn.net/as-repo-public.gpg | apt-key add -
echo "deb http://as-repository.openvpn.net/as/debian bionic main">/etc/apt/sources.list.d/openvpn-as-repo.list
apt update && apt -y install openvpn-as
passwd openvpn
usermod -s /usr/sbin/nologin openvpn
/usr/local/openvpn_as/scripts/sacli --user openvpn --key prop_autologin --value true UserPropPut
/usr/local/openvpn_as/scripts/sacli --user openvpn GetAutologin > /root/client.ovpn
reboot
********** IPTABLES OPTIONAL **********
iptables -Z
iptables -F
iptables -A INPUT -s 127.0.0.0/8 -d 127.0.0.0/8 -j ACCEPT
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP
iptables -A INPUT -p tcp -m tcp -m connlimit --connlimit-above 8 --connlimit-mask 32 --connlimit-saddr -j DROP
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
iptables -A INPUT -p icmp -m icmp ! --icmp-type 8 -j ACCEPT
iptables -P INPUT DROP
iptables-save > /root/iptables.txt
crontab -e
(select nano)
Paste:
@reboot sudo iptables-restore < /root/iptables.txt
(press ctrl+o)
(press enter)
(press ctrl+x)
reboot