The easiest way to install simple OpenVPN server application in Linux Ubuntu on Digital Ocean Droplet. (We tested on Ubuntu 18.x and Ubuntu 20.x)

  • This guide using existing installation guide from (https://github.com/angristan/openvpn-install).
  1. curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
  2. chmod +x openvpn-install.sh
    1. ./openvpn-install.sh

Alternatively, If you wish to use droplet’s FLOATING ip as VPN host, you need to add the below strings into the above downloaded ‘openvpn-install.sh’ script.

ANCHOR_IP=echo "$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address)"
echo "local $ANCHOR_IP" >> /etc/openvpn/server.conf
echo "iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source $ANCHOR_IP" >> /etc/iptables/rm-openvpn-rules.sh
echo "iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source $ANCHOR_IP" >> /etc/iptables/add-openvpn-rules.sh
service openvpn restart

Leave a Reply

Your email address will not be published.