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:30] – [Install to Virtual Machine] 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 37: | Line 37: | ||
| * Server: vpn | * Server: vpn | ||
| * User Name: dirk | * User Name: dirk | ||
| - | * Finish installing. I added OpenSSH server. | + | * Finish installing. |
| ===== Setup ===== | ===== Setup ===== | ||
| Line 65: | Line 65: | ||
| < | < | ||
| - | ==== Install Pi-hole | + | ==== Set Static IP ==== |
| - | < | + | < |
| - | * Select Google (we will remove it later) | + | change the bottom |
| - | * Ok to default " | + | < |
| - | * Ok to IPv4 and IPv6 | + | iface enp1s0 inet static |
| - | * Yes to Static | + | |
| - | * Yes to Web Admin Interface | + | |
| - | * Yes to Web Server | + | |
| - | * Yes to queries | + | |
| - | * Show everything | + | |
| - | * Change password | + | ==== Install OpenVPN and IpTables ==== |
| + | < | ||
| + | < | ||
| + | * click yes to both prompts on iptables install | ||
| - | ==== Install Unbound | + | === Setup === |
| - | < | + | |
| - | * write config file | + | |
| - | < | + | |
| - | < | + | |
| - | # If no logfile is specified, syslog is used | + | |
| - | # logfile: "/ | + | |
| - | verbosity: 0 | + | |
| - | interface: 127.0.0.1 | + | * Upload OpenVPN config files to home directory. |
| - | port: 5335 | + | * Copy boston.ovpn file to / |
| - | | + | * create text file / |
| - | | + | |
| - | | + | * edit / |
| - | + | | |
| - | | + | |
| - | do-ip6: no | + | * add the cert file in that folder too |
| - | + | * remove the keysize thing (i think it was keysize) that line needs to go. | |
| - | # You want to leave this to no unless you have *native* IPv6. With 6to4 and | + | |
| - | | + | |
| - | prefer-ip6: no | + | |
| - | + | * enable openvpn on startup | |
| - | | + | |
| - | # If you use the default dns-root-data package, unbound will find it automatically | + | * enable forwarding |
| - | | + | |
| - | + | | |
| - | | + | * enable service |
| - | | + | |
| - | + | * paste in iptables rules | |
| - | | + | |
| - | | + | sudo iptables |
| - | + | sudo iptables -t nat -F | |
| - | # Don't use Capitalization randomization as it known to cause DNSSEC issues sometimes | + | sudo iptables |
| - | # see https:// | + | sudo iptables -A INPUT -i ens18 -p tcp --dport 22 -j ACCEPT |
| - | use-caps-for-id: no | + | sudo iptables |
| - | + | sudo iptables -A OUTPUT -o lo -m comment --comment " | |
| - | # Reduce EDNS reassembly buffer size. | + | sudo iptables -I INPUT -i ens18 -m comment --comment "In from LAN" -j ACCEPT |
| - | # Suggested by the unbound man page to reduce fragmentation reassembly problems | + | sudo iptables -I OUTPUT -o tun+ -m comment --comment " |
| - | edns-buffer-size: 1472 | + | sudo iptables |
| - | + | sudo iptables -A OUTPUT -o ens18 -p udp --dport 123 -m comment --comment " | |
| - | # Perform prefetching of close to expired message cache entries | + | sudo iptables -A OUTPUT -p UDP --dport 67:68 -m comment --comment " |
| - | | + | sudo iptables -A OUTPUT -o ens18 -p udp --dport 53 -m comment --comment " |
| - | | + | sudo iptables -A FORWARD -i tun+ -o ens18 -m state --state RELATED, |
| - | + | sudo iptables -A FORWARD -i ens18 -o tun+ -m comment --comment "LAN out to VPN" -j ACCEPT | |
| - | | + | sudo iptables -P FORWARD DROP</ |
| - | | + | |
| - | + | | |
| - | | + | |
| - | | + | |
| - | + | | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | * save rules |
| - | + | | |
| - | ==== Point Pi-hole to Unbound ==== | + | * apply to startup |
| - | * log into pi-hole | + | * < |
| - | * go to Settings | + | * install dnsmasq |
| - | * uncheck Google servers and add Custom 127.0.0.1# | + | * < |
| - | * Save | + | * add dns forwarding |
| - | + | * < | |
| - | ==== Fix domain pointing to /admin page ==== | + | * add this to end |
| - | * To redirect the root address to / | + | * < |
| - | + | up /etc/openvpn/update-resolv-conf | |
| - | < | + | down /etc/openvpn/update-resolv-conf</ |
| * Links: | * Links: | ||
| - | * https:// | + | * https:// |
| - | * https:// | + | |