1
General Discussion / Re: Best practice for my specific setup?
« on: October 21, 2024, 05:40:21 pm »
I have finally found the solution.
Porting here for future reference, as well for other users.
I could NOT make it work on the same LAN, which might make sense since that would mess up standard ethernet routing. So i added a DMZ interface on a different subnet, to the server.
First of all, you need DNAT (port forwarding) on BOTH DMZ and LAN itnerfaces, from "NET net" as source, destination set to the public IP i want to redirect from, and the DMZ server address as redirection to.
Then you ALSO need a SNAT (outbound) rule to nat traffic from LAN to DMZ, because in my case my server is BOTH on LAN and DMZ networks. What was happening was that the request would be DNATted to the DMZ, but with the source address of my NAT network client, so the reply from the server would be routed trough the server LAN interface, and could not be matched by the client from the reply, because it was coming from a different IP address.
Hope it clear...
TLDR:
- rule 1: DNAT (use BOTH interfaces under "interface", and this baffles me, plus the /32 on the destination host)
- rule 2: SNAT from LAN to DMZ to ensure responses can route back.
Note: rule 2 might not be needed if your server is NOT on LAN as well as on DMZ.
Porting here for future reference, as well for other users.
I could NOT make it work on the same LAN, which might make sense since that would mess up standard ethernet routing. So i added a DMZ interface on a different subnet, to the server.
First of all, you need DNAT (port forwarding) on BOTH DMZ and LAN itnerfaces, from "NET net" as source, destination set to the public IP i want to redirect from, and the DMZ server address as redirection to.
Then you ALSO need a SNAT (outbound) rule to nat traffic from LAN to DMZ, because in my case my server is BOTH on LAN and DMZ networks. What was happening was that the request would be DNATted to the DMZ, but with the source address of my NAT network client, so the reply from the server would be routed trough the server LAN interface, and could not be matched by the client from the reply, because it was coming from a different IP address.
Hope it clear...
TLDR:
- rule 1: DNAT (use BOTH interfaces under "interface", and this baffles me, plus the /32 on the destination host)
- rule 2: SNAT from LAN to DMZ to ensure responses can route back.
Note: rule 2 might not be needed if your server is NOT on LAN as well as on DMZ.