cybrkyd

How to set DNS system-wide on Linux Mint 21 and 22

 Mon, 16 Jun 2025 08:42 UTC
How to set DNS system-wide on Linux Mint 21 and 22
Image: CC BY 4.0 by cybrkyd

I have to make a note of this. How to set DNS system-wide on Linux Mint 21 and 22 using nmcli.

The router from my ISP doesn’t allow me to set DNS. I therefore need to set DNS on my device. I also want to remove the default DNS 192.168.0.1.

1. List available connections:

nmcli connection show

The response looks something like this:

NAME            UUID            TYPE       DEVICE
Auto HomeWiFi   abcd1234-...    wifi       wlp3s0
Ethernet 1      efgh5678-...    ethernet   eno1

For the connection being used, the NAME in that row is the one to use. So, if connecting via WiFi, I’ll make note of Auto HomeWiFi.

2. Use the connection name with nmcli.

# Ignore auto-DNS (to remove 192.168.0.1)

nmcli connection modify "Auto HomeWiFi" ipv4.ignore-auto-dns yes

# Add DNS (I’m adding Quad9). Notice no comma between the DNS IP addresses

nmcli connection modify "Auto HomeWiFi" ipv4.dns "9.9.9.9 149.112.112.112"

# Reload network connection

nmcli connection up "Auto HomeWiFi"

Sometimes a reboot is needed to make these stick.

»
Tagged in:

Visitors: Loading...