Howto Force route for specific host via primary wan link

Greetings all,
I have two dsl links wan links on my routerboard. both dsl modems are configured in Bridge mode and dialing is being done by pppoe-client from RB by pppoe-out1 and pppoe-out2.
I have configured a WAN monitor script which monitor Primary wan link by ping to 8.8.8.8. I have create fixed route in IP / ROUTE for 8.8.8.8 to always go via pppoe-out1, but when as soon as pppoe-out1 dialer disconnects, the ping to 8.8.8.8 works from pppoe-out2. in route I can even see that pppoe-out1 is Unreachable but still ping works probably from out2.

So how i FORCE 8.8.8.8 to always go from pppoe-out1 no matter what, if out1 is not working then it should give TIME out so that my monitor script should work fine.

Hi…

/ip firewall mangle
add action=mark-routing chain=prerouting dst-address=8.8.8.8 new-routing-mark=WAN1_route



/ip route
add distance=1 gateway=1.1.1.1 routing-mark=WAN1_route

change 1.1.1.1 with your WAN1 gateway

@ronix
when i run traceroute from mikrotik using both wan links, i see same gateway because Both wan links are from the same ISP thus have same gateway as well. so what to do now?

you can put a router with pppoe-out1 then send an ip to your mikrotik
this router will be your gateway as WAN1

we dont want to add another hop/router, dialing must be done via mikrotik. modems will act as bridge only.

any other solution?
I if I mark routing in OUTPUT chain it will solve my problem? because prerouting will be for client not router itself?

Can anyone please help ?

/ip route rule
add action=lookup-only-in-table dst-address=8.8.8.8/32 table=pppoe-out1

This will affect client traffic as well, unless you narrow it down with a src-address as well, but it is a way to force that destination to only ever use ppoe-out1. Otherwise what happens is if there is no active routes for ppoe-out1 is the routing lookup falls through to the main routing table.

Thank you for your reply Sir.
I will check and will let you know the results.

I created two static routes like this

/ip route
add disabled=no distance=1 dst-address=4.2.2.1/32 gateway=pppoe-out1 scope=30 target-scope=10
add disabled=no distance=1 dst-address=4.2.2.2/32 gateway=pppoe-out2 scope=30 target-scope=10

Now in ip > route > rules , i added rules like this

/ip route rule 
add action=lookup-only-in-table disabled=no dst-address=4.2.2.1/32 interface=pppoe-out1 table=pppoe_out1
add action=lookup-only-in-table disabled=no dst-address=4.2.2.2/32 interface=pppoe-out2 table=pppoe_out2

now for test purpose, I disabled pppoe-out2 , but still i can ping 4.2.2.2 (which is suppose to go via pppoe-out2 only)

any hint?

If I understand what you’re trying to do, maybe you could add a blackhole route for the same destination with a higher distance. When the lower distance one becomes unreachable, the blackhole route will become active. For example:

/ip route
add disabled=no distance=1 dst-address=4.2.2.1/32 gateway=pppoe-out1
add disabled=no distance=2 dst-address=4.2.2.1/32 type=blackhole
add disabled=no distance=1 dst-address=4.2.2.2/32 gateway=pppoe-out2
add disabled=no distance=2 dst-address=4.2.2.2/32 type=blackhole

Dear JJCinAZ,
It worked perfectly as I wanted :slight_smile: thank you so much brother.