OpenVPN – Configure Multiple External IP Addresses

ipiptableslinuxopenvpnvpn

I currently have an openVPN server with multiple external IP addresses.

I'd like to have all VPN connections (tun0 interface, and/or 10.19.88.xx IP range) to take the 2nd external IP address as 'public IP', instead of the first one.

As an example, using fictive addresses:

Deault eth0 address: 11.12.13.1 (server.domain.tld)
eth0:0 address: 11.12.13.2 (vpn.domain.tld)

All VPN connections are currently using 11.12.13.1, instead of 11.12.13.2.

Is there any way to solve this (using iptables?)

Thanks

Best Answer

Try:

iptables -t nat -A POSTROUTING -s 10.19.88.0/24 -o eth0 -j SNAT --to 11.12.13.2

Or even better ;)

iptables -t nat -A POSTROUTING -s 10.19.88.0/24 -j SNAT --to 11.12.13.2
Related Topic