Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
deb9:openvpn [2025/09/22 15:02] – [OpenVPN] Bernard Condraudeb9:openvpn [2026/08/14 20:13] (current) Bernard Condrau
Line 1: Line 1:
 ====== OpenVPN ====== ====== OpenVPN ======
 Follow one of the excellent guides from DigitalOcean (see [[#links|Links]] below). Follow all the steps to the detail and everything will work, below are modifications I made for my personal requirements. Make sure you run commands as regular user and only elevate to root when told to do so. Follow one of the excellent guides from DigitalOcean (see [[#links|Links]] below). Follow all the steps to the detail and everything will work, below are modifications I made for my personal requirements. Make sure you run commands as regular user and only elevate to root when told to do so.
- 
-If you resinstall OpenVPN on a new machine with existing client configurations do the following: 
-- Copy ''/etc/openvpn/'' from the old server and copy to the new server 
  
 ===== Prerequisites ===== ===== Prerequisites =====
Line 12: Line 9:
   - Install [[https://github.com/OpenVPN/easy-rsa/releases|EasyRSA]]   - Install [[https://github.com/OpenVPN/easy-rsa/releases|EasyRSA]]
  
 +===== Migrating server =====
 +If you resinstall OpenVPN on a new machine with existing client configurations do the following:
 +  - Copy ''/etc/openvpn/'' from the old server and copy to the new server
 +  - Follow [[https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-debian-11#step-5-adjusting-the-server-networking-configuration|Adjusting the Server Networking Configuration]] (steps 5 and 6)
 +  - Check the VPN is running with<file>sudo systemctl status openvpn@server</file>
 ===== Adding Clients ===== ===== Adding Clients =====
 Setting up the environment (//VPN Server(s)// and //CA Server//) takes a while, the many steps are outlined clearly and in detail in the Original Article below in [[deb9:openvpn#original_article|my Wiki]] or on the [[https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-debian-9|DigitalOcean]] website. In this paragraph I summarized the steps necessary to add clients to the VPN. Since both //VPN Servers// use the same credentials, the process is identical apart from using a different //base.conf// file which contains the server's IP address. Setting up the environment (//VPN Server(s)// and //CA Server//) takes a while, the many steps are outlined clearly and in detail in the Original Article below in [[deb9:openvpn#original_article|my Wiki]] or on the [[https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-debian-9|DigitalOcean]] website. In this paragraph I summarized the steps necessary to add clients to the VPN. Since both //VPN Servers// use the same credentials, the process is identical apart from using a different //base.conf// file which contains the server's IP address.
Line 31: Line 33:
   * Install the //OpenVPN Client// for [[https://openvpn.net/community-downloads/|Windows]], [[https://play.google.com/store/apps/details?id=de.blinkt.openvpn&hl=en|Android]], or other platforms.   * Install the //OpenVPN Client// for [[https://openvpn.net/community-downloads/|Windows]], [[https://play.google.com/store/apps/details?id=de.blinkt.openvpn&hl=en|Android]], or other platforms.
   * On Android, open the app and select the import icon top right to import the config file.{{ :deb9:openvpn.png?200|}} You should now be able to open the VPN by selecting the profile created from the config file imported.   * On Android, open the app and select the import icon top right to import the config file.{{ :deb9:openvpn.png?200|}} You should now be able to open the VPN by selecting the profile created from the config file imported.
 +
 +===== Managing network =====
 +  * If you have more than one network adapter enabled you need to make sure that the OpenVPN settings match the default adapter. This can be necessary, when you have a virtual machine running on your main server, for example to host websites, and the virtual machine get's its IP address from a DHCP server in the system.
 +  * Check active adapters:<code>ip route show</code>
 +  * Disable the adapter (example IP and device enp47s0):<code>ip addr del 192.168.3.101/24 dev enp47s0</code>
 +  * To make it permanent for **NetworkManager**
 +    - Create a new connection profile<code>sudo nmcli connection add type ethernet con-name "MyConnection" ifname enp47s0</code>
 +    - Disable IP configurations<code>sudo nmcli connection modify "MyConnection" ipv4.method "disabled" ipv6.method "disabled"</code>
 +    - Bring the interface up<code>sudo nmcli connection up "MyConnection"</code>
  
 ===== Links ===== ===== Links =====