RSS

How to Speed Up DNS Propagation

18 Jul

When migrating web host to a different hosting service’s server or modifying the server’s IP address, the most important consideration to guarantee to retain availability of the websites hosted on the server, minimize the downtime of the web sites, avoid strange troubles such as emails get delivered to either server randomly, or surfing at old server, is how fast DNS (Domain Name System) will be able to read or resolve hostname or domain name into your new IP address, rather than the old IP address. Unluckily, webmasters have limited ability to control or override the DNS propagation process. However, there are still a few tips, tricks and workarounds that guarantee DNS cache will refresh the new IP addresses as soon as possible.

DNS acts in such as aside that when a request for IP address received by DNS resolver, it will then query the root hosts to find the authorized server with detailed knowledge of the specific domain name. If a valid IP address for the domain is returned by the authoritative server, the DNS resolver will cache the DNS propagation for a given time period called TTL (Time To Live) after a successful reply, in what called DNS caching in order to reduce the load on particular DNS server. DNS caching provides resolution of domain name to IP to happen locally using the cached information rather than querying the remote server for subsequent requests, till the TTL duration expires.

The Time-To-Live (TTL) timer is the trick to guarantee that the DNS cache expires promptly and all of the time stays fresh. TTL is defined by domain administrator in the authoritative DNS server for the zone wherever data originates, and its values tell DNS caching resolvers to expire and dispose the DNS records after TTL seconds. Lowering the TTL value will enable fast expiration and refreshing of DNS records, making the new records to propagate faster across the world. Still, the trick demands the name resolvers comply the RFC standards, which most do. Alongside, you must have full control to change the name server authoritative for your domains.

The tweaking of TTL in DNS records must be done a couple of days before it’s about to change (date of server moving or IP change) to assure that all DNS caching resolvers picks up the fresh TTL value and expires the old longer value. The trick will cut down the TTL in anticipation of the alteration to minimize inconsistency during the change, according to RCF 1034.

TTL is defined by Minimum field in SOA (Start of Authority) type as default TTL, or separately at each record as TTL. RCF 1912 describes the Minimum field in details as below:

Minimum: The default TTL (time-to-live) for resource records (RR) — how long data will remain in other nameservers’ cache. ([RFC 1035] defines this to be the minimum value, but servers seem to always implement this as the default value) This is by far the most important timer. Set this as large as is comfortable given how often you update your nameserver. If you plan to make major changes, it’s a good idea to turn this value down temporarily beforehand. Then wait the previous minimum value, make your changes, verify their correctness, and turn this value back up. 1-5 days are typical values. Remember this value can be overridden on individual resource records.

If you are using a web-based or GUI to manage your domain’s DNS records, and then log on to the system, and edit the SOA records. Inside you’ll see a field named Minimum, change the value to as low as possible (in seconds), such as 300 for timeout every 5 minutes. Then change the TTL for all of the A, MX, CNAME, TXT, SOA, PTR and other records, if applicable.

If you are using cPanel WebHost Manager (WHM), log-in and select Edit DNS Zone under DNS Functions section. Choose the applicable zone (domain name). You’ll be given with a list of records. Alter the minimum ttl in SOA, and TTL column of A, MX, CNAME and other records defined.

For those manually configure the authoritative nameserver for a domain zone using BIND, modification has to be done in the zone file. For example, so domain zone example.com, you will see the following resource records in the zone file:
; zone ‘example.com’
$TTL 14400

@ IN SOA ns1.example.com. host.example.com. (
2007080501 ; Serial
10800 ; Refresh 3 hours
3600 ; Retry 1 hour
604800 ; Expire 1 week
86400 ); Minimum 24 hours

@ NS ns1.example.com.
@ NS ns2.example.com.

@ A 192.168.0.1
@ MX 10 mail.example.com.

; nameservers
ns1 A 192.168.0.11
ns2 A 192.168.0.12
; mail servers
mail A 192.168.0.10
; web server
www CNAME example.com.

Now modify the $TTL 14400 with the value you wish (in seconds), such as 300 (5 minutes). This value defines the default TTL of every existing records, and by lowering this value to 300 (for example, you can choose your won value), caching server will be hold this records for more than 5 minutes before querying the authoritative name server which will be the 1st to reflect the new IP address when change later on again. Some other value that you should modify is minimum TTL, the last line of SOA type (remarked as minimum 24 hours).

Afterwards, your DNS zone file will probably looks like this:
; zone ‘example.com’
$TTL 300

@ IN SOA ns1.example.com. host.example.com. (
2007080501 ; Serial
10800 ; Refresh 3 hours
3600 ; Retry 1 hour
604800 ; Expire 1 week
300 ); Minimum 24 hours

@ NS ns1.example.com.
@ NS ns2.example.com.

@ A 192.168.0.1
@ MX 10 mail.example.com.

; nameservers
ns1 A 192.168.0.11
ns2 A 192.168.0.12
; mail servers
mail A 192.168.0.10
; web server
www CNAME example.com.

Restart the DNS service. The fresh TTL value will propagate to other DNS nameserver. This process normally takes 48 hours to 72 hours (hence the need to reduce TTL to try to make it faster when altering the critical A and MX records). After waiting for a few days, move your websites to new server or modify the IP address, then update the DNS records to point to the new server or IP.

Once done, you can now return back the TTL values to reduce the load on your DNS server.

 
Leave a comment

Posted by on July 18, 2011 in Computer, Domain

 

Leave a comment