0

I'm currently migrating a website to another server, and want to test the DNS configuration (more specifically, email MX records) before moving the domain over. I've configured the DNS on the new server to have MX entries for Google Apps in the same way that it's configured on the old server. The domain is controlled by nameservers on the old server at the moment, so the change would simply be updating the nameservers to the new servers. (What I'm getting at is DNS is controlled at the server level, not registrar level).

Since the website has quite a number of users, I want to make sure the configuration is right before flicking the switch. For this, can I add an entry to the hosts file of my local computer to point the domain to the new server? I've done this, and the web server works, but would this also test the email MX records on the new server?

3 Answers 3

4

Do not use the hosts file for this; it replaces DNS lookups rather than doing them (and the ns1 subdomain has no special meaning).

On linux, you can use dig to test DNS; do dig @192.0.2.2 in mx yourdomain.tld where yourdomain.tld is replaced by your domain and the example IP is replaced by that of the nameserver under test.

On windows, use nslookup - 192.0.2.2 and enter the query mx yourdomain.tld.

1
  • I'll just note that there's nothing stopping you from using dig on Windows as well (it just isn't shipped with Windows) Mar 28, 2015 at 9:58
2

No, /etc/hosts is only used for address lookups. You need to modify the configuration of your resolver to point to the new name servers.

0

It is OK to effectively change your configuration, perform the test, and then roll back (if needed). Because of cache mecanism, the number of impacted user will be very low.

I remember experiencing problem with one of my DNS server, one user told me it was broken about 1 hour after it was broken. At that point, I called another user I knew he was using the corresponding RR (he was connected to the corresponding web service) and all worked fine for him (RR still in cache).

Using the hosts file is not a proper way to test your configuration as it completely bypass the resolution mechanism. The best way to test your DNS config is to expicitly ask the wanted DNS server

dig @wantedserver <other_option> mydomain

You must log in to answer this question.

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