How to change DNS on Linux?
- 1 Minute to read
How to change DNS on Linux?
- 1 Minute to read
Article Summary
Share feedback
Thanks for sharing your feedback!
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.
- 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
- 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
Now close and save the file by clicking Ctrl + X and pressing Y.
After that, please type in one last command in the terminal and press Enter:
chattr +i /etc/resolv.conf
In case the chattr +i command does not work, try using the following command instead:
sudo chattr -f +i /etc/resolv.conf
- 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?