Community discussions

MikroTik App
 
cicserver
Member
Member
Topic Author
Posts: 303
Joined: Sun Jul 24, 2011 12:04 pm

Howto Force route for specific host via primary wan link

Sun Sep 13, 2015 11:03 am

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.
 
ronix
Member Candidate
Member Candidate
Posts: 151
Joined: Thu Nov 17, 2011 6:51 pm

Re: Howto Force route for specific host via primary wan link

Sun Sep 13, 2015 1:15 pm

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
 
cicserver
Member
Member
Topic Author
Posts: 303
Joined: Sun Jul 24, 2011 12:04 pm

Re: Howto Force route for specific host via primary wan link

Sun Sep 13, 2015 1:45 pm

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?
 
ronix
Member Candidate
Member Candidate
Posts: 151
Joined: Thu Nov 17, 2011 6:51 pm

Re: Howto Force route for specific host via primary wan link

Sun Sep 13, 2015 6:31 pm

you can put a router with pppoe-out1 then send an ip to your mikrotik
this router will be your gateway as WAN1
 
cicserver
Member
Member
Topic Author
Posts: 303
Joined: Sun Jul 24, 2011 12:04 pm

Re: Howto Force route for specific host via primary wan link

Mon Sep 14, 2015 6:40 am

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?
 
cicserver
Member
Member
Topic Author
Posts: 303
Joined: Sun Jul 24, 2011 12:04 pm

Re: Howto Force route for specific host via primary wan link

Tue Sep 15, 2015 8:24 am

Can anyone please help ?
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Howto Force route for specific host via primary wan link

Tue Sep 15, 2015 6:59 pm

/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.
 
cicserver
Member
Member
Topic Author
Posts: 303
Joined: Sun Jul 24, 2011 12:04 pm

Re: Howto Force route for specific host via primary wan link

Wed Sep 16, 2015 6:57 am

/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.
 
cicserver
Member
Member
Topic Author
Posts: 303
Joined: Sun Jul 24, 2011 12:04 pm

Re: Howto Force route for specific host via primary wan link

Wed Sep 16, 2015 8:50 am

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?
 
JJCinAZ
Member
Member
Posts: 475
Joined: Fri Oct 22, 2004 8:03 am
Location: Tucson, AZ

Re: Howto Force route for specific host via primary wan link

Thu Sep 17, 2015 8:03 am

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
 
cicserver
Member
Member
Topic Author
Posts: 303
Joined: Sun Jul 24, 2011 12:04 pm

Re: Howto Force route for specific host via primary wan link

Thu Sep 17, 2015 8:46 am

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 :) thank you so much brother.

Who is online

Users browsing this forum: DanMos79, eworm, Marc1963, sindy and 38 guests