How To Update Dns Server In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Edit the /etc/resolv.conf file:
Open the file with your preferred text editor with root privileges:
sudo nano /etc/resolv.conf
Modify the nameserver address/es to the DNS server you want to use. If a particular server is not responding, it can be disabled by adding a hashtag # before the name. For example:
#nameserver 10.10.1.1
2. Use the nmtui command line tool:
The nmtui (Text User Interface network manager) command can be used to modify the DNS settings:
sudo nmtui
Select “Edit a Network Connection” and choose the interface to edit.
Navigate to the “IPv4 Settings” tab.
Choose the “Automatic (DHCP) addresses only” option and select the “DNS Servers” field.
Type in the DNS server addresses you want to use.
After pressing OK, close the window and save the changes.
3. Use the nmcli command line tool:
The nmcli (NetworkManager) command can be used to modify the DNS settings:
sudo nmcli connection modify <connection> ipv4.dns “<address>”
Replace <connection> with an interface name, such as enp0s3 or wlan0.
Replace <address> with the new DNS server address.
For example:
sudo nmcli connection modify enp0s3 ipv4.dns “8.8.8.8 8.8.4.4”