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

I have a situation where we have a server at a remote location. Its connection to the internet (say on ip 1.1.1.1) can be flaky so we have a backup connection on a different provider (say via ip 2.2.2.2). The first provider is way more economical, but when it goes down we would like to connect to that server through the second provider, who will charge for bandwidth use. The second provider is much more reliable but way more expensive.

I need to have a DNS entry to the remote server that typically points to 1.1.1.1 but can change to 2.2.2.2 as an alternative when the connection is no good or some other way of directing clients in the city to that remote server that goes through either connection reliably and invisibly to the client.

How might I approach this?

It seems like it might be solvable at the DNS level, but not with any of the technology I am aware of. What else might work?

share|improve this question
add comment

4 Answers

I need to have a DNS entry to the remote server that typically points to 1.1.1.1 but can change to 2.2.2.2 as an alternative when the connection is no good.

No, what you need is a means of bonding the two connections together. However, this is an inbound link aggregation system which is handled by BGP routes at each individual ISP. I am not aware of a means of weighting one over the other, however I'm not a peerless expert in this exact scheme. It wouldn't be surprising to me if you get a bit of a runaround with the flaky ISP concerning advertising BGP routes that allow you to have one IP address that is, in essence, floated between the two connections.

This is not a problem that DNS can solve (easily or reliably*). Let DNS be DNS, which is a simple key-value pair information storage and retrieval system. And before you ask, round robin will not help you either. =)

*Okay, okay, yes you can do some things that vaguely resemble inbound link balancing using DNS. It's evil and involves propagation delays as part of your SLA, and also relies on DNS admins to not mess with your records' TTL values, which is not a safe bet. I'm not even going to explain DNS failover here (or as I refer to it "DNS fauxover") because I don't think it's particularly reliable / professional, but I'll link to it and if the link dies for people in the future, there's no harm done because... it's evil. DON'T SAY I DIDN'T WARN YOU.

share|improve this answer
    
How could I bond them together behind a single IP when they are two different providers? Its probably not a DNS solution at all. I am completely open to any solution. –  Octopus Dec 12 '13 at 21:11
    
@Octopus It involves BGP and contacting your ISPs independently. –  Wesley Dec 12 '13 at 21:31
add comment

Create a hostname for this service. Have an A record for that hostname pointing to 1.1.1.1. Create an SOA record designating very short TTL, Refresh, and Expire times, so that changes to the A record will be picked up quickly.

Monitor the primary link, and if it goes down, publish a new A record pointing to 2.2.2.2.

As a more advanced version of this solution, use a monitoring tool to watch the two links and automatically swap in the appropriate DNS record based on server stability.

How this works depends on the technology stack used in your DNS server, but if you're running your DNS on a Unix or Linux server, you could use a monitoring tool like Nagios to swap zone files based on the results of a monitoring script.

share|improve this answer
    
im not sure you need to change times on the SOA, just the A record. –  Octopus Dec 12 '13 at 23:59
1  
Just to note, not all DNS servers across the internet honor TTL values, and even the best service that offers this kind of "DNS Failover" (Or as I call it "DNS Fauxover") will still cause downtime for the service. –  Wesley Dec 12 '13 at 23:59
    
@Wesley, you obviously don't like this solution, and it is certainly not something I'd suggest is high-availability-- but it is a form of failover, and it's clear from the context of the OP's question that BGP isn't going to be an option for them. –  davidcl Dec 31 '13 at 17:54
    
@Octopus, if you are changing TTL, refresh, or expire times, those settings live in the SOA record. The A record is what indicates the IP address to access; the SOA record tells other DNS servers to check for frequent changes to the records in this zone. –  davidcl Dec 31 '13 at 17:56
add comment

My suggestion would be automatic DNS failover. This way you can send the traffic to which ever datacenter that u want to send it to and if for any reason (network issue or HW failure) you will automatically failover to the other datacenter. You can see http://www.dnsmadeeasy.com/services/dns-failover-system-monitoring/ as an example.

share|improve this answer
add comment

You can always do DNS failover, but really what you should be doing is some kind of downstream load balancing. Failover is risky, and not really what DNS was designed for. There will be a certain amount of downtime as the new address is propagated. And you'll have to have a server that's just sitting idle.

If you've implemented some kind of load balancing, then both servers could serve traffic, and in the event that one went down, traffic would automatically go to the other.

share|improve this answer
    
But I don't think the OP has two servers, just two IP addresses leading to the same server via different pipes. I don't see how load balancing enters the picture. –  davidcl Dec 12 '13 at 21:33
    
@davidcl: That's the proper way to fail between two different IPs. Monkeying with the DNS will exacerbate problems. What if the first address starts going up and down due to some port flapping? You'd be pushing out a new DNS record over and over, and making the situation worse. –  Satanicpuppy Dec 12 '13 at 21:52
add comment

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.