OpenVPN server behind NAT - private source IP in status/log
Posted: Mon Jun 05, 2023 2:18 pm
by tuxmartin
Hello, I have an OpenVPN server in LAN behind NAT.
There is my setup:
Server (public IP) --DNAT--> ovpn server (lan, private ip)
1.2.3.4 (10.0.0.1) --DNAT--> (10.0.0.2)
My clients connect to the server public IP, which DNAT port UDP 1194 to LAN to ovpn virtual with private IP. If I look at the openvpn status/log, all clients have the private IP of my server (10.0.0.1) as source IP. So logs are useless.
How can I fix it? For example HTTP has X-Real-IP/X-Forwarded-For headers which can solve it. But I need to learn how to fix it on OpenVPN.
Re: OpenVPN server behind NAT - private source IP in status/log
Posted: Mon Jun 05, 2023 9:46 pm
by volleynbike
It sounds like there is more than just DNAT happening. If it were only DNAT, the src ip would still be the client's internet ip. Maybe there is some other NAT command that is also picking up these packets? We do something similar, and our logs show the clients src address.
Re: OpenVPN server behind NAT - private source IP in status/log