Home » Home » HOW TO: Setup Public DNS In Ubuntu?

Is your Internet connection make you age old in connecting websites? Here comes an alternate way to connect websites through public DNS service like  Google DNS or OpenDNS. The working principal of public DNS will make your web-surfing experience reliable, faster and safer than DNS server of your ISP.

When you are accessing a site imsudo.com from your browser your computer needs the IP address of the web server hosted for that domain. Generally DNS server of your ISP will resolve the IP address of the website, if you are specifying the DNS server in your settings, then your computer will query specified DNS server to find the IP address of the website.

Why Public DNS?

popular websites and services, such as Facebook, often use a Content Delivery Network (CDN) to route your request to the closest server for their content. They do this via anycast routing or via DNS, by returning the closest server’s address when you perform a DNS query via your DNS server. where your DNS server is located physically can have an effect on the speeds and response times you get from certain CDN’s. Use a DNS server that’s close by.

However, these public DNS servers use anycast routing to provide your with a DNS response from the nearest server, or else they couldn’t provide you with such fast responses and high uptimes. For an instance, when you query from The Netherlands, the server that answers the query is not the same one as when you query from Japan. This may partially compensate the CDN problem.


There are bunch of free & Public DNS service which helps you to make your internet experience to feel better,

Level3   :-  Level3 DNS will automatically route to the nearest DNS server operated by Level3 Communications, the company that provides most of the ISPs in the US their access to the Internet backbone. The DNS primary server IP is and the DNS secondary server IP

Google   :- Google offers IPv6 & IPv4 public DNS server. The DNS primary server for IPV6 is  2001:4860:4860::8888 and Secondary server IP is 2001:4860:4860::8844

Securly   :- Securly DNS server block adult content by default, including of course X-rated content but also adult oriented pages on websites like Wikipedia, adult themed searches on Google, and more. The primary DNS server IP is and the secondary DNS server IP is

OpenDNS   :- OpenDNS offers free and premium DNS servers that block adult content, called OpenDNS FamilyShield. The DNS primary server IP is and secondary DNS server IP is

Norton ConnectSafe   :- The Norton ConnectSafe DNS servers block sites hosting malware, phishing schemes, and scams. Use and to block those sites plus those with pornographic content. Use and to block all previously mentioned site categories plus those Norton deems “non-family friendly.”

SafeDNS   :- SafeDNS offers content filtering option in several areas. The DNS primary server IP is and secondary DNS IP is

DNSResolvers.com   :- DNSResolvers.com says they do not “alter” the traffic in any way, including correcting “typos and non-existent domains”. The DNS primary server IP is and secondary DNS server IP is

OpenNIC   :- OpenNIC offers IPv6 public DNS servers. The DNS primary server IP is and the secondary DNS server IP is

Public-Root   :- Public-Root DNS servers is functioning only in the United States.


Enough with Public DNS background, Let’s now start configuring Public DNS in Ubuntu.

To get start, open Terminal by hitting ( Alt+Ctl+T ) on your keyboard. when it opens run the following command to open resolver file.

$ sudo gedit /etc/dhcp/dhclient.conf 

To know more about configuration files in /etc folder you can refer this link.

gedit window should popup by loading dhclient.conf, find the bellow line in dhclient and change it to the look like highlighted line below. Google Public DNS primary server IP address is, and the secondary IP address is

$ prepend domain-name-servers,;



Save the file and you’re done. Restart your computer to enjoy fast Internet.


The same process can be done via GUI tool. To do that, go to “System Settings —> Network” or Right click Network Manager applet and select “Edit Connections“.

In Edit Connection select the specified tab and select the connection name then click “Edit“. Then select IPv4 settings tab and change the connection method to “Automatic (DHCP) address only” 



Then type Google public DNS in DNS server field and then click save to complete the process.

That’s it, you are ready to go with fast internet.

Hope you enjoyed this article, please feel free to leave your comments and do share.

One thought on “HOW TO: Setup Public DNS In Ubuntu?

  1. Subhajit says:

    Nice. Got my Airtel breoadband connection today, was looking for this DNS fix.
    Thanks buddy.

Leave a Reply

Your email address will not be published. Required fields are marked *