Debian 10 Set Up OpenVPN Server
Setting up an OpenVPN server on Debian 10 can be done in just a few minutes using the following steps:
- Install OpenVPN by running the command
sudo apt-get install openvpn - Create a directory to store the server configuration files by running the command
sudo mkdir /etc/openvpn/server - Generate the server's private key and certificate by running the command
sudo openvpn --genkey --secret /etc/openvpn/server/secret.key - Create a configuration file for the server by running the command
sudo nano /etc/openvpn/server/server.confand add the following content to it:
port 1194
proto udprndev tunrnca /etc/openvpn/server/ca.crtrncert /etc/openvpn/server/server.crtrnkey /etc/openvpn/server/server.keyrndh /etc/openvpn/server/dh.pemrnserver 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txtrnpush "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
comp-lzornpersist-keyrnpersist-tunrnstatus openvpn-status.logrnverb 3- Generate the Diffie-Hellman parameters by running the command
sudo openvpn --genkey --secret /etc/openvpn/server/dh.pem - Start the OpenVPN server by running the command
sudo systemctl start openvpn@server - Enable OpenVPN to start automatically at boot by running the command
sudo systemctl enable openvpn@server - Create client configuration files and distribute them to your clients.
- Configure your firewall to allow incoming connections on port 1194
It is important to note that this is a basic setup and there are many other options and configurations that can be added to the server.conf file to improve security and functionality, also the host firewall should be configured to allow incoming connections on port 1194.
