Using the local DNS Server

→ Are you a new visitor? Please visit the page guidance for new visitors ←

Using the local DNS Server

I’m not sure if you know, but your ISP DNS servers usually take around 24-72 hours to clear their DNS cache, in which time, if you made changes to your domain name, you will have to wait for your ISP to clear their cache before you can see the changes you made. This is called domain propagation and usually hosting providers will give this explanation after a customer changes their DNS settings. Now we should keep in mind that your computer or browser could also create a local DNS cache, in this case you would usually clear your DNS cache or simply reboot your computer and / or router and switch (if any). But the solution to this is using a local DNS server where you have control over your DNS cache and you can clear the cache at any time.

Choosing your DNS server

The most used DNS server I believe is bind9 (or named), I have been using this for almost 3 years now on my computer and on my laptop without any issues. I recommend this one to anyone.

To install bind9 on Debian / Ubuntu you can run the command:

For Redhat / CentOS / Fedora you can use the command:

Another option would be to using NSD, haven’t really used it but I know for certain that it is being used by 3 root nameservers.

Using the local DNS servers

Ok, now that we have installed our own DNS server, we need to use it right? On any computer this is easily done by changing the their nameservers.

  • For Linux operating system

Here you need to change the following file /etc/resolv.conf and add there the line

Save it and it should directly use your local DNS server.

  •  For Windows operating system

For Windows there are a few more steps, see bellow:

  1. Go the Control Panel.
  2. Click Network and Internet, then Network and Sharing Center, and click Change adapter settings.
  3. Select the connection for which you want to configure your local DNS. For example:
    • To change the settings for an Ethernet connection, right-click Local Area Connection, and click Properties.
    • To change the settings for a wireless connection, right-click Wireless Network Connection, and click Properties.

    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

  4. Select the Networking tab. Under This connection uses the following items, choose Internet Protocol Version 4 (TCP/IPv4) and then click Properties.
  5. Click Advanced and select the DNS tab. If there are any DNS server IP addresses listed there, write them down for future reference, and remove them from this window.
  6. Click OK.
  7. Select Use the following DNS server addresses. If there are any IP addresses listed in the Preferred DNS server or Alternate DNS server, write them down for future reference.
  8. Replace those addresses with the IP addresses of the your local DNS servers, in our case this is:
    • For IPv4:
  9. Restart the connection you selected in step 3.

And that’s it, it should be working using your local DNS server. Now each time you want to clear your DNS cache, you just need to restart the DNS server which you now have control over it.

For Redhat / CentOS / Fedora the service name is named.

Why is this useful?

For those of you who do not change DNS settings to your domains a lot, I guess you won’t be frustrated by the need to wait up to 24-72 hours just to see that your domain name or DNS record points to a specific location, but for me this is required. I’m testing dozens of DNS records each day, without my local DNS server I wouldn’t be able to confirm if the settings made to a specific DNS record are ok and that the client will be satisfied and he only needs to allow it time for domain propagation to complete. So yeah, for people working a lot with DNS, this is really useful.

That’s it for today, don’t forget to share it if you like it!

Request an article ←