OpenVPN Route Private traffic only (OpenVPN Server on linux)

You can route specific subnet via OpenVPN and the rest of the traffic will be routed to the default PC gateway.

Note: this is valid on OpenVPN installations on Linux that have been installed using this installation script:


Open OpenVPN server.conf file:


Remove or comment out the following lines:

push "dhcp-option DNS"
push "dhcp-option DNS"
push "redirect-gateway def1 bypass-dhcp"


Add the following line where is the network that we need to route via OpenVPN.

push "route"


Save the file and restart using the following command:

sudo systemctl restart openvpn-server@server.service