Hi, I have a problem using Port Forwarding.
I want to expose a webserver via dstnat rules - which works if if I try to access it from the outside, but does not if I try to access it from LAN:
LAN-IP → LAN-IP: works
WAN-IP → WAN-IP: works
LAN-IP → WAN-IP: doesn’t work; I see the webbox
I already read this post: viewtopic.php?f=13&t=34245&p=167859
But the solution does not work in my case because my WAN IP is dynamic, so I can only work with the interface (?).
Did you read the last two posts on that subject? To quote mrz: “guess not”.
As far as I understand NAT this rule would already match the other two from above, but the result is unchanged.
I think the real problem here is that the only way I can do a dst-nat is by using “in-interface”.
The public IP is dynamic so I can’t use it, but on the other hand dst-natted traffic from the inside will never pass through the given interface…
So I would need a rule that matches the public IP regardless of the interface
Something like:
You can not route to an interface from which you came. In your case, you can’t route from the LAN interface right back to the LAN interface. It’s a Linux kernel problem.
You can solve this issue with DNS. As far as I know, there is no other solution.
How often does your public ip address change? I have static ips, but many friends have dhcp connections and their ips usually don’t change unless the power fails.
Maybe a script scheduled every few minutes (or a couple minutes after startup) would take care of changing that ip in your nat.
To help sell their leased lines the owner of pretty much all German last-miles “Deutsche Telekom” enforces a pretty silly limitation: Every DSL user will be disconnected every 24 hours and will receive a new IP upon reconnect.
possibly you can use interface and destination-address-type=local? You should not need to hard code any IPs in there for this to work.
that works, but I would have split mine into two rules probably, one with in-interface=lan and the other in-interface=wan. i dunno, just seems like you want to keep them separated. i could be wrong… anyhow, glad it works as you like.