amuck-landowner

OpenVPN IP Allocation

kcaj

New Member
Hello,

I have a VPS server with two IP addresses. I want to be able to run OpenVPN completely from the second IP (i.e. not the main IP address). I know it is pretty easy to have the client connect to the OpenVPN server on the second IP, but I want to know how to get OpenVPN to make connections from the server to the website requested by the client using the second IP?

Any help appreciated - thanks
 

wlanboy

Content Contributer
iptables is your friend (on server side):

Code:
iptables -t nat -A POSTROUTING -s [VPN subnet] -j SNAT --to [servers external ip address]
 

kcaj

New Member
iptables is your friend (on server side):


iptables -t nat -A POSTROUTING -s [VPN subnet] -j SNAT --to [servers external ip address]
Thanks, though I'd rather get this working by configuring OpenVPN somehow.
 

dave

Member
The SNAT iptables entry could be considered part of the openvpn configuration, since it's required for it to work at all.  That will be the IP address that will get used for the outgoing traffic.

To control the IP address that you connect to, just change the setting in the openvpn .conf file (on the server).

local {ip address}
 
Last edited by a moderator:
Top
amuck-landowner