How to change DNS on Linux?
  • 1 Minute to read

    How to change DNS on Linux?

      Article Summary

      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.

      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
      1. 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:



      Screenshot 2021-07-29 at 12.10.11.png

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

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

      chattr +i /etc/resolv.conf

      Screenshot 2021-07-29 at 12.10.24.png

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

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

      1. Lastly, restart your Linux device.

      Note: In case you have any questions or are experiencing any issues, please feel free to contact our 24/7 customer support team.

      Was this article helpful?