This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| unraid:virtual:openvpnu16.04 [2021/07/21 20:55] – [Install OpenVPN and IpTables] dirk | unraid:virtual:openvpnu16.04 [2025/04/19 15:13] (current) – [Install OpenVPN and IpTables] dirk | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Install OpenVPN virtual router on Ubuntu 16.04 LTS as Unraid Virtual Machine ====== | ====== Install OpenVPN virtual router on Ubuntu 16.04 LTS as Unraid Virtual Machine ====== | ||
| - | This will guide you through the setup of an OpenVPN virtual router on an installation of [[Ubuntu | + | This will guide you through the setup of an OpenVPN virtual router on an installation of [[Ubuntu |
| ===== VM Settings ===== | ===== VM Settings ===== | ||
| * Autostart: Yes | * Autostart: Yes | ||
| Line 88: | Line 88: | ||
| * edit / | * edit / | ||
| * < | * < | ||
| - | * add path to vpnauth.txt: | + | * add path to vpnauth.txt: |
| + | * add the cert file in that folder too | ||
| + | * remove the keysize thing (i think it was keysize) that line needs to go. | ||
| * reboot | * reboot | ||
| * check connection | * check connection | ||
| Line 104: | Line 106: | ||
| sudo iptables -t nat -F | sudo iptables -t nat -F | ||
| sudo iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE | sudo iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE | ||
| - | sudo iptables -A INPUT -i enp1s0 | + | sudo iptables -A INPUT -i ens18 -p tcp --dport 22 -j ACCEPT |
| sudo iptables -A INPUT -i lo -m comment --comment " | sudo iptables -A INPUT -i lo -m comment --comment " | ||
| sudo iptables -A OUTPUT -o lo -m comment --comment " | sudo iptables -A OUTPUT -o lo -m comment --comment " | ||
| - | sudo iptables -I INPUT -i enp1s0 | + | sudo iptables -I INPUT -i ens18 -m comment --comment "In from LAN" -j ACCEPT |
| sudo iptables -I OUTPUT -o tun+ -m comment --comment "Out to VPN" -j ACCEPT | sudo iptables -I OUTPUT -o tun+ -m comment --comment "Out to VPN" -j ACCEPT | ||
| - | sudo iptables -A OUTPUT -o enp1s0 | + | sudo iptables -A OUTPUT -o ens18 -p udp --dport 443 -m comment --comment " |
| - | sudo iptables -A OUTPUT -o enp1s0 | + | sudo iptables -A OUTPUT -o ens18 -p udp --dport 123 -m comment --comment " |
| sudo iptables -A OUTPUT -p UDP --dport 67:68 -m comment --comment " | sudo iptables -A OUTPUT -p UDP --dport 67:68 -m comment --comment " | ||
| - | sudo iptables -A OUTPUT -o enp1s0 | + | sudo iptables -A OUTPUT -o ens18 -p udp --dport 53 -m comment --comment " |
| - | sudo iptables -A FORWARD -i tun+ -o enp1s0 | + | sudo iptables -A FORWARD -i tun+ -o ens18 -m state --state RELATED, |
| - | sudo iptables -A FORWARD -i enp1s0 | + | sudo iptables -A FORWARD -i ens18 -o tun+ -m comment --comment "LAN out to VPN" -j ACCEPT |
| sudo iptables -P FORWARD DROP</ | sudo iptables -P FORWARD DROP</ | ||
| * first three lines erase old rules (if any) | * first three lines erase old rules (if any) | ||