How to set up OpenDNS or Google DNS on Ubuntu / Debian
Most Ubuntu and Debian desktops manage DNS through NetworkManager. You can also use nmcli on servers.
Why change DNS on Linux?
Corporate or ISP resolvers sometimes block or mishandle lookups. Public DNS restores predictable resolution.
Recommended public DNS servers
- OpenDNS (Cisco): 208.67.222.222 / 208.67.220.220
- Google Public DNS: 8.8.8.8 / 8.8.4.4
- Cloudflare DNS: 1.1.1.1 / 1.0.0.1
GUI (NetworkManager) steps
- Open Settings → Network (or Wi‑Fi).
- Click the gear icon on your active connection.
- Open the IPv4 tab. Set IPv4 Method to Automatic (DHCP) if needed, then set DNS to Manual / disable Automatic DNS if shown.
- Enter DNS servers 208.67.222.222, 208.67.220.220 or 8.8.8.8, 8.8.4.4 separated as your UI requires.
- Apply and toggle the connection off/on.
- Optional CLI: nmcli connection modify "CONNECTION_NAME" ipv4.dns "8.8.8.8 8.8.4.4" ipv4.ignore-auto-dns yes && nmcli connection up "CONNECTION_NAME".
Flush DNS on systemd-resolved
Ubuntu uses systemd-resolved by default on recent releases.
sudo resolvectl flush-caches
- Open a terminal.
- Run sudo resolvectl flush-caches
- Check status with resolvectl status | head.
- Retry the website.
Verify it worked
Use dig example.com or resolvectl query example.com to confirm which server answered.
Related DNS guides
- How to set up OpenDNS or Google DNS on Windows 11
- How to set up OpenDNS or Google DNS on Windows 10
- How to set up OpenDNS or Google DNS on Windows 8
- How to set up OpenDNS or Google DNS on Windows 7
- How to set up OpenDNS or Google DNS on Windows Vista
- How to set up OpenDNS or Google DNS on Windows XP
- How to set up OpenDNS or Google DNS on macOS
- How to set up OpenDNS or Google DNS on Fedora / RHEL
- How to set up OpenDNS or Google DNS on Android
- How to set up OpenDNS or Google DNS on iPhone & iPad
- How to set up OpenDNS or Google DNS on ChromeOS
- How to set up OpenDNS or Google DNS on your router