Posted on November 4, 2020 at 12:57 am
Assuming that default ethernet network interface is eth0.
And that you added a new IP 126.96.36.199 on the VPS that got assigned to eth0:1 interface.
You can add “local 188.8.131.52” in your OpenVPN server config, e.g:
So OpenVPN will listen on the specificed IP address.
Then you need to restart OpenVPN:
Here is an example of iptables rules I used:
-P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -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 184.108.40.206 1194
All works fine, however when you use the VPN client it will use the eth0 IP.
And not the specified IP 220.127.116.11 (eth0:1).
You can make sure OpenVPN uses the specified IP 18.104.22.168 like this:
- Route OpenVPN Connections Through Floating IP
- How to Configure a Floating IP in a VPS (Hetzner)
- Set OpenVPN to Listed on a Specific IP Address
- Bash Trim Leading and Trailing Whitespace from a String
- Bash Get Name of Ethernet Network Interface
- VPN Providers with Dedicated Static IP Address
- OpenVPN Iptables Rules
- WireGuard VPN Iptables Rules
- AMD Chipsets & Graphics Card Drivers for Windows 7, 8, 10
- AMD Radeon 7400 Drivers for Windows 10
- How to pass custom command-line parameters in InnoSetup
- Add Desktop shortcut for all Windows PC users
- Programmatically create desktop icon with InnoSetup
- GeneratePress - a Lightweight WordPress Theme 2021
- InnoSetup disable DesktopIcon via command-line
- Use cURL to authenticate with JWT Bearer tokens