[Solved] Howto change DNS servers?

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
grasshopper
Level 1
Level 1
Posts: 43
Joined: Fri Mar 20, 2020 7:16 am

[Solved] Howto change DNS servers?

Post by grasshopper »

Hi,

When i check my DNS servers using:

Code: Select all

nmcli dev show |grep DNS
I get this result:

Code: Select all

IP4.DNS[1]:                             185.228.168.10
I tried with the instructions given on this website to change the DNS but it does not work.
Apparently i have changed the write permissions to read to a particular configuration file or something...

Can anyone guide me to the solution?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 7 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Image
User avatar
Flemur
Level 20
Level 20
Posts: 10089
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Cannot change DNS servers

Post by Flemur »

They seemed to have made it difficult to change without using a GUI, contrary to basic linux philosophy.

From your WiFi/connection icon on the task bar (add it if it's not there) -> Configure -> select your connection -> ipv4 tab -> set the "Method" as shown in the pic below (with cursor), enter your DNS values, hit Save. Mine was set to something goofy, I just now did the above and now I have

Code: Select all

$ nmcli dev show |grep DNS
IP4.DNS[1]:                             1.1.1.1
IP4.DNS[2]:                             8.8.8.8
dns-setting.gif
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
grasshopper
Level 1
Level 1
Posts: 43
Joined: Fri Mar 20, 2020 7:16 am

Re: Cannot change DNS servers

Post by grasshopper »

Ok, I will try that later (I am typing this from a computer on my work) but it's actually not the answer I seek.
I simply just want to know how this DNS setting can be deleted....
Ok , I figured it out.

With this command you set a dns server:

Code: Select all

nmcli con mod <Connection name> ipv4.dns "185.228.168.168,185.228.168.169"
With this command you can see the details about the connection:

Code: Select all

nmcli -p con show <Connection name>
or briefly the DNS address:

Code: Select all

nmcli dev show| grep DNS

Then deactivate the connection and activate the connection:

Code: Select all

nmcli con down <Connection name>

Code: Select all

nmcli con up <Connection name>
(Source)
However: how can you make this DNS-Server permanent or read-only?
Install the resolvconf package:

Code: Select all

sudo apt-get install resolvconf
Edit /etc/resolvconf/resolv.conf.d/head and add the following:

# Make edits to /etc/resolvconf/resolv.conf.d/head.
nameserver 185.228.168.168
nameserver 185.228.168.169

Restart the resolvconf service.

Code: Select all

sudo systemctl start resolvconf.service
Check this service:

Code: Select all

sudo systemctl status resolvconf.service
And last but not least open Nemo as administrator and set /etc/resolvconf/resolv.conf.d/head as readonly to protect from overwriting.
Image
Locked

Return to “Networking”