[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
Miss B
Level 1
Level 1
Posts: 5
Joined: Thu Nov 24, 2022 12:57 pm

[SOLVED] Howto change DNS servers?

Post by Miss B »

How can I change DNS servers in Linux Mint 20.3 Mate?

I can add DNS servers through the GUI, but I want to get rid of the current DNS servers.

I attempted to follow the guide to create a new /etc/resolv.conf on NordVPN, but then I just lost the internet connection.

Thanks in advance.
Last edited by LockBot on Thu May 25, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: Howto change DNS servers?

Post by Termy »

Been a long time since I looked into this but don't you just change the value for the nameserver parameter in '/etc/resolv.conf'? Perhaps you used the wrong IP or something. I'm not entirely sure. :? From looking online, it seems editing that file is (or was) temporary. Apparently you can specify multiple domain name servers by way of priority, using that file. Simply changing the existing IP may not be desired. Apparently making relevant changes to '/etc/systemd/resolved.conf' (via SystemD) will make the changes permanent.
I'm also Terminalforlife on GitHub.
t42
Level 11
Level 11
Posts: 3732
Joined: Mon Jan 20, 2014 6:48 pm

Re: Howto change DNS servers?

Post by t42 »

What is an output of sudo netstat -lnptu on your system?
-=t42=-
t42
Level 11
Level 11
Posts: 3732
Joined: Mon Jan 20, 2014 6:48 pm

Re: Howto change DNS servers?

Post by t42 »

Termy wrote: Fri Nov 25, 2022 12:41 pm /etc/resolv.conf'? ...
From looking online, it seems editing that file is (or was) temporary.
Mentioned by OP NordVPN method includes chattr +i /etc/resolv.conf so nothing is temporary here :)
Not that manually editing files is a way to go, still NetworkManager is a preferred choice. But not if the system has various VPN scripts leftovers.
-=t42=-
KodiakCanoe
Level 3
Level 3
Posts: 113
Joined: Wed Nov 23, 2022 12:30 am

Re: Howto change DNS servers?

Post by KodiakCanoe »

My /etc/resolv.conf always reads

Code: Select all

nameserver 127.0.0.53
whether I'm connected to Nord or not. I use the Nord app and by default it will use their DNS.
Miss B
Level 1
Level 1
Posts: 5
Joined: Thu Nov 24, 2022 12:57 pm

Re: Howto change DNS servers?

Post by Miss B »

Hi all

Thanks for looking into this.
It's not that I use NordVPN, I only used their guide.

I do not know which content the resolv.conf file had before I deleted it, but the content of the file on the computer I am currently using, is
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad
It is beginning to be a bit long haired for me, but maybe I can just add
DNS=91.239.100.100 89.233.43.71
to /etc/systemd/resolved.conf?

The file does currently only contain comments. According to man resolved.conf these commented out entries 'showing the defaults as a guide to the administrator', and this is how I understand what to do. I am not sure though.

Tomorrow I expect to be able to look at the computer that should have its DNS settings changed. Then I can also check the output of netstat -lnptu
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: Howto change DNS servers?

Post by Termy »

Miss B wrote: Sun Nov 27, 2022 3:37 pm [...]
Seems like you have the right idea. I was confused at first, because you posted what looks like '/etc/resolv.conf', then talked about adding a line to '/etc/systemd/resolved.conf', but I now understand. From looking at the resolved.conf(5) man page, the DNS parameter does seem like what you want, and nice work spotting that, when using multiple DNS IPs, they should be whitespace-delimited.
I'm also Terminalforlife on GitHub.
Miss Bit
Level 1
Level 1
Posts: 24
Joined: Fri Apr 19, 2013 10:02 am

[SOLVED] Howto change DNS servers?

Post by Miss Bit »

I succeeded getting uncensored on the internet, but not by editing the settings on my computer, where it did not seem to be possible to get rid of the current DNS servers.

Instead I did it on the router. "the" because it is not my own router, it is provided by my ISP. So now it is just a question for how long that is going to work, I fear that they remotely will reset it to their own default settings, so that I soon will be using their DNS servers again. Time will show.

Thanks for trying to help me with this.

PS: I do not seem to be able to edit the topic of the original post for this topic...?
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: [SOLVED] Howto change DNS servers?

Post by Termy »

Miss Bit wrote: Mon Nov 28, 2022 11:56 am [...]
Damn it, I totally forgot you can set the DNS in the router! I haven't come across that in a long time, so it didn't even occur to me. It's confusing to me that the router and the OS can specify it. I guess it's like the firewall, where the router ultimately has the power, and the OS is secondary.

To the right of the area holding your initial post, look at the top-right, where you should find a small Edit button.
I'm also Terminalforlife on GitHub.
t42
Level 11
Level 11
Posts: 3732
Joined: Mon Jan 20, 2014 6:48 pm

Re: [SOLVED] Howto change DNS servers?

Post by t42 »

Miss Bit wrote: Mon Nov 28, 2022 11:56 am
Instead I did it on the router. "the" because it is not my own router, it is provided by my ISP. So now it is just a question for how long that is going to work, I fear that they remotely will reset it to their own default settings, so that I soon will be using their DNS servers again. Time will show.
In such a case why not to use Setting up DNS over TLS (DOT) Queries and DNS cache using Stubby and DNSMASQ

Here is a setup for Uncensored provider, DNS requests are encrypted:
Image

Code: Select all

############################ DEFAULT UPSTREAMS  ################################
## The Uncensored DNS servers
  - address_data: 91.239.100.100
    tls_auth_name: "anycast.censurfridns.dk"
#
## The Uncensored DNS servers
  - address_data: 89.233.43.71
    tls_auth_name: "unicast.censurfridns.dk"
Anyway after some short testing I found The Uncensored DNS servers are not stable enough. For those who don't want to use 1.1.1.1 or 8.8.8.8 it may be recommended the getdnsapi.net server:

Code: Select all

# The getdnsapi.net server
  - address_data: 185.49.141.37
    tls_auth_name: "getdnsapi.net"
    tls_pubkey_pinset:
      - digest: "sha256"
        value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
-=t42=-
Miss B
Level 1
Level 1
Posts: 5
Joined: Thu Nov 24, 2022 12:57 pm

Re: [SOLVED] Howto change DNS servers?

Post by Miss B »

Thank you t42,
I will have a closer look at that if my current setup will be reset by the ISP.
Locked

Return to “Networking”