Menu
User

DropVPS Team

Writer: John hens

How to set up 1.1.1.1 on linux with terminal

How to set up 1.1.1.1 on linux with terminal

Publication Date

07/20/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Cloudflare’s 1.1.1.1 DNS is known for speed and privacy. You can configure it easily on any Linux system using just the terminal.

Step 1: Backup existing DNS settings

Before making changes, it’s a good idea to back up your current DNS configuration.

sudo cp /etc/resolv.conf /etc/resolv.conf.backup

This creates a copy of your current DNS settings in case you want to revert later.

Step 2: Set 1.1.1.1 manually as your DNS

Open the DNS configuration file:

sudo nano /etc/resolv.conf

Replace its content with:

nameserver 1.1.1.1
nameserver 1.0.0.1

Save and exit (Ctrl+O, then Enter, then Ctrl+X). These are Cloudflare’s primary and secondary DNS servers.

Step 3: Prevent DNS from resetting on reboot

To stop network services from overwriting your changes:

sudo chattr +i /etc/resolv.conf

This locks the file to prevent automatic changes by NetworkManager or DHCP.

Step 4: Test your DNS resolution

Check if your system is using Cloudflare DNS correctly:

dig @1.1.1.1 dropvps.com

If you receive a valid response, your system is using 1.1.1.1 as intended.

Optional Step: Restore original DNS settings

If you want to undo changes, remove the lock and restore the backup:

sudo chattr -i /etc/resolv.conf
sudo mv /etc/resolv.conf.backup /etc/resolv.conf

This returns your system to its previous DNS configuration.

Linux VPS
๐ŸงLinux VPS

Need a Linux Server for This?

Run Debian, Ubuntu, or any Linux distro on DropVPS โ€” fast NVMe SSD, full root access, and 24/7 support. Perfect for everything you just read.

  • Full Root Access
  • Debian & Ubuntu Ready
  • 99.99% Uptime
  • 24/7 Support
Get Linux VPS โ†’

No commitment ยท Cancel anytime

U
Loading...

Related Posts