Mark traffic on wan interface

Hi,

i have wan links on mirkotik, two links with static ip, and the third is pppoe (dynamic ip), default route is over pppoe. what i want is when something came to mirkotik on WAN1 or WAN2 i want that that traffic is going back the same side its came. i did some mangle and routing mark, nad when i connect to mirkotik on WAN2 it returns traffic on WAN2 (thats good), when i trying to connect to some device behind the nat doesnt work, connection failed.

Some example how to setup marking on WAN interface so that all traffic is going the same way back?

Thanks

I alos try this

http://home.swkls.org/mikrotik-dual-wan-routing-packet-flow/

but device which i want reach (dst-nat) doesnt work, its working only if traffic is for mikrotik, not some forward to local device behind it

These are marked in the input chain which is traffic to only the router. You need to mark things in prerouting for traffic through the router.

http://wiki.mikrotik.com/wiki/Manual:Packet_Flow

Try this instead.

http://wiki.mikrotik.com/wiki/Manual:PCC#Policy_routing

Hi,

thanks for the reply

i already take a look your link, i see that that example is using PCC for marking local trafiic, which will load balancing local traffic through two links.

in my situation i need that all local traffic is go outisde through WAN3 (pppoe), no need for PCC (i think), only trafffic which is coming on WAN1/WAN2 is going back through that interfaces (for both kind od the traffic, which is coming to mkt (input) and for traffic which is coming through WAN1/WAN2 and is forward to local ip->and go back through the same interface WAN1/WAN2)

any example for that scenario?


Thanks

picture in the attach
picture.png

Your right you don’t want to use PCC. But you do the same thing minus the rules which use the pcc classifier for policy routing.

Hi,

i follow the example and it seems that everything is working fine now, thanks :slight_smile:

Just one thing, i will have mail server in LAN at it must be bind with WAN2 ip address (because mx record, srv record), it will be enough to put one rule on the top of the mangle?

src-address=ip_of_mail_server src-port=25,110… (only mail traffic must be policy route)… mark routing new routing mark=mail_server and add route with that routing mark

Thanks

If you used the correct mangle rules you shouldn’t need to change anything in mangle. Post /export compact if you would like me to check.

What i ask post above is, when local traffic is going through the internet (there isnt any marking, not using PCC), traffic will go through WAN3 (pppoe-defulat route), but one of the server is mail server and it must be use WAN2 as his default gateway. Mark routing in mangle will do the trick? mangle prerouting by src address and src ports (25,110..), and add default route for that routing mark to go via WAN2, while the rest of the traffic will still go through pppoe