Routing by destination port

I want to choose a particular WAN interface to be used for calls to particular destination ports in internet.

In a rule like :

chain=prerouting action=mark-routing new-routing-mark=to_WAN3 protocol=tcp dst-port=8888

shoud I specify addresses not belong to my lan subnet ? i.e. add **dst-address=!192.168.1.0/24 ** (my LAN)

Thank you

That would work - you could also exempt your local networks from all policy routing with a route rule:

/ip route rule add dst=192.168.0.0/16 action=lookup-only-in-table table=main

I mean, the rule

chain=prerouting action=mark-routing new-routing-mark=to_WAN3 protocol=tcp dst-port=8888

is it processed also when a packet comes from a LAN machine to a LAN machine (so connection fails because routed to WAN3) ??

I have just checked LAN to LAN connection on port 8888 works despite that mangle rule exists, any thought ??

If your definition of LAN to LAN is two hosts on the same subnet, then no, the rule won’t touch that traffic. The traffic never even makes it to the router.