Community discussions

MikroTik App
 
Michal82
just joined
Topic Author
Posts: 8
Joined: Mon Feb 17, 2014 4:35 pm

Auto connect to second provider

Tue May 20, 2014 9:51 am

Hi folks, i have one question, where i need help.

I have in input 2 internet providers - provider A is main internet, used 99% of time and provider B is backup internet connection. When i have connection A down, i must manually turn-off this connection in router router and turn-on connection B.

Question: How set it automatically? If connection A is OK, use it, if not, use connection B.
Snímek obrazovky 2014-05-20 v 8.43.07.png
Thank you very much.
You do not have the required permissions to view the files attached to this post.
My Mikrotik CCR1016-12G
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Posts: 947
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Auto connect to second provider

Tue May 20, 2014 10:27 am

Netwatch?
Christopher Diedrich
MTCNA, MTCUME, MTCWE
Basel, Switzerland
Bremen, Germany

There are 10 types of people: Those who understand binary and those who don't.
There are two types of people: Those who can extrapolate from incomplete data
 
Michal82
just joined
Topic Author
Posts: 8
Joined: Mon Feb 17, 2014 4:35 pm

Re: Auto connect to second provider

Tue May 20, 2014 10:54 am

I understand principle, but how i can it write?
My Mikrotik CCR1016-12G
 
bingo220
Member Candidate
Member Candidate
Posts: 124
Joined: Sun Sep 22, 2013 9:30 pm
Location: Ukraine

Re: Auto connect to second provider

Tue May 20, 2014 11:27 am

In the both interfaces uncheck "use-default-route"
next step:
simplest method http://wiki.mikrotik.com/wiki/Two_gateways_failover
the best method (for me) http://wiki.mikrotik.com/wiki/Advanced_ ... _Scripting
 
Michal82
just joined
Topic Author
Posts: 8
Joined: Mon Feb 17, 2014 4:35 pm

Re: Auto connect to second provider

Tue May 20, 2014 12:40 pm

In the both interfaces uncheck "use-default-route"
A.) please, could you write me how do?
B.) I want use this metode, but i will need some helps: http://wiki.mikrotik.com/wiki/Advanced_ ... _Scripting

1.)
/ip route
add dst-address=www.google.com gateway=GW1 scope=10
add dst-address=www.bing.com gateway=GW2 scope=10
2.)
/ip route
add distance=1 gateway=www.google.com routing-mark=WAN1 check-gateway=ping
add distance=2 gateway=www.bing.com routing-mark=WAN1 check-gateway=ping
3.)
/ip route
add distance=1 gateway=www.bing.com routing-mark=WAN2 check-gateway=ping
add distance=2 gateway=www.google.com routing-mark=WAN2 check-gateway=ping

I have it OK for my setting, or i can do some changes?
My Mikrotik CCR1016-12G
 
bingo220
Member Candidate
Member Candidate
Posts: 124
Joined: Sun Sep 22, 2013 9:30 pm
Location: Ukraine

Re: Auto connect to second provider

Tue May 20, 2014 1:59 pm

Both my ISP use a PPPoE connections.
PPPoE automatically adds the default-route. Because of it I need to disable this (uncheck "use-default-route").
If your connections is not added the default-route, you can skip this step.

I suggest you start with a simple method http://wiki.mikrotik.com/wiki/Two_gateways_failover

In second method you have to use:
1) GW has to be ONLY IP.
2) You have to add static route for each ping-hosts by needed ISP.
etc.
 
Michal82
just joined
Topic Author
Posts: 8
Joined: Mon Feb 17, 2014 4:35 pm

Re: Auto connect to second provider

Tue May 20, 2014 2:16 pm

But i read that this simply metod is not reliable.
My Mikrotik CCR1016-12G
 
bingo220
Member Candidate
Member Candidate
Posts: 124
Joined: Sun Sep 22, 2013 9:30 pm
Location: Ukraine

Re: Auto connect to second provider

Tue May 20, 2014 3:13 pm

Many people use it and do not complain :)
Just try it.
Ok, I'll try explain about second method.

Make sure that your internet-connections don't use "Add default route".
To avoid problems, use the public DNS on the router, like 8.8.8.8.
Choose four ping-hosts for check an internet accessibility (2 hosts for each ISP).
Those addresses will be available only through one of the ISPs.
While the router can ping at least one of the two hosts this route is enabled, otherwise, the route turns off.
My choice is four stable public NTP servers.
You can find here http://support.ntp.org/bin/view/Servers ... imeServers
For example:
1) 212.82.32.15
2) 198.153.152.52
3) 204.123.2.72
4) 209.81.9.7

Further, we have to use an ip-address in the GW of each ISP.
Suppose GW of my ISP1 = 101.x.x.1
and GW of my ISP2 = 202.x.x.2

Create static routes.
/ip route
add dst-address=212.82.32.15 gateway=101.x.x.1 scope=10 comment="Static PING way by ISP1-host1"
add dst-address=198.153.152.52 gateway=101.x.x.1 scope=10 comment="Static PING way by ISP1-host2"
add dst-address=204.123.2.72 gateway=202.x.x.2 scope=10 comment="Static PING way by ISP2-host1"
add dst-address=209.81.9.7 gateway=202.x.x.2 scope=10 comment="Static PING way by ISP2-host2"
Create a virtual hops.
It has to be different of your LAN. Just invented addresses.
I use 10.10.1.1 and 10.10.2.2
/ip route
add dst-address=10.10.1.1 gateway=212.82.32.15 scope=10 target-scope=10 check-gateway=ping distance=1 comment="Virtual host for ISP1-host1"
add dst-address=10.10.1.1 gateway=198.153.152.52 scope=10 target-scope=10 check-gateway=ping distance=2 comment="Virtual host for ISP1-host2"
add dst-address=10.10.2.2 gateway=204.123.2.72 scope=10 target-scope=10 check-gateway=ping distance=1 comment="Virtual host for ISP2-host1"
add dst-address=10.10.2.2 gateway=209.81.9.7 scope=10 target-scope=10 check-gateway=ping distance=2 comment="Virtual host for ISP2-host2"
Create default routes.
Route with distance=1 will be primary.
/ip route
add distance=1 gateway=10.10.1.1 comment="Default route to WAN1"
add distance=2 gateway=10.10.2.2 comment="Default route to WAN2"
 
User avatar
hossain2004a
Member Candidate
Member Candidate
Posts: 247
Joined: Mon Dec 22, 2014 7:34 pm
Location: Iran

Re: Auto connect to second provider

Tue Jan 13, 2015 7:09 pm

It's good, but when pingnig from mikrotik tools i would have some "timeouts" beside other pings, why?
add dst-address=4.2.2.4 gateway=192.168.20.3 scope=10 comment="Static PING way by ISP1-host1"
add dst-address=4.2.2.5 gateway=192.168.20.3 scope=10 comment="Static PING way by ISP1-host2"
add dst-address=4.2.2.6 gateway=192.168.30.3 scope=10 comment="Static PING way by ISP2-host1"
add dst-address=4.2.2.8 gateway=192.168.30.3 scope=10 comment="Static PING way by ISP2-host2"
add dst-address=10.10.1.1 gateway=4.2.2.4 scope=10 target-scope=10 check-gateway=ping distance=1 comment="Virtual host for ISP1-host1"
add dst-address=10.10.1.1 gateway=4.2.2.5 scope=10 target-scope=10 check-gateway=ping distance=2 comment="Virtual host for ISP1-host2"
add dst-address=10.10.2.2 gateway=4.2.2.6 scope=10 target-scope=10 check-gateway=ping distance=1 comment="Virtual host for ISP2-host1"
add dst-address=10.10.2.2 gateway=4.2.2.8 scope=10 target-scope=10 check-gateway=ping distance=2 comment="Virtual host for ISP2-host2"
add distance=1 gateway=10.10.1.1 comment="Default route to WAN1"
add distance=2 gateway=10.10.2.2 comment="Default route to WAN2"
Image

My DNS: 4.2.2.4 , 4.2.2.8
anything wrong bingo220?
 
bingo220
Member Candidate
Member Candidate
Posts: 124
Joined: Sun Sep 22, 2013 9:30 pm
Location: Ukraine

Re: Auto connect to second provider

Tue Jan 13, 2015 10:18 pm

hossain2004a, I have no ping problem (just checked).
Try to use the other hosts.
I think public NTP servers are good choice.

Who is online

Users browsing this forum: jparis and 113 guests