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
U
Loading...

Related Posts