2

I have a subdomain whose DNS A Record I would like to change. After doing this, do I have to wait for some time before the change will be reflected?

If yes, during the downtime is it possible to put up a "downtime message" to users visiting the just edited subdomain?

5 Answers 5

5

When changing DNS it takes some time for the changes to propagate throughout the Internet. Depending on your ISP/location it can take as little as a few seconds to 48 hours.

You could use the old IP to set up a temporary webserver to notify your users of the pending DNS update and forward them to a newly create subdomain that also points to the new IP. These usually propagate faster.

Once the DNS adjustments have propagated users will automatically be directed towards the new IP. When the temporary server doesn't get any more request, you can be sure the process is done.

Changing Servers AND IPs:
1.2.3.4 = old ip
1.2.3.5 = new ip
Move everything you need to move.

Start:

mydomain.com.       A     1.2.3.4

Changes to:

mydomain.com.       A     1.2.3.5
new                 A     1.2.3.5

Change the webserver at 1.2.3.4 to display a splash page that forwards to new.mydomain.com.

Changing IP on the same server:
If you don't change servers, just IPs, change the virtual host to listen on both IPs and change the A-record. Users will slowly start using the new IP as the DNS propagation takes place.

NameVirtualHost 1.2.3.4
NameVirtualHost 1.2.3.5

<VirtualHost 1.2.3.4 1.2.3.5>
    DocumentRoot /www/mydomain.com
    ServerName server.mydomain.com
    ServerAlias server
</VirtualHost> 
6
  • Based on what you said, I plan to add a new virtual host entry with the new ip address directly on top of the virtual host entry with the old ip address. Is this okay?
    – Jeune
    Nov 8, 2011 at 10:32
  • If you are not moving servers, there is no need to do it as told above. Just make one vhost listen on 2 IP's, change the A-record and don't worry about it. Nov 8, 2011 at 10:35
  • How do I make a virtual host listen to two ipaddresses? Do I just put two ipaddresses inside the <VirtualHost ...> tag like this <VirtualHost 1.1.1.1:80 2.2.2.2:80>?
    – Jeune
    Nov 8, 2011 at 10:39
  • That's indeed how it's done :-). Nov 8, 2011 at 10:40
  • 1
    It can take vastly longer than 48 hours if you have a high TTL set on the record. A commonly given figure is twice the TTL at the time of the change, assuming that any previous change to the TTL has had time to fully propagate. It's usually a good idea to lower the TTL ahead of time if you know you will be making changes.
    – user
    Nov 8, 2011 at 13:14
5

Yes, there is a propagation delay for DNS changes because of the way they are cached. The length of the delay is controlled by the TTL ("Time To Live") value for the record. If you have not explicitly set it to something else then it will be something between 3 and 24 hours depending on your registrar. Some registrars allow you to change the TTLs (and if you host your own DNS you have full control) though be aware that the change in TTL will take up to the old TTL's length to propagate.

To find out what your TTLs are set to, check if your registrar's control panel displays it. If not, then create a new sub-domain A record and run dig sub.domain.tld. In the output you will get something like the following:

;; ANSWER SECTION:
sub.domain.tld.      3600     IN      A       11.22.33.44

This shows that the TTL value is an hour (3,600 seconds). If you do it again a minute later you should see:

;; ANSWER SECTION:
sub.domain.tld.      3540     IN      A       11.22.33.44

which means your local DNS cache will now recheck the value no sooner than in 59 minutes time.

By using a new sub-domain like this you know that the value is not already cached so you see the full TTL when you first query. dig is available in just about every Linux setup (if it is not installed you will usually find it in the package "dnsutils") and is available for Windows via Cygwin (if you don't want a fuller Cygwin install, you could try partial copies like this one that includes just dig, host and whois.

One thing to remember is that if a user's DNS cache has not recently been asked about that particular name they will get the new value immediately on the next request so a TTL of two hours, so for the duration of the propagation period you should expect requests to both IP addresses.

If you control the machine pointed to by the old IP address and it does not run any other web sites, you could install a redirector like rinetd to proxy connections to the new address. That way even people going to the old address will see the content from the new server (just a bit slower). If there are other domains hosted there you could use mod_proxy (or your web server's equivalent) to achieve the same end. Though if the propagation period is short enough, you could replace all pages for that site on that server with a "the site will be back within X hours" message which is obviously easier.

Alternatively, you could set the TTL very short a day or two before the change - that way the propagation delay will be short anyway. I actually have my TTLs permanently set to five minutes. Don't set it too short: technically a TTL of 0 should mean "never cache this value" but some buggy DNS caches and client software will ignore anything below a certain value and assume something higher instead.

3

yes, DNS propagation can from few seconds to few hours (depending upon your geographic location and the DNS servers in your area. you cannot put message of downtime, as it will only be shown, if your A record has been successfully propagated to every dns in world. One thing you can do is that, just dont disable the old server yet, as the site should be UP from both servers unless the A record is properly populated.

to verify the dns resolution, take list of public DNS servers from internet and run this command:

nslookup yoursite.com 8.8.8.8 <--google dns

nslookup yoursite.com 4.2.2.6 <-verizon dns

this way, keep checking on random dns servers.

2
  • "just don't disable the old server yet" --- so I will have two servers with two different ip addresses but hosting the same content while the dns is being propagated?
    – Jeune
    Nov 8, 2011 at 10:34
  • so I will have two servers with two different ip addresses but hosting the same content while the dns is being propagated?..Answer is YES. but be careful, as you can loose updates to your sites(if it is dynamic site)..
    – Farhan
    Nov 8, 2011 at 10:45
2

When you change a DNS A record it takes time for this change to be reflected across the wider internet. It is usually stated that this can take up to 48 hours although it can take considerably longer.

If you have access to change the TTL of the domain, I would suggest doing so as this may help the changes be seen quicker.

What I would do is put a message on the old server telling people that the site is moving and when it is going to happen. Also give them some way to contact you if they can't after 48 hours get the new site.

1

If you are planning to this in the future, lower the TTL of the A-record in advance.
It will still not be instantly changed everywhere, so expect a time frame in which both IPs will be accessed.

If you are still owning the old IP you can display a message, proxy the request, etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .