Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two identical storage hosts where the master is the only one the users can access. If the master fails, then I want to manually change the DHCP address, so instead of master points to it should point to

There are replication scripts that rely on IP addresses, so if the master changes IP address, then I have to modify the IP in the scripts, so the data is still replicated from the master to the slave.


It is quite an error prone task to switch IP adresses and edit scripts. Is there an common practice how this sort of manual failover is done? E.g. by adding an abstraction layer of some sort?

share|improve this question
Commonly competent sysadmins are used – Iain Jan 16 '14 at 10:38
up vote 13 down vote accepted

The common practice is to have a separate IP address and name for the service, one that is separate from the actual server's IP address and name.

In this case, you have


A third name could be


Your clients should use "storage" instead of "master" when they connect to the service.

As long as master is online, then should be a virtual interface on master. If master is down, bring up as a virtual interface on slave.

Avoid using IP addresses in scripts as far as possible. If DNS lookups aren't an option in a particular case, use a config file or the /etc/hosts files to map hostnames to IP addresses.

share|improve this answer
+100, if I could, for "avoid using IP addresses in scripts as far as possible". The troubles I've seen caused by that practice, over the years. – MadHatter Jan 16 '14 at 10:34
@MadHatter I see your script and raise you "hardcoded into binaries and lost the source code". I ended up editing the binaries in-place, replacing an IP address with a string that we resolved in /etc/hosts... That was a fun night. – Jenny D Jan 16 '14 at 10:38
I fold, mostly in admiration. – MadHatter Jan 16 '14 at 10:59
Admiration was not the feeling I was having... – Jenny D Jan 16 '14 at 11:01

If you would like a more automatic solution for failover then look at something like keepalived with uses the VRRP protocol.

More information can be found here

Virtual IP (This is a virtual IP address and is configured on both hosts)

Master IP

Slave IP

This way you will not have to bring up the second interface on the slave and you have very little (maybe a second or so ) of downtime.

share|improve this answer
This is automatic failover, which is not what I want. I use ucarp on other servers though. – Sandra Jan 16 '14 at 11:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.