Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I specifically looked up how to do something like this ( Can you set a backup ip for your server in DNS? ) and the answer basically was you can't. If i say specify 2 ip addresses could i somehow use a HTTP response header to ignore it temporary (say 5mins) and go to the other IP address? Or maybe i can play dead however i'm unsure how to play dead using nginx. I then would like to be available after my box notice the other box is down and be some kind of readonly server.

I'm sure something like this has been implemented i am just wondering how i might implement it with 2 boxes. I'm sure it isn't very difficult? How might i redirect traffic from a backup box to my main server without modifying the DNS?

share|improve this question

1 Answer 1

How might i redirect traffic from a backup box to my main server without modifying the DNS?

It's not possible.

I specifically looked up how to do something like this (http://serverfault.com/q/292625/274) and the answer basically was you can't

Unfortunately, that answer is correct. The best you can have is a normal HTTP redirect, but the server that is dead must be up in order to issue that redirect.

Essentially, you need to understand how the process works:

  1. Client looks up (via DNS) the IP(s) associated with example.com
  2. It uses the first one, and caches it (DNS servers won't return IPs in the same order every time, they use round robin)
  3. The client attempts to open a connection to that IP, on port 80. If it's dead, it's dead. Client gives up.

You are looking for a method that, after the client gives up, they are 'notified' of a new IP they should try. There's simply no way to do this: the server that is supposedly dead must be up in order to issue the information that it should redirect elsewhere.

The way the DNS methods work is that the bad server is taken out of the DNS pool, so clients don't receive it. They also set the cache time to low, so when the user hits refresh, they are likely given a new IP.

share|improve this answer
    
Cache? Do you mean TTL? –  acidzombie24 Jul 11 '12 at 20:28
    
Yes - how long it caches it for depends on the TTL that the server specifies. –  Jay Jul 11 '12 at 20:28

Your Answer

 
discard

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.