Hello, I have a public domain that points to my public ip and NAT port forwarding for the ports 80 and 443 on my RB5009. Then I've got a reverse proxy that takes every HTTP request and proxy it to the correct web service in my network.
The web services are in the 10.1.5.X lxc vlan (35) and I'm able to reach the web server (using my domain) at 10.1.5.2 without problems from the 10.1.2.X trusted vlan (20).
If I try to reach it from another vlan like the 10.1.6.X iot vlan (60) I don't get any response.
What could be the issue?
Maybe because traffic from 10.1.6.X to 10.1.5.X is forbidden?
(but I thought that traffic should go outside and back inside my network again avoiding the direct destination)
DSTNAT (#10) happens before the rules in the filter table chain forward (#14). Between those steps the packets don't leave the interfaces. At step #14, the destination address (dst-address) and destination interface (out-interface) have already been changed to 10.1.5.2 and (V35 LXC), and if your filter rules don't allow forwarding from the in-interface/src-address to that out-interface/dst-address, then the packets will not go through.
That's a reason why the standard defconf firewall, although it has a drop all from WAN rule, that rule has a special exception for connections that have been DSTNATed. This is the default defconf rule:
/ip firewall filter
add chain=forward action=drop connection-state=new connection-nat-state=!dstnat \
in-interface-list=WAN comment="defconf: drop all from WAN not DSTNATed"
What @CGGXANNX writes regarding the firewall is true. What he writes about always providing the address lists and interface lists together with firewall rules is doubly so - without them they are impossible to make sense of.
dst-nat changes (only) the destination address, therefore for your forward rules the packet is travelling 10.1.6.X -> 10.1.5.2.
Just an aside, in logs you'll see it as: 10.1.6.X -> (public-ip->10.1.5.2), thus highlighting the dst-nat action.
Luckily, the firewall has just the feature for you. When you dst-nat, you generally want to selectively allow whatever connection you've dst-natted. This can be accomplished by the filter rule: add chain=forward action=accept connection-nat-state=dstnat
Generally a good place to put this is right after the established/related rule.
EDIT: Again, @CGGXANNX's edit is correct. In the default ruleset this is done by an exception to the (only) drop rule. If you have a more complex ruleset, I find it better not to not drop it (add it as an exception to every drop rule), but instead to allow it explicitly.
Obviously I agree that the "add one rule" method is simpler (that's why I suggested it). Both would work correctly.
By add one rule, I mean add one rule. Don't delete existing ones, modify existing ones, or put your cat in the microwave. Add the one rule. In the suggested place.
(V35) Homelab -> LXC Containers is in services-lan and mdns-repeater, which means it's also in VLANS, safe-vlans, ros-management, and network-mngt.
(V60) IoT is in unsafe-vlans and mdns-repeater, which means it's also part of the VLANS list.
Looking at the filter forward rules, there's an explicit accept rule permitting from VLAN 35 to VLAN 60 (allow from <safe-vlans> to <(V60) IoT>), but no accept rule for the other direction (if we don't count the connection-state=established... rules). And there is the explicit drop rule "drop cross-vlan traffic" rule that blocks between the members of the VLANS list, this is where the packets from VLAN 60 to VLAN 35 are dropped.
rule and move it above the "drop cross-vlan traffic" rule.
Or you modify the "drop cross-vlan traffic" rule and add connection-nat-state=!dstnat as additional condition.
I agree with @lurker888, in this case the first solution with accept is better because you can have additional restrictions such as out-interface-list=services-vlans.