Here is a step by step guide to install and configure OpenVPN on Debian 9:
- Update the package index and install OpenVPN:
sudo apt-get update
sudo apt-get install openvpn
- Create a directory for the VPN configuration files:
sudo mkdir /etc/openvpn/server
- Copy the sample OpenVPN server configuration file to the new directory:
sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/server
- Unzip the configuration file:
sudo gzip -d /etc/openvpn/server/server.conf.gz
- Edit the OpenVPN configuration file, changing the following parameters:
sudo nano /etc/openvpn/server/server.conf
- Replace
local
with the IP address of the server. - Replace
port
with the desired port number. - Replace
proto
withtcp
orudp
. - Replace
dev tun
withdev tun0
. - Replace
ca
andcert
with the paths to the respective files. - Replace
key
with the path to the key file. - Replace
dh
with the path to the DH file. - Uncomment the
push "redirect-gateway def1 bypass-dhcp"
line to redirect all client traffic through the VPN.
- Start the OpenVPN service:
sudo systemctl start openvpn@server
- Enable OpenVPN to start at boot:
sudo systemctl enable openvpn
- Verify that the OpenVPN service is running:
sudo systemctl status openvpn
This should get you started with OpenVPN on Debian 9. However, this is a simplified example and you may need to add additional security measures, such as setting up a firewall, to meet your specific requirements.