[Help] L2TP Public IP – Nginx Proxy Manager Sees PPP Server IP Instead of Real Client IP

Hi everyone,

I'm currently using MikroTik RouterOS v7 with an L2TP/IPsec client connection to a VPN provider that assigns me a public IPv4 address.

The public IP works correctly for port forwarding (DST-NAT), and my Nginx Proxy Manager (NPM) is accessible from the internet.

However, I'm experiencing an issue where Nginx Proxy Manager always detects the L2TP server's PPP local IP instead of the actual public IP address of the connecting client.

1. Network Topology

Internet Client
(Real Public IP: x.x.x.x)
        |
        v
VPN Provider (Atlantic)
L2TP Server: 178.85.180.30
PPP Local IP: 178.85.180.192
        |
        | L2TP/IPsec Tunnel
        v
MikroTik RouterOS v7
PPP Remote / Assigned Public IP:
178.85.180.198
        |
        | DST-NAT
        v
Nginx Proxy Manager
192.168.252.129

2. Current Situation

My L2TP connection is established successfully with the following PPP addressing:

  • L2TP server endpoint: 178.85.180.30

  • PPP server local-address: 178.85.180.192

  • PPP client assigned address: 178.85.180.198

  • Internal NPM server: 192.168.252.129

I have configured DST-NAT to forward incoming HTTP/HTTPS requests from 178.85.180.198 to my internal Nginx Proxy Manager server.

The connection works, and websites hosted behind NPM are accessible from external networks.

However, the NPM access logs show:

GET https npm.xxxx.xxx "/api/"
[Client 178.85.180.192]
[Sent-to 192.168.252.129]
[HTTP 200]

Instead of showing the actual visitor's public IP, NPM always logs:

178.85.180.192

This is the PPP local-address on the VPN provider's L2TP server.

3. The Problem

Because all incoming connections appear to originate from 178.85.180.192, I cannot properly use the IP-based Access List (ACL) feature in Nginx Proxy Manager.

For example, I want to allow only specific public IP addresses or subnets to access certain proxy hosts, while denying everyone else.

Unfortunately, all visitors appear to have the same source IP.

4. Expected Behavior

I want the original client's source IP to be preserved throughout the connection:

Internet Client: x.x.x.x
        |
        v
L2TP VPN Provider
        |
        v
MikroTik DST-NAT
        |
        v
Nginx Proxy Manager

Detected Client IP: x.x.x.x

The public IP assigned through L2TP should continue to work for inbound port forwarding and outbound internet access.

5. Questions

  1. Is it normal for an L2TP server's PPP local-address to appear as the source IP for all forwarded incoming connections?

  2. Does PPP/L2TP itself modify the source IP, or would this indicate NAT somewhere along the forwarding path?

  3. Is there a way to preserve the original client IP when forwarding inbound connections through an L2TP tunnel?

  4. Could this issue be related to masquerade, SRC-NAT, connection tracking, or routing configuration on either MikroTik router?

  5. Would policy routing or connection marking help preserve the original source IP while ensuring return traffic goes back through the L2TP tunnel?

  6. What would be the recommended RouterOS v7 configuration for this scenario?

6. Additional Information

The VPN provider's PPP local and remote addresses are configured as described above. I understand that PPP address assignment itself should not automatically perform source NAT.

I have not yet confirmed through packet capture exactly where the source address changes.

I'm looking for a solution that preserves the original source IP without breaking existing DST-NAT functionality or outbound internet connectivity.

Any advice, configuration examples, or troubleshooting suggestions would be greatly appreciated.

Thank you!

NOTE : Endpoint/VPN Server is using CHR (Confirmed), client using Routerboard 7.25. Please help to give solution for provider vpn server and also to me

The whole AI analysis is useless (if it was useful, then AI would be sble to fix it for you). Rather you should show your actual full configuration (sensitive parts obfuscated). Relevant portion would be enough, but since we don't know where misconfiguration lies it'impossible to tell which part is relevant.

If I'd have to guess ... I'd say you have some SRC NAT configured which also works on "inbound" traffic ... but without seeing actual config that's impossible to say.

Hello,

This is my configuration firewall

FILTER

0 chain=input action=accept src-address-list=VPN dst-address-list=VPN log=no log-prefix=""

1 chain=input action=accept protocol=icmp in-interface-list=LAN log=no log-prefix=""

2 chain=input action=drop protocol=icmp dst-address-list=$Atlantic-VPN in-interface-list=LAN log=no log-prefix=""

3 chain=input action=drop protocol=tcp dst-address-list=$Atlantic-VPN in-interface-list=LAN dst-port=1-65535 log=no log-prefix=""

4 chain=input action=drop protocol=tcp dst-address-list=$Atlantic-VPN in-interface-list=HOME-VPN dst-port=1-65535 log=no log-prefix=""

5 chain=input action=accept dst-address=192.168.192.0/24 in-interface=zerotier1 log=no log-prefix=""

6 ;;; SYMETRIC-EXIST Atlantic-L2TP-1
chain=forward action=accept connection-state=established,related connection-mark=DSTNAT-Atlantic-L2TP-1 log=no log-prefix=""

7 ;;; SYMETRIC-EXIST Atlantic-L2TP-2
chain=forward action=accept connection-state=established,related connection-mark=DSTNAT-Atlantic-L2TP-2 log=no log-prefix=""

8 chain=forward action=accept in-interface-list=LAN out-interface-list=HOME-VPN log=no log-prefix=""

9 chain=forward action=accept src-address-list=VPN dst-address-list=VPN log=no log-prefix=""

10 chain=output action=accept src-address-list=VPN dst-address-list=VPN log=no log-prefix=""

NAT

0 chain=srcnat action=src-nat to-addresses=192.168.18.254 out-interface=vlan20-BIZNET log=no log-prefix=""

1 chain=srcnat action=src-nat to-addresses=192.168.8.254 out-interface=vlan40-MODEM log=no log-prefix=""

2 chain=srcnat action=src-nat to-addresses=192.168.192.1 connection-mark=conn-zonata-ovpn out-interface=zerotier1 log=no log-prefix=""

3 chain=srcnat action=src-nat to-addresses=172.16.1.2 out-interface=Wireguard-Home-1 log=no log-prefix=""

4 chain=srcnat action=src-nat to-addresses=172.16.2.2 out-interface=openvpn-zonata-1 log=no log-prefix=""

5 chain=srcnat action=src-nat to-addresses=178.85.180.198 out-interface=Atlantic-L2TP-1 log=no log-prefix=""

6 chain=srcnat action=src-nat to-addresses=178.85.180.203 out-interface=Atlantic-L2TP-2 log=no log-prefix=""

7 chain=dstnat action=dst-nat to-addresses=192.168.252.129 protocol=tcp dst-address=178.85.180.198 dst-port=80,443 log=no log-prefix=""

MANGLE

0 ;;; Keep ZeroTier destinations local
chain=prerouting action=accept dst-address=192.168.192.0/24 in-interface-list=LAN

1 X ;;; Keep mDNS local
chain=prerouting action=accept protocol=udp dst-address=224.0.0.251 in-interface-list=mDNS dst-port=5353

2 ;;; 01 Keep access to HOME router local
chain=prerouting action=accept dst-address-type=local in-interface-list=LAN

3 ;;; 02 Keep internal traffic local
chain=prerouting action=accept dst-address-list=LOKAL in-interface-list=LAN log=no log-prefix=""

4 ;;; 02b Keep VPN subnet traffic local
chain=prerouting action=accept dst-address-list=VPN in-interface-list=LAN log=no log-prefix=""

5 ;;; 03 Mark outbound email connections
chain=prerouting action=mark-connection new-connection-mark=EMAIL-VPN passthrough=yes connection-state=new protocol=tcp src-address-list=LOKAL connection-mark=no-mark in-interface-list=LAN dst-port=25,110,143,465,587,993,995,26,2525
log=no log-prefix=""

6 ;;; 04 Email via CHR
chain=prerouting action=mark-routing new-routing-mark=Atlantic-L2TP-2 passthrough=no src-address-list=LOKAL connection-mark=EMAIL-VPN in-interface-list=LAN log=no log-prefix=""

7 ;;; Mangle: tandai koneksi DST-NAT - Atlantic-L2TP-1
chain=forward action=mark-connection new-connection-mark=DSTNAT-Atlantic-L2TP-1 passthrough=yes connection-state=new connection-nat-state=dstnat connection-mark=no-mark in-interface=Atlantic-L2TP-1 log=no log-prefix=""

8 ;;; Mangle: tandai koneksi DST-NAT - Atlantic-L2TP-2
chain=forward action=mark-connection new-connection-mark=DSTNAT-Atlantic-L2TP-2 passthrough=yes connection-state=new connection-nat-state=dstnat connection-mark=no-mark in-interface=Atlantic-L2TP-2 log=no log-prefix=""

9 ;;; Mangle: routing balasan - Atlantic-L2TP-1
chain=prerouting action=mark-routing new-routing-mark=Atlantic-L2TP-1 passthrough=no dst-address-type=!local connection-mark=DSTNAT-Atlantic-L2TP-1 in-interface-list=LAN log=no log-prefix=""

10 ;;; Mangle: routing balasan - Atlantic-L2TP-2
chain=prerouting action=mark-routing new-routing-mark=Atlantic-L2TP-2 passthrough=no dst-address-type=!local connection-mark=DSTNAT-Atlantic-L2TP-2 in-interface-list=LAN log=no log-prefix=""

I use L2TP with 5G internet, between a CCR2116 and CHR on a BGP VPS. This is to evade CGNAT.

It's normal to see the VPN host's IP address rather than your ISP's public IP. That is because you are connecting to nginx proxy manager via your VPN.

If you want to see your ISP's public IP, don't use the VPN assuming your ISP isn't using CGNAT.

yes, in this situation it is normal. Reply packet needs to follow the same path, so the src-ip should correspond with IP where the reply packed must be forwarded at given leg of connection. The VPN Provider's server acts as a forwarder/proxy, so you see connections from the the server. Your router needs to send packets back to the VPN provider's server.

L2TP does not modify source IP, but the VPN Provider almost certainly have src-nat on their server. Standard practice, simple setup, bulletproof, works for 99% users.

If your provider does simple L3 forwarding, then they need to disable the src-nat. Not sure if they support that.

If your provider is L7 proxy, then there is approach called "transparent proxy" but your provider must support it in the first place (unlikely IMHO, it is very niche)

In both cases, you would need to mark incoming connections from the VPN and then route them back into the VPN with correct routing. That is bit complex to set up so I won't go through details. It is definitely doable and I use this approach with haproxy+RouterOS.

Have look at their settings and documentation. Maybe they support some of that.

Not sure what you mean by "either mikrotik router"? I thought there is only one (yours). IMHO, the src-nat is applied on provider's side. Not on your mikrotik.

IMHO, nothing to do with your mikrotik setting.


Now, looking at it from different side, if your provider works as L7 proxy, there is a good chance they include x-forwarded-for HTTP header. I believe Nginx Proxy Manager can work with that.

If your provider works as a simple L3 forwarder, and does not give you ability to enable transparent proxying or disable src-nat, then I would start looking for a different provider.