Hi there, hoping to find some help with a naive networking question.
I recently bought my first firewall appliance, installed Opnsense and am going to use it with my ISP modem in bridge mode, but while I'm learning I added it to my existing LAN with a 192.168.0.0/24 address assigned to the WAN port by my current DHCP. On the firewall's LAN port I set up a 10.0.0.0/24 network and am starting to build up my services. So far so good, but there's one thing I can't get to work: I can't port forward the firewall's WAN IP to a service on the firewall's LAN network and I can't figure out why.
To illustrate, I would like laptop with IP 192.168.0.161 to be able to reach service on 10.0.0.22:8888 by requesting firewall WAN IP 192.168.0.136:8888.
Private IPs and bogons are permitted on the WAN interface and I have followed every guide I can find for the port forwarding, but the closest I have come to this working is a "connection reset" browser error.
Hope my question is clear and isn't very dumb.
Thanks for the help or any explanation why I might be struggling to get this to work. Am I missing something obvious?
UPDATE
The thread is all over the place, but I have made some progress:
RDR rule gets triggered when requesting 192.168.0.136:8888 from 192.168.0.123
a tcpdump (in spoiler below) on the apache container looks inconspicuous to my untrained eye, with the exception of checksum errors in some packets from the docker container (172.20.0.2). The last five lines, after the second GET request (why is there a second GET request?) appear in tcpdump after a delay of about five seconds.
UPDATE 2
I see the exact same behaviour with a second VM and apache directly installed on it instead of in a docker container.
UPDATE 3
Thank you everybody for coming up with ideas. And thank you most of all to @maxwellfire@lemmy.world: The culprit was the Filter rule association in my Port Forward settings which I had as Add associated filter rule but needs to be Pass. As soon as that is set, everything works.
The full solution is a NAT Port forwarding rule with filter rule "pass", an outbound NAT rule for hairpinning, and everything related to reflection turned off in Settings > Advanced. It's that easy! 😵💫
The docker01 alias is a host alias with 10.0.0.22 and there's an apache test container running on port 8888.
I have created a pass any in rule on WAN (just until I figure out what's wrong)
In firewall > settings > advanced, I have set "reflection for port forwards" and "automatic outbound Nat for reflection" although I'm not sure if that is needed.
There is an opensense option that blocks rfc1918 traffic on the wan. your wan ip addeess range matches rfc1918. I do not remember where to disable it exactly, but this is the error.
I wrote it in reply to another comment, but the traffic reaches the service on 10.0.0.22:8888. The problem seems to be with the return path, i.e. Hairpin NAT, but I don't know what it is.