Hello everyone!
I'm facing some challenges with a MikroTik configuration that involves dual WAN connections and HTTPS access. My goal is to allow access to HTTPS (port 443) through two different links (pppoe-FBNET and pppoe-GOLDEN) and ensure that return traffic exits through the same interface it entered on.
Current Problem:
I’m setting up connection and routing marks to ensure connections enter and exit through the same link.
In some cases, outgoing traffic fails to find the correct interface and shows out: (unknown 0).
I noticed that adding connection-mark=no-mark in the mangle rules can help maintain routing consistency, but I still encounter issues in certain scenarios.
Current Configuration:
NAT Rules:
/ip firewall nat
Masquerade for outgoing traffic on each WAN interface
add chain=srcnat out-interface=pppoe-FBNET action=masquerade comment="Masquerade for outbound FBNET"
add chain=srcnat out-interface=pppoe-GOLDEN action=masquerade comment="Masquerade for outbound GOLDEN"
Destination NAT to redirect RDP traffic to the internal server
add action=dst-nat chain=dstnat dst-port=443protocol=tcp to-addresses=192.168.50.30 comment="NAT RDP for FBNET"
add action=dst-nat chain=dstnat dst-port=443 protocol=tcp to-addresses=192.168.50.30 comment="NAT RDP for GOLDEN"
Mangle Rules with Connection Mark:
/ip firewall mangle
Mark connections entering via FBNET only for new connections
add chain=forward in-interface=pppoe-FBNET connection-mark=no-mark action=mark-connection new-connection-mark=FBNET_conn passthrough=yes comment="New connection mark for FBNET"
Mark connections entering via GOLDEN only for new connections
add chain=forward in-interface=pppoe-GOLDEN connection-mark=no-mark action=mark-connection new-connection-mark=GOLDEN_conn passthrough=yes comment="New connection mark for GOLDEN"
Route mark for outbound traffic via FBNET using connection marks
add chain=prerouting connection-mark=FBNET_conn action=mark-routing new-routing-mark=to_FBNET passthrough=no comment="Routing mark for FBNET"
Route mark for outbound traffic via GOLDEN using connection marks
add chain=prerouting connection-mark=GOLDEN_conn action=mark-routing new-routing-mark=to_GOLDEN passthrough=no comment="Routing mark for GOLDEN"
Routing Rules with Marking:
/ip route
Primary and backup routes in the main routing table
add dst-address=0.0.0.0/0 gateway=pppoe-FBNET distance=1 check-gateway=ping comment="Primary route for FBNET"
add dst-address=0.0.0.0/0 gateway=pppoe-GOLDEN distance=2 check-gateway=ping comment="Backup route for GOLDEN"
Marked routes to ensure return traffic exits via FBNET
add dst-address=0.0.0.0/0 gateway=pppoe-FBNET distance=1 routing-mark=to_FBNET comment="Return route for FBNET traffic"
Marked routes to ensure return traffic exits via GOLDEN
add dst-address=0.0.0.0/0 gateway=pppoe-GOLDEN distance=1 routing-mark=to_GOLDEN comment="Return route for GOLDEN traffic"
Notes:
When I remove the marks, traffic flows through the primary link, and NAT works fine, but with the marks in place, routing does not work as expected.
I'm open to any suggestions on how to reliably enforce routing for inbound and outbound traffic on the same link with marking, without facing the out: (unknown 0) issue.
Thanks a lot for any help or ideas!