On Sun, Jul 29, 2018 at 4:35 PM, Andrew Eisenberg
<[email protected]> wrote:
>
> My openvpn server is on the same machine as my nginx server. When my clients
> make requests to the nginx server, the IP addresses that get logged are the
> original, non-vpn address of the client. Here is some more information:
>
> 1. client's non-vpn address is 50.64.25.75
> 2. icanhazip.com returns 190.171.27.34 (this is the correct public facing ip
> address and is also the ip address of the vpn and nginx server)
> 3. client's vpn address is 10.8.0.210
> 4. nginx logs the client's IP address as 50.64.25.75 (ie- the non-vpn
> address)
>
> #1, 2, and 3 are all what I want and expect. However, #4 is not. I want
> nginx to see the client's vpn address. How can I get this to happen?

Without really funny client side extra setup, that is exactly how it
has to be, and can't be helped. If your nginx and your openvpn server
are using one and the same (public) IP address, the clients will route
any traffic to that IP address over the normal Internet, without going
through the openVPN tunnel, so the client VPN address does not enter
the picture at all.

openVPN on the client side *has* to talk to the public IP. There is no
magic client side "all other traffic to the openVPN server public IP
goes into the tunnel" functionality, and creating such would need
massive client side policy routing weirdness depending on target
protocol and port.

If you need to get that working, get a second public IP, don't mix
nginx and openVPN server IPs, and use openVPN's "redirect-gateway
def1" setting to let the clients push all traffic *except* the one to
the openVPN server public IP, through the tunnel.

best regards
  Patrick

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-users

Reply via email to