DNS stands for Domain Name System, which is the mechanism that translates our fancy domain names into the IP addresses belonging to the servers, or networks, on the Net that power these sites.
This is article 2 of 7 in a series on Migrating WordPress sites.
When you request a domain by name, whether in your browser, by FTP, SSH, Telnet, email, or otherwise, your computer goes through a decision tree to figure out the location of the domain you requested and then directs you to the right IP address so the server can fill your request.
Domain Name Servers
Each registered domain should point to one or more DNS name servers, whose job it is to direct traffic for the domain. It’s typical to have two, or more, name servers assigned per domain, so if one nameserver is unavailable the others can answer the DNS call and direct the domain’s traffic.
Name servers are usually given to you by the company in charge of managing your DNS: it could be your domain registrar, your web host, or a third-party DNS service like CloudFlare or NoIP (both excellent services).
Want to get geeky, read more about Name servers.
A simple whois query (domain lookup) will show you the name servers used for any public domain, which tells you who’s in charge of directing traffic for that domain – it’s not always who you expect.
Lookup a Domain’s whois using Command Line
Afraid of the command line? Don’t be – it’s a really helpful and powerful tool.
On a Mac or Linux, open Terminal and type:
Using Windows? You can query whois information using the Windows command line too.
Either way, when you run a whois via command line, you’ll get a result formatted something like this:
As you can see, there’s a TON of useful info in the whois record, including:
- Name and contact info for the Registrant, Administrator, Technical and Billing contacts on file for the domain. It’s important to keep this info current and updated.
- What name servers are responsible for directing the domain’s traffic.
- Who is the current domain registrar.
- When the domain was registered.
- When the domain was last updated.
- When the domain expires.
For the purposes of this tutorial, though, we’re most concerned with the DNS name servers responsible for directing traffic for the domain. In the example above, the name servers are:
Name Server: NS7.IVYCAT.NET Name Server: NS8.IVYCAT.NET
Once we know the name servers responsible for the domain, we know where we need to go to make changes to the domain’s DNS records if we need to redirect traffic. Or, at least, we have a clue.
Ideally, there should be no question about who’s responsible for a domain’s DNS, right? The domain owner should know who’s in charge of directing their domain’s traffic, but realistically, the majority of customers we encounter do not know. And they feel powerless over their domains. So, knowing how to quickly look up this info can save you, and your customers time.
Don’t recognize the name servers as belonging to a specific hosting company or service? Try popping them into Google and seeing if it yields clues.
For the purposes of this tutorial series and moving websites, we’re most concerned with DNS A records, which match domain names with IP addresses. Although, note that some other DNS record types like CNAMES do not map to IP addresses but to other domains.
A typical DNS record looks something like this:
In the above example, web traffic is directed by the A record that reads:
wptestdomain.com. 14400 IN A 126.96.36.199
Here’s a breakdown of each entry on that line:
- wptestdomain.com. = this is the domain we’re working with.
- 14400 = TTL (time to live)
- IN = indicates it’s on the Internet
- A, NS, MX, CNAME, TXT, SOA or others = the record type of DNS entry
- 188.8.131.52 = the IP address in charge of web traffic for wptestdomain.com.
If I were moving wptestdomain.com from it’s current location to the IP address 184.108.40.2069, I’d move the site to the new location, verify everything’s working, and then switch the IP address in the above A record to:
wptestdomain.com. 14400 IN A 220.127.116.119
Before migrating any site, I like to:
- Run a full DNS report to make sure I know where all traffic is currently pointing using a handy tool like: DNSStuff or intoDNS.
- Login to the existing DNS provider and note the existing DNS setup. This is especially needed if you’re migrating DNS to a different provider by changing the domain’s name servers – you don’t want to lose any special DNS entries.
When a site gets repeated traffic, the DNS information pairing the domain to the IP address where the site lives may be cached by your computer, a network server, your ISP, and even the root name servers themselves: the big DNS daddy-o’s in the cloud running the authoritative databases directing public domain traffic.
How long they cache DNS records depends upon the DNS record’s TTL values.
TTL Values in DNS
TTL stands for Time to Live and is a measurement in seconds of how long DNS servers can cache, or remember, the IP address associated with the DNS entry. There are TTL values assigned to each entry in your domain’s DNS: web traffic, FTP, mail, CNAMEs (aliases), etc.
Pro tip: If you’re moving a site that’s already live from one server to another, try to lower the domain’s TTL values to 300 or 600 seconds (5 or 10 minutes), at least 24 hours prior to scheduled move.
This lets DNS servers know that your DNS may change every 5 or 10 minutes, so they need to re-check the location of the domain at least that often, and not cache the domain/IP pair for longer. This means that, once you re-point web traffic to the new IP, the DNS will propagate around the Net more quickly, so users will see the new site without waiting as long for their DNS providers to update their cache.
Not all DNS providers offer the same flexibility (or any, for that matter) in changing your domain’s TTL values. If in doubt, search their knowledgebase or contact support.
Once your domain is moved and you’ve re-pointed DNS and verified that all is well in domain land, you can re-adjust your domain’s TTL values to more reasonable numbers, typically between 3600 and 14400 seconds (1 to 4 hours).
DNS and Patience
Once you make a DNS change, it takes time for the changes to propagate around the internet, so it’s best to know how long the TTL values are set to before you make the change, and be prepared to wait that long for your DNS changes to become visible to the rest of the Net.
Tools for Testing DNS
You can use tools like the following to see what IPs are cached for specific DNS entries.
Outside of that, grab a cuppa and be patient, young Jedi, the internet will catch up.