Set OpenVPN to Listed on a Specific IP Address

Posted on November 4, 2020 at 12:57 am

Assuming that default ethernet network interface is eth0.

And that you added a new IP on the VPS that got assigned to eth0:1 interface.

You can add “local” in your OpenVPN server config, e.g:


So OpenVPN will listen on the specificed IP address.

Then you need to restart OpenVPN:

/etc/init.d/openvpn restart

Here is an example of iptables rules I used:

-A INPUT -i tun0 -j ACCEPT
-A INPUT -i eth0:1 -p udp -m udp --dport 1194 -j DROP
-A FORWARD -i tun0 -o eth0:1 -j ACCEPT
-A FORWARD -i eth0:1 -o tun0 -j ACCEPT

* From a recent test looks like is not needed to use eth0:1, just use eth0.

On client .ovpn config file I added this:

remote 1194

All works fine, however when you use the VPN client it will use the eth0 IP.

And not the specified IP (eth0:1).

You can make sure OpenVPN uses the specified IP like this:

Route OpenVPN Connections Through Floating IP

Receive updates via email

Other Posts

Updated Posts