Google Public DNS configuration on Linux servers

How to Configure Google Public DNS (8.8.8.8) on Linux Servers

What Is DNS and Why Configure Google Public DNS on Linux?

The Domain Name System (DNS) translates domain names into IP addresses that computers can understand. Every time you visit a website or use an online service, your system relies on DNS to locate the correct destination.

A properly configured DNS service is essential for stable and efficient network communication. Most Linux systems use DNS servers provided by the ISP. Many administrators switch to Google Public DNS because of its speed, reliability, and global infrastructure.

Google’s primary DNS server is 8.8.8.8, and 8.8.4.4 is the secondary server. It is easy to configure across different Linux distributions.

Benefits of Using Google Public DNS in Linux

Google Public DNS improves DNS lookup speed and reliability. It also provides consistent performance across different networks and locations.

  • Faster DNS resolution
  • Improved reliability and uptime
  • Global DNS infrastructure
  • Better protection against DNS issues
  • Consistent performance worldwide
  • Easy configuration on Linux systems

How to Configure Google Public DNS on Linux

This guide explains how to configure Google Public DNS using different methods. It also shows how to verify the configuration and troubleshoot common DNS issues.

Check the Current DNS Configuration

Before making changes, check your current DNS configuration.

cat /etc/resolv.conf

The output shows the DNS servers used by the system.

Configure Google Public DNS Using /etc/resolv.conf

If your system uses /etc/resolv.conf, edit the file:

sudo nano /etc/resolv.conf

Add the following lines:

nameserver 8.8.8.8
nameserver 8.8.4.4

Save and exit the file.

Important Note About resolv.conf

Some Linux systems overwrite this file automatically. This happens when using NetworkManager or systemd-resolved.

If your changes do not persist, use one of the methods below.

Configure Google DNS Using NetworkManager

Steps to Configure Google DNS Using NetworkManager

  1. Click the network icon
  2. Open Network Settings
  3. Select the active connection
  4. Open settings
  5. Go to IPv4 or IPv6
  6. Set DNS to Manual
  7. Enter: 8.8.8.8, 8.8.4.4
  8. Save and reconnect

Configure Google DNS Using systemd-resolved

sudo nano /etc/systemd/resolved.conf
[Resolve]
DNS=8.8.8.8 8.8.4.4
FallbackDNS=1.1.1.1
sudo systemctl restart systemd-resolved

Configure DNS Using nmcli

nmcli connection show
nmcli connection modify "Your-Connection-Name" ipv4.dns "8.8.8.8 8.8.4.4"
nmcli connection up "Your-Connection-Name"

Verify DNS Configuration

Using nslookup

nslookup google.com

Using dig

dig google.com

Using resolvectl

resolvectl status

The output should show 8.8.8.8 and 8.8.4.4.

Common DNS Troubleshooting Tips

DNS Changes Not Working

sudo systemctl restart NetworkManager
sudo systemctl restart systemd-resolved

DNS Resets After Reboot

Use NetworkManager or systemd-resolved instead of editing resolv.conf.

DNS Not Resolving

ping 8.8.8.8

If ping works but domain names fail, it is a DNS issue.

Frequently Asked Questions

Is Google DNS free?

Yes. Google Public DNS is free for personal and business use.

What is the secondary DNS server?

8.8.4.4

Does Google DNS increase speed?

It does not increase bandwidth. It improves DNS lookup speed and reduces delays.

Can I use this on all Linux distributions?

Yes. It works on Ubuntu, Debian, CentOS, AlmaLinux, and Rocky Linux.

How to check active DNS?

Use: cat /etc/resolv.conf or resolvectl status

For more help, see our guide on

Troubleshooting VPN connections on Linux
.

Follow us on
Facebook,
Twitter,
and
LinkedIn.

Subscribe to get free blog content to your Inbox
Loading

`

Related Posts