I am trying to estimate whether it is realistic for me to change the IP of a mail server overnight or will this mess with people retrieving their email the day after. Basically, the facility where the mail server is will be changing its IP pool and this forces me to have to change the A and MX record for the mail server. Since I am not changing the DNS server itself (not moving the records to a different authoritative server), will the change be near instantaneous or will it still take up to 48 hours because of caching on different non authoritative DNS servers that may have queried recently?
Thanks for any insight,
M
Every DNS resource record is cached; whether the DNS server itself is moving or not is immaterial. As Yahia said, how long the record is cached is determined by the TTL of the record. Before performing a DNS change, it is common practice to lower the TTL from it's regular value (a day or more, typically) down to something really small, like 5 minutes.
Complicating this procedure is the fact that some badly-behaved dns caching resolvers ignore the specified TTL and substitute their own values. (The people running these systems need to die in a fire, and if I ever get elected Grand overlord of The Internet, they will). As such, if it's an important system or one used by people outside your direct control, you would be well advised to setup DNAT rules on the system being migrated away from to redirect traffic that does get sent to the previous IP address to the new one.
Do you already know the new IP address? If so, you're in luck! Setup a new
A
record, subdomain for your domain, pointing to the new IP, then add that as an extraMX
record; set the priority higher on the new one than the oldMX
record. Do this a couple of days before the new IP is supposed to be activated. After the new IP address is active, remove the oldMX
record, leaving the newMX
record. Remember to update yourSOA
serial each time you make edits.Here's an article outlining failover/backup
MX
records: http://www.zytrax.com/books/dns/ch9/mail.htmlThe most important setting in you senario is
TTL
of the respective DNS records.The lower the
TTL
is set the better - you usually won't get to "instantaneous" because of all the DNS servers out there which have diverse caching behaviours but the lowerTTL
is set the better your results will be...Changes to DNS should be relatively instantaneous on your authoritative servers. However, due to DNS cashing it will take a while for the changes to get out to clients. This will be more of a problem for frequent clients than occasional clients. You can work around this by pre-populating your data.
The various answers already posted cover everything you need to worry about.
You are now ready for the cut-over to the new address. After the cutover you can cleanup.
This should be completely transparent to your users. Any problems you encounter should be restricted to servers which are non-compliant with standards.
You can use the double A record technique for other services, but there will be delays when clients try the address which isn't responding and wait for it to timeout.