This guide will show you how to edit, add, or remove the DNS settings on your Linux device.
- 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:
- 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.
Congratulations! Now you know how to configure custom DNS addresses on your Linux device!
You may also be interested in: