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 server, (Server A) Windows Server 2003 that I was hosting some sites on. Now they are hosted on a different server (Server B). I recently switched the DNS at godaddy to point to the new nameservers.

Is there something I can do on Server A to point all requests to Server A to Server B (basically a redirect from Server A to B)? What type of record would that be?

This is while I'm waiting for the DNS changes I made to fully resolve.

edit

To further clarify.

test.com may still be resolving to Server A, I'd like a DNS record on Server A that tells it to go to the new server. Is that possible?

share|improve this question
    
Did you change DNS to point to new nameservers, or to new webservers (Server B)? –  Martijn Heemels Mar 11 '11 at 0:17
    
Server B is a linode vps box. So in godaddy I updated the nameservers to point to NS1.LINODE.COM etc. But while I'm waiting for it to resolve fully, I want anyone visiting mysite.com (if they go to Server A, the old one) to be redirected to Server B (the new one) –  jyoseph Mar 11 '11 at 0:33
    
I thought it'd be a matter of an A record with the IP address of the new server. But that might show how little I know. :/ –  jyoseph Mar 11 '11 at 0:33
add comment

4 Answers

up vote 2 down vote accepted

You can use a 301 redirect on your old server to point at your new one. There's no way to do this in DNS, but it will ensure that all traffic reaches the intended destination while your old records are still cached elsewhere.

share|improve this answer
add comment

There is no DNS records you can create that will do this. You will need to allow time for DNS change to propagate. Setting the TTL down to an hour or so for twice the old TTL (usually a couple days) before the change will speed the propagation significantly.

You could proxy the new server from the old server. Until the DNS changes propagate fully you will have some traffic on the old server. You could also look at doing DNAT on the firewall for the old server if all domains moved.

share|improve this answer
add comment

This is not possible via DNS since you cannot force the DNS client to talk to your DNS server. It may just use the cached record it already has. If you could force it to query, you might just as well return it the address of the new server.

Instead, you can configure your Server A to respond with a redirect to Server B for all requests. I'm, not familiar with Windows Server, but an Apache server could use the mod_rewrite module for this.

Another option is to install a reverse-proxy in Server A, replacing your webserver, that accepts all requests and fetches the pages from Server B. Server A then returns the answer to the client. We're using this exact solution to solve the same problem you're having. We wanted zero downtime while moving hundreds of sites to a new server.

You could easily set up an Nginx server or something similar as a reverse-proxy. Install it on an alternate port like 8000 and set it up to reverse-proxy to Server B. Test with http://ServerA:8000/ if the proxying works. Turn off the webserver on A, freeing port 80, and change the proxy to listen on port 80. It will now serve all incoming requests via Server B. After a while Server A will receive no more traffic, once the DNS records TTL expires and all clients directly query Server B.

share|improve this answer
    
So there is no simple way to a record for mysite.com that points to the IP address of the new site? Bummer. –  jyoseph Mar 11 '11 at 0:34
add comment

This is very simple if you have access to the DNS Server on server A.

Start -> administrator tools -> DNS

See screenshot for example. I'm guessing you have currently the A/CNAME IP as servera

Just change those IP to serverb :)

http://i.stack.imgur.com/iW2RD.png

share|improve this answer
    
If you read the OP, you'd know that he's already done this. His problem is that DNS servers outside of his control are caching his old A record longer than they should. –  MDMarra Mar 11 '11 at 0:42
    
no, that is not the problem. he says "I'd like a DNS record on Server A that tells it to go to the new server. Is that possible?" and YES, that is possible. –  Joshua D'Alton Mar 11 '11 at 0:45
    
it is called dns forwarding, and it will in fact work even if people have cached results. –  Joshua D'Alton Mar 11 '11 at 0:46
    
@Josh - "This is while I'm waiting for the DNS changes I made to fully resolve." That sure sounds to me like a caching issue and not a forwarding one, doesn't it? –  MDMarra Mar 11 '11 at 0:49
    
.... facepalm yes, he is waiting for his NAMESERVER update to change from servera to serverb. currently when a user does a query, it will use servera to give the result. hence, if servera has the records set as per my example, they will respond wrongly. –  Joshua D'Alton Mar 11 '11 at 0:54
show 3 more comments

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.