How can you change DNS servers on Ubuntu-Mate 22.04 (e.g. for a pi-hole)?

Hello

I have looked on the internet and have come to the conclusion that Ubuntu-Mate 22.04 does not have a GUI element for easily setting the DNS server(s). However, some other desktop-environments do.

Furthermore, my investigations suggest that on Ubuntu-Mate 22.04 systemd looks after DNS server settings, and that changing any systemd DNS server settings via the terminal is a daunting task with a serious risk of things going wrong.

Have I overlooked something?
Is there an easy way to change DNS server settings on Ubuntu-Mate 22.04? :thinking:

I also use a custom DNS, it is actually quite ease to select another one:

  1. Click the network icon on the taskbar.
  2. select: Edit Connections -> (select the connection of your choice) -> cogwheel
  3. change Method to "Automatic (DHCP) addresses only"
  4. fill in your dns-address** on the line "DNS servers"

** if you want more dns-addresses, seperate them with a comma.

In this example you see 127.0.2.1 as DNS because I have a DNS-crypt-proxy locally
but you can fill in any legitimate DNS address you want.

2 Likes

Hello tkn

Thank you for replying. :slightly_smiling_face:

My GUI window is slightly different, as you can see:

The "Additional" made me ask myself, "If this box is for additional DNS servers, where is the primary DNS server defined?"

If I understand what you are saying correctly, then:

  1. The primary DNS server will be assumed to be at the Gateway IP-address.
  2. When manual entries of DNS server addresses are made in the field "Additional DNS servers", they will override the primary DNS server assumed to be at the Gateway.
  3. If I enter the IP-address of my pi-hole as the first item in the field "Additional DNS servers", followed by a comma and then the IP address of my Gateway, then:
  • When the pi-hole is active (i.e. running) the pi-hole will be used.
  • When the pi-hole is not available (e.g. switched off), the DNS server programmed on my Gateway will be active.

Can you confirm my hypothesis? :thinking:

Aa-haaa !

Now I understand - I need to change the field "Method" to "Automatic (DHCP) addresses only". :slightly_smiling_face:

4 Likes