Set custom DNS servers with nmcli
Point a Wi-Fi or wired profile at faster or privacy-friendly resolvers like 1.1.1.1.
01Command
$ nmcli con mod 'MyWiFi' ipv4.dns '1.1.1.1 8.8.8.8' && nmcli con mod 'MyWiFi' ipv4.ignore-auto-dns yes && nmcli con up 'MyWiFi'02What it does
NetworkManager stores DNS per connection profile, so you can give your home Wi-Fi different resolvers than your office network. ipv4.ignore-auto-dns yes is the step people miss — without it the router's DHCP-provided DNS keeps winning. Get the exact profile name first with nmcli con show, then the change applies as soon as the connection reactivates.
03Risk
04Undo
$ nmcli con mod 'MyWiFi' ipv4.ignore-auto-dns no && nmcli con mod 'MyWiFi' ipv4.dns '' && nmcli con up 'MyWiFi'05Sources
- NetworkManager — Arch WikiEvidence: Custom DNS servers are set per connection with nmcli con mod <name> ipv4.dns, and ignore-auto-dns stops DHCP-provided DNS overriding them.
- nmcli(1) — Ubuntu manual pageEvidence: nmcli con mod modifies connection properties such as ipv4.dns and ipv4.ignore-auto-dns; nmcli con up reactivates the profile to apply them.
Last verified: 2026-09-18 · Category: Network
06Related solutions
Query any DNS record type for a domain, with a compact answer or the full response including headers and TTLs.
One command that prints every interface with its state and IPv4/IPv6 addresses in a short table — the modern, memorable replacement for digging through `ifconfig` or the verbose `ip addr` output.
The classic forgotten-syntax command: `traceroute` shows every router between you and a destination plus the round-trip time of probes to each hop.