< Back

How to configure custom DNS on a Linux device?

This guide will show you how to edit, add, or remove the DNS settings on your Linux device.

Changing the DNS on your device can be helpful if you're looking to improve the connection quality and, in some cases - the speed.

 

Let's begin!

 

  1. Firstly, open the terminal with the CTRL + ALT + T combination and type in the following commands:

    sudo rm -r /etc/resolv.conf

    sudo nano /etc/resolv.conf

     

  2. You will be asked for your root password after each command line, just type it in and press Enter. When the text editor opens, you will have to type in these lines:


    nameserver 208.67.222.222

    nameserver 208.67.220.220

    Linux_DNS_1.png

  3. Now close and save the file by clicking Ctrl + X and pressing Y.

  4. After that, please type in one last command in the terminal and press Enter:

    chattr +i /etc/resolv.conf

    linux_change_dns_2.png

    In case the chattr +i command does not work, try using the following command instead:

    sudo chattr -f +i /etc/resolv.conf

     

  5. Lastly, restart your Linux device.

 

Congratulations! Now you know how to configure custom DNS addresses on your Linux device!

 

 

If you have any further questions, our customer success team will help you 24/7 over live chat or email. 

 

You may also be interested in:

 

Was this article helpful?