This is an old revision of the document!
This will guide you through the setup of an OpenVPN virtual router on an installation of Ubuntu 20.04 LTS as an Unraid Virtual Machine.
sudo apt-get update sudo apt-get dist-upgrade
sudo apt-get install openssh-server
mkdir .ssh
ssh-keygen -t rsa
openssl genrsa -aes128 -out id_rsa 2048 openssl rsa -in id_rsa -pubout -out id_rsa.test ssh-keygen -f id_rsa.test -i -mPKCS8
sudo vim /etc/ssh/sshd_config
UsePAM yes PasswordAuthentication no
sudo reboot -h now
sudo vim /etc/network/interfaces
change the bottom to read:
auto enp1s0
iface enp1s0 inet static
address 192.168.1.99
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 208.67.222.222 208.67.220.220
sudo apt-get install openvpn
sudo apt-get install iptables-persistent
sudo openvpn --config /etc/openvpn/boston.conf
sudo systemctl enable openvpn@boston
* enable forwarding
* <code>sudo vim /etc/sysctl.conf
sudo sysctl -p
sudo iptables --flush sudo iptables --delete-chain sudo iptables -t nat -F sudo iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE sudo iptables -A INPUT -i enp1s0 -p tcp --dport 22 -j ACCEPT sudo iptables -A INPUT -i lo -m comment --comment "loopback" -j ACCEPT sudo iptables -A OUTPUT -o lo -m comment --comment "loopback" -j ACCEPT sudo iptables -I INPUT -i enp1s0 -m comment --comment "In from LAN" -j ACCEPT sudo iptables -I OUTPUT -o tun+ -m comment --comment "Out to VPN" -j ACCEPT sudo iptables -A OUTPUT -o enp1s0 -p udp --dport 443 -m comment --comment "openvpn" -j ACCEPT sudo iptables -A OUTPUT -o enp1s0 -p udp --dport 123 -m comment --comment "ntp" -j ACCEPT sudo iptables -A OUTPUT -p UDP --dport 67:68 -m comment --comment "dhcp" -j ACCEPT sudo iptables -A OUTPUT -o enp1s0 -p udp --dport 53 -m comment --comment "dns" -j ACCEPT sudo iptables -A FORWARD -i tun+ -o enp1s0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i enp1s0 -o tun+ -m comment --comment "LAN out to VPN" -j ACCEPT sudo iptables -P FORWARD DROP
sudo netfilter-persistent save
sudo systemctl enable netfilter-persistent
sudo install dnsmasq
sudo /etc/openvpn/boston.conf
script-security 2 up /etc/openvpn/update-resolv-conf down /etc/openvpn/update-resolv-conf
* Links: