Need script to failover to servers

Hope I have posted this in the appropriate space.
I am a complete beginner to networking basics and have only had a crash course recently in order to accomplish some tasks at work (I am but a lowly intern, please be gentle). I am attempting to setup RouterOS to accomplish some basic failover between two servers.

Network traffic will be redirected to a default server, and in the case of a failure on the main server traffic will then be redirected to the backup (failover).

I have considered BGP, OSPF, and RIP - but I am not sure if there is a much simpler means of accomplishing my task. I thought I found a simple command to complete in RouterOS found here: http://wiki.mikrotik.com/wiki/Two_gateways_failover. I am just not totally sure of how to proceed.

Any advice or directions would be immensely appreciated.


(Note: I am using a VirtualBox environment to test the functionality of RouterOS and am using basic Debian VMs as my servers and a client that will try and ping the servers to test the failover function)
routos.JPG

I apologize again, the servers’ IP addresses are the same for this scenario

Your scenario doesn’t relate to routing and gateway failover.

To fail over to a different IP address on the same network you have to rewrite the destination address of the packet as it passes through the router.

/ip firewall add chain=dstnat dst-address=192.168.20.2 action=dst-nat to-address=192.168.20.3 src-address-type=!local disabled=yes comment=mememepickme

Then make a NetWatch script that monitors .2 via ICMP and runs this on down:

/ip firewall nat enable [/ip firewall nat find comment=mememepickme]

And this on up:

/ip firewall nat disable [/ip firewall nat find comment=mememepickme]

But this is a poor solution and shouldn’t be done on the router at all (or at least should be done on a router intended to function as a load balancer, which RouterOS is no). Use VRRP or whatever Microsoft calls the fencing/HA technology built into Windows depeding on the OS you want to service when in production, or use a dedicated HA appliance. A router pinging stuff does not make for good failover. You want something that keeps state across application layer services on the server.

The servers in this scenario have the same IP address. Sorry for the confusion, I attached a new picture. I am told that they cannot be changed due to business practice. Are you saying that using RouterOS is inappropriate for this problem? I was simply tasked with using this software to try and create the failover protocol - so I started working on it.
routos.JPG

If they share the same IP address via some sort of failover protocol I don’t see how the router is involved at all. The router simply delivers a packet to a same subnet host whose IP address it resolves to a MAC address via ARP. It is up to the severs to implement whatever HA technology they use to have them take over each other’s virtual IP address. The router doesn’t know or care that there is a failover machine that can take over.

If you need to from scratch create some layer 2 failover between devices that are not the routers themselves then yes, RouterOS is not a suitable software to solve the task.

The solution will most definitely not involve any routing protocols such as BGP, RIP, or OSPF. The router and servers are directly connected on a broadcast network, so routing has nothing to do with the task at hand.

What type of software or device would I be looking for then?

Ideally either a dedicated load sharing appliance made for this purpose, or a fencing technology built into the OS (BSD/Linux/Win2k8+ all support this kind of thing natively).

Ok. Thank you very much.

I was intrigued by the term “fencing technology built into the os” , if it does not require another fencing device such as https://access.redhat.com/articles/28603

may be associated with this problem http://forum.mikrotik.com/t/mikrotik-as-fencing-device-fiber-ch-switches-on-ha-cluster/67217/1