Hello,
by Packet flow document https://help.mikrotik.com/docs/display/ROS/Packet+Flow+in+RouterOS, there is information that DST-NAT is included in PREROUTING chain and that prerouting chain is available in nat tables.
What I tried was based on layer7 protocol mark connection, based on this mark all packets and process specific dst-nat rule with marked packets
, since I found information that I can’t process dst-nat with layer7 filtering because only part of packet takes place.
However, dst-nat rules in dstnat chain are processed before prerouting rules. I don’t see any possiblity to set prerouting chain in winbox for dst-nat.
What I tried:
/ip firewall mangle add action=mark-connection chain=prerouting dst-port=80 layer7-protocol=MY_FILTER new-connection-mark=my_conn_mark passthrough=yes protocol=tcp
/ip firewall mangle add add action=mark-packet chain=prerouting connection-mark=my_conn_mark dst-port=80 new-packet-mark=my_packet_mark passthrough=no protocol=tcp
/ip firewall nat add action=dst-nat chain=prerouting dst-port=80 packet-mark=my_packet_mark protocol=tcp to-addresses=<some_internal_ip> to-ports=80
, but without success.
Note: counters for connection and packet marking were increasing, so I suppose they worked.
Any help is appreciated.
Thanks.