Community discussions

MikroTik App
 
jamthejame
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Mon Jan 15, 2018 12:12 pm

Host1A & Host1B Dual Failover - Need clarity

Sat May 05, 2018 3:21 am

Members and Gurus',

This got me good, so i deserve to be laughed on, however, i'll endure the embarrassment for knowledge:

Doing multi host failover, used this link https://wiki.mikrotik.com/wiki/Advanced ... asic_Setup . Now on host checking per Uplink where:
/ip route
add dst-address=Host1A gateway=GW1 scope=10
add dst-address=Host1B gateway=GW1 scope=10
add dst-address=Host2A gateway=GW2 scope=10
add dst-address=Host2B gateway=GW2 scope=10
"Host", I tried putting 'domain names' instead of just IP, but it wont work. From what i remember, its not possible, am I correct? If so, please help me undertand.

Also,
/ip route
add dst-address=10.1.1.1 gateway=Host1A scope=10 target-scope=10 check-gateway=ping
add dst-address=10.1.1.1 gateway=Host1B scope=10 target-scope=10 check-gateway=ping
It says Host1A as dst-address and now gateway..... plus what is this 10.1.1.1 dst-address?

I understand its probably basic etc, however, cementing your understand goes a long way. So I hope one of you kind people can help me understand.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22387
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Host1A & Host1B Dual Failover - Need clarity

Sat May 05, 2018 3:51 am

I wrote this one up the other day, lets see how close it is..........
The first block of code identifies the hosts being used for ping testing and through which gateway.
What this will do is monitor that the external hosts used are pingable through the gateways.
The second block of code tells the router the order in which to check hosts.........
The third block tells the router to use the primary WAN first.

For example if Google is down from ISP1, the router will check OPENDNS from gateway1, if that is also down, the router
will check gateway2 for google and if not working then OPENDNS from gateway2
If the hosts are available on gateway2, the router will use that for traffic until gateway1 comes back up on either opendns or google.
I did it this way because I was sceptical of people stating pinging the gateway was not good enough so I respond what if google servers are down LOL.......
First Block
/ip route
 add dst-address=Host1(8.8.8.8) gateway=gatewayIP (of primary ISP)
 add dst-address=Host2(208.67.222.222) gateway=gatewayIP (of primary ISP)
 add dst-address=Host3(8.8.4.4) gateway=gatewayIP (of secondary ISP)
 add dst-address=Host4(208.67.220.220) gateway=gatewayIP (of secondary ISP)
Second Block
 /ip route
 add distance=1 gateway=Host1(8.8.8.8) check-gateway=ping
 add distance=2 gateway=Host2(208.67.222.222) check-gateway=ping
 add distance=3 gateway=Host3(8.8.4.4) check-gateway=ping
 add distance=4 gateway=Host4(208.67.220.220) check-gateway=ping
Third Block
/Ip route
 add destination=0.0.0.0/0 gateway IP (ISP Primary) distance=1
 add destination= 0.0.0.0/0 gateway IP(ISP Secondary) distance=2
 
jamthejame
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Mon Jan 15, 2018 12:12 pm

Re: Host1A & Host1B Dual Failover - Need clarity

Sat May 05, 2018 3:15 pm

Thank anav for response. Also, the question about IP and domain name still stands, is there a way to use domain name for pinging?

Also, what does dst-address= in the context mean, given the example?
/ip route
add dst-address=10.1.1.1 gateway=Host1A scope=10 target-scope=10 check-gateway=ping
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22387
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Host1A & Host1B Dual Failover - Need clarity

Sat May 05, 2018 4:20 pm

I dont know how the router will react to a host name there, (not sure if there is time/room or automation in terms of DNS resolving it).
In any case we want to check specific know sites (and as per the example two diff IPs for each site).

As far as that rule goes..............
The only one should put in a destination IP is one knows specific traffic needs to get there.
For example I use my WAN1 and only WAN2 on failover but my emails are on WAN2.
/IP Route
destination=IPofmymailserver gateway=gatewayIP_of_WAN2 etc.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11362
Joined: Mon Dec 04, 2017 9:19 pm

Re: Host1A & Host1B Dual Failover - Need clarity  [SOLVED]

Sat May 05, 2018 7:17 pm

Doing multi host failover, used this link https://wiki.mikrotik.com/wiki/Advanced ... asic_Setup.

Now on host checking per Uplink where:
/ip route
add dst-address=Host1A gateway=GW1 scope=10
add dst-address=Host1B gateway=GW1 scope=10
add dst-address=Host2A gateway=GW2 scope=10
add dst-address=Host2B gateway=GW2 scope=10
"Host", I tried putting 'domain names' instead of just IP, but it wont work. From what i remember, its not possible, am I correct? If so, please help me undertand.
Use of DNS name here would be a bit of a chicken and egg problem, because to resolve the DNS name into an IP address, the router would have to first send a DNS query packet to the IP address of a DNS server, and to do that, it would have to choose a working gateway to send that query. So it makes sense to use DNS servers' IP addresses as the monitored remote destinations directly; also because DNS servers operated by large companies are usually highly available, and because the IP addresses of DNS servers are among the very few ones which do not change.

/ip route
add dst-address=10.1.1.1 gateway=Host1A scope=10 target-scope=10 check-gateway=ping
add dst-address=10.1.1.1 gateway=Host1B scope=10 target-scope=10 check-gateway=ping
It says Host1A as dst-address and now gateway..... plus what is this 10.1.1.1 dst-address?

I understand its probably basic etc, however, cementing your understand goes a long way. So I hope one of you kind people can help me understand.
This is called recursive gateway and I cannot remember seeing this approach anywhere else except Mikrotik, but there's a lot of things I haven't seen aĺthough they do exist :-)

The idea is the following: if the IP address of a route's gateway is not in any directly connected subnet of the router, it means it is an indirect route. So you take the IP address of the gateway and find a route for it. And you repeat this process recursively until you finally find a gateway which is in a directly connected subnet, and use its MAC address to deliver the packet.

If, at some stage of the recursion, you find a route which is currently not available (does not respond to ping) and has no alternative, the whole recursive route becomes unavailable.

When checking whether a WAN interface "works", it makes sense to check that by pinging an IP address (device) somewhere far away in the internet - because if your ISP has a problem, you may be able to ping his gateway router next to you but your packets wouldn't get anywhere further through that gateway. On the other hand, if you would monitor this way just a single remote IP address, the availability of the WAN's gateway would depend on availability of a single external monitored address, so a failure of that monitored address would render that WAN unusable although in fact it would work fine. So you use a two-level recursion - for each WAN interface, you use two monitored addresses as primary and secondary route through the same physical gateway of that WAN interface for some auxiiliary private address you won't ever need to send a packet to, and then you use the auxiliary address as the recursive gateway through that WAN for all other routes.

You could simply use four routes with different priority, two of them via WAN1 and the other two via WAN2, but that would only make sense if a plain failover would be sufficient for you, i.e. you would use WAN1 for everything as long as it would be available, and only use WAN2 if WAN1 would not available. But you often need more complex uses, such as load distribution between the WANs as long as both are available, routing to some destinations or for non-VIP local sources via one of the WANs only, not using the backup one for these clients or destinations even if the primary one becomes unavailable etc. So in these cases, you create one recursive gateway per each WAN using the auxiliary address, and you build your policy routing atop these recursive routes.