# How to Configure DNS on Ubuntu Using Netplan

Easily customize your DNS settings via the command line.

- **Source:** [Latest news](https://brifing.si/source/77d15218-219f-472d-bf40-31b5646d2942)
- **Published:** 2026-07-20
- **Topic:** [Software & Engineering](https://brifing.si/c/engineering)
- **Original article:** <https://www.zdnet.com/article/how-to-set-dns-servers-on-ubuntu-based-linux-distros/>
- **On Brifing:** https://brifing.si/s/30fa31bb-b76d-41a3-8d83-a43a499bc64d

## What is Netplan?

Netplan is a command-line tool for managing network configurations on Ubuntu-based Linux distributions. It uses YAML-formatted configuration files to provide flexible network settings for both desktop and server systems. It simplifies DNS changes for systems using either DHCP or static IP addresses.

## Preparation Steps

Before changing DNS settings, you may need to disable NetworkManager's DNS control. Add 'dns=none' and 'rc-manager=unmanaged' to /etc/NetworkManager/NetworkManager.conf and restart the service. This step is crucial to allow Netplan to manage your DNS settings effectively.

## Editing the DNS File

Modify the YAML configuration file (usually 00-netplan.yaml) in /etc/netplan to change your DNS servers. When adding preferred DNS addresses like Cloudflare (1.1.1.1, 1.0.0.1) under the 'nameservers' section, pay attention to YAML indentation rules. Always back up the file before saving changes.

## Applying Changes

After saving your edits, activate the new settings with 'sudo netplan apply'. If you encounter indentation errors, check the YAML file syntax. Test your internet connection with 'ping google.com' after successful application.

## Verification Process

Verify your new DNS settings with 'resolvectl status | grep "DNS"'. If you see old DNS addresses, a system reboot might be necessary. These steps ensure you have both secure and performant DNS configuration.

## Why Command Line?

Command-line DNS configuration can be lifesaving in server environments without GUI or during remote access. Tools like Netplan allow Linux system administrators to manage network settings centrally and consistently. Mastering this skill represents an important step in technical competency development for Linux users.

## Sources covering this story

- https://www.zdnet.com/article/how-to-set-dns-servers-on-ubuntu-based-linux-distros/ — 

---

_Summary written by Brifing from the original reporting. Copyright in the original article belongs to its publisher; read the full piece at the link above._
