Cloudflare DNS (1.1.1.1) is a fast, secure, and privacy-focused DNS service that improves browsing speed and security. This guide will help you configure Cloudflare DNS on your Linux system, specifically for Ubuntu and Debian-based distributions.

What is Cloudflare DNS?
DNS (Domain Name System) translates domain names into IP addresses. Your internet service provider (ISP) assigns a default DNS, but switching to Cloudflare’s DNS can enhance privacy, security, and speed.
Cloudflare DNS Addresses:
- IPv4:
- Preferred DNS:
1.1.1.1
- Alternate DNS:
1.0.0.1
- IPv6:
- Preferred DNS:
2606:4700:4700::1111
- Alternate DNS:
2606:4700:4700::1001
How to Set Up Cloudflare DNS on Linux (Ubuntu/Debian-Based)
Method 1: Using GUI (For Desktop Users)
- Open Network Settings:
- Click on the Settings icon.
- Select Network from the sidebar.
- Edit Your Connection:
- Click on your active connection (Wi-Fi or Wired).
- Click on the Settings (gear) icon.
- Change DNS Servers:
- Go to the IPv4 tab.
- Disable Automatic DNS.
- Enter the following Cloudflare DNS servers:
1.1.1.1, 1.0.0.1
- (Optional) In the IPv6 tab, disable Automatic DNS and enter:
2606:4700:4700::1111, 2606:4700:4700::1001
- Apply Changes:
- Click Apply.
- Disconnect and reconnect to the network for the changes to take effect.
Method 2: Using Terminal (For Advanced Users)
1. Modify the resolv.conf File (Temporary Method)
- Open the terminal (
Ctrl + Alt + T
). - Type the following command:
sudo nano /etc/resolv.conf
- Replace the existing nameservers with Cloudflare’s:
nameserver 1.1.1.1
nameserver 1.0.0.1
- Press
Ctrl + X
, thenY
, and hitEnter
to save the file. - Restart the network service:
sudo systemctl restart networking.service
Note: This method is temporary and resets on reboot.
2. Modify NetworkManager (Permanent Method)
- Open the NetworkManager configuration file:
sudo nano /etc/NetworkManager/NetworkManager.conf
- Add or modify the
[main]
section to include:
[main]
dns=none
- Save and exit (
Ctrl + X
, thenY
, andEnter
). - Now, edit the DNS configuration:
sudo nano /etc/systemd/resolved.conf
- Uncomment and modify the
DNS=
line:
DNS=1.1.1.1 1.0.0.1
- Restart NetworkManager:
sudo systemctl restart NetworkManager
How to Verify Cloudflare DNS is Working
To check if your system is using Cloudflare DNS:
- Open the terminal and run:
nslookup google.com
- If the output shows
1.1.1.1
or1.0.0.1
, Cloudflare DNS is active. - Alternatively, visit https://1.1.1.1/help in your browser.
Why Use Cloudflare DNS?
✅ Faster Browsing – Cloudflare DNS is one of the fastest in the world. ✅ Better Privacy – Cloudflare does not track or log your browsing data. ✅ Increased Security – Helps protect against phishing and cyber threats.
By following these steps, you can easily switch to Cloudflare DNS on your Ubuntu or Debian-based Linux system and enjoy a faster, safer, and more private internet experience!
Let us know in the comments if you have any questions or need further assistance.