Ricmedia PC Help

Tech guides for everyone.

  • Home
  • Browsers +
    • Chrome
    • Chromium
    • Firefox
    • Internet Explorer
    • Microsoft Edge
    • Safari
    • Opera
    • Browsers (all)
  • Windows +
    • Windows 10
    • Windows 8/8.1
    • Windows 7
    • Windows Vista
    • Windows XP
    • Windows (all)
  • Other OS +
    • Linux
    • MAC OS X
    • Other OS (all)
  • MS Office +
    • Office 2016
    • Office 2013
    • Office 2010
    • Office 2007
  • Software +
    • Antivirus
    • Audio
    • Image
    • System Tools
    • Video
    • Web
  • More +
    • Networking
    • Hardware
    • Builds
    • Tools & Apps
    • Miscellaneous
    • Get a Product Reviewed
    • Support +
      • Help
      • Sitemap
      • Legal
      • About
      • Contact
    • Legal +
      • Disclaimer
      • Copyright
      • Privacy Policy
      • Terms of Service

Set custom DNS servers on Linux with Network Manager or resolv.conf

March 21, 2017 By Richie Leave a Comment

Setting custom DNS servers on Linux can increase performance, security and even thwart some websites using Geo-blocking via DNS. There are two ways to accomplish this: via Network Manager GUI that is included in many Linux distros like Debian, Ubuntu and derivatives, or via resolv.conf (not directly, but via the head file) and I’ll show you how to do both in this guide.

FYI: The resolv.conf file is overwritten on each boot so we can’t edit this file directly, but we can edit one of the two files used to create the resolv.conf file, those being the head and base files located in /etc/resolvconf/resolv.conf.d/. We’ll be editing the head file in the second part of this guide so that each and every boot-up, resolv.conf gets written with our custom DNS servers at the top.

Before changing DNS servers you’ll also need to find a third-party DNS provider, there are plenty of good (and free) services available too. I personally recommend Google DNS which is what I use and have never had an issue. I will list here the most popular DNS providers:

  • GOOGLE
  • Primary IPv4: 8.8.8.8
  • Secondary IPv4: 8.8.4.4
  • Preferred IPv6: 2001:4860:4860::8888
  • Alternate IPv6: 2001:4860:4860::8844
  • OPENDNS
  • Primary: 208.67.222.222
  • Secondary: 208.67.220.220
  • Preferred IPv6: 2620:0:ccc::2
  • Alternate IPv6: 2620:0:ccd::2
  • DNS.WATCH
  • Primary: 84.200.69.80
  • Secondary: 84.200.70.40
  • LEVEL3
  • Primary: 209.244.0.3
  • Secondary: 209.244.0.4
  • NORTON
  • Primary: 199.85.126.10
  • Secondary: 199.85.127.10
  • COMMODO
  • Primary: 8.26.56.26
  • Secondary: 8.20.247.20
  • VERISIGN
  • Primary: 64.6.64.6
  • Secondary: 64.6.65.6
  • MORE SERVERS…
  • See: Free and Public DNS Servers
  • See: Public DNS Server List (extensive)

Watch the video above or follow the text guide below.

Set custom DNS servers on Linux with Network Manager

  1. Click on Network icon top-right of your screen, then click the Edit ConnectionsSet Custom DNS - Click on Network icon, then click Edit Connections
  2. Select your connection (may be wired or wireless), then click Edit buttonSet Custom DNS - Select your connection, then click the Edit button
  3. Click on IPv4 Settings tab, if Method is set to Automatic (DHCP) change it to Automatic (DHCP) addresses only, if Method is set to anything else, leave as is. Next enter your primary and secondary DNS server IP addresses separated by a comma, then click Save buttonSet Custom DNS - Click IPv4 Settings tab, change to DHCP Addresses Only, then enter your DNS servers
  4. (Optional) Click on IPv6 Settings tab, if Method is set to Automatic change it to Automatic, addresses only, if Method is set to anything else, leave as is. Next enter your primary and secondary DNS server IP addresses separated by a comma, then click Save buttonSet Custom DNS - Click IPv6 Settings tab, change to DHCP Addresses Only, then enter your DNS servers
  5. Finally click Close button to exit
  6. Ubuntu doesn’t cache DNS so we don’t need to flush it, but other distributions might. Just search for "[distro_name] flush DNS cache" to find instructions on how to do it
  7. All done!

Set custom DNS servers on Linux using resolv.conf

  1. Click the Search icon, type in "Terminal" then click the Terminal applicationSet Custom DNS - Go to Software icon, then type in Terminal, click the first result to open Terminal app
  2. Now type in the following command: sudo nano /etc/resolvconf/resolv.conf.d/head and hit EnterSet Custom DNS - Enter commands as shown
  3. Just after the comments, type nameserver 8.8.8.8 (or your desired primary DNS server IP address) then on the next line, type nameserver 8.8.4.4 (or your desired secondary DNS server IP address). Now press Ctrl + O to save, then Ctrl + X to exit.Set Custom DNS - Type in nameserver then the IP address for both primary and secondary DNS servers
  4. At the command prompt, type sudo resolvconf --enable-updates and hit EnterSet Custom DNS - Enter the command as shown
  5. Now type sudo resolvconf -u and hit Enter then close the Terminal applicationSet Custom DNS - Enter the command as shown
  6. Ubuntu doesn’t cache DNS so we don’t need to flush it, but other distributions might. Just search for "[distro_name] flush DNS cache" to find instructions on how to do it
  7. All done!

  • Ubuntu (official)
  • Ask Ubuntu (official Ubuntu Q & A)
  • Debian (official)
  • Debian Admin Handbook – Domain Name Servers (DNS)
  • How To Flush Linux / UNIX DNS Cache
  • Linux Network Manager at Wikipedia.org
  • Linux Network Manager at Archlinux.org

Share ➤

  • Twitter
  • Facebook
  • Google
  • Print
  • Email

Related

Filed Under: Firewalls & Security, Linux, Miscellaneous, Networking, Other OS, Raspbian, Software, System Tools Tagged With: Debian, DNS, DNS Server, Free DNS, IP address, Linux, Network Manager, Public DNS, Ubuntu

About Richie

I started working with computers in 1996 with the advent of the Internet and started my own online shop selling musical instrument accessories in 2000.

In 2006 I studied Multimedia Development & Design which opened up the world of Photoshop, HTML, Flash and JavaScript.

Since then I have designed dozens of websites as well as maintaining my own group of websites including Ricmedia PC Help and Ricmedia Guitar among others.

I am currently the webmaster and content creator for all Ricmedia.com websites.

Leave a comment Cancel reply

Find, follow or subscribe

Find me on Facebook, Twitter, Google+ & YouTube Find me on Facebook Follow me on Twitter Check out my Google+ page Visit my YouTube channel

Categories

Recent Posts

  • How to buy Ripple and other Cryptocurrencies
  • Setup private VPN network or VPN service provider – complete guide
  • Set custom DNS servers on MAC OS X

Recent Comments

  • Richie on Setup LAMP Server on Raspberry Pi 3 – Complete DIY Guide
  • Joshua on Setup LAMP Server on Raspberry Pi 3 – Complete DIY Guide

HELP

  • About us
  • Contact details
  • FAQ
  • Sitemap

NEWS & FEED

  • Latest news
  • Subscribe to Newsletter
  • Subscribe to RSS feed

SOCIAL

  • facebook.com/ricmedia.pchelp
  • twitter.com/RicmediaPCHelp
  • youtube.com/user/RicmediaPCHelp
  • Google+ Page

Help & Support • Legal, Terms & Privacy • Contact Details • Copyright ©2006- Ricmedia • Part of the Ricmedia group of websites   Part of the Ricmedia group of websites

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.