Watch all our Tutorials and Training Videos for Free on our Youtube Channel, Get Online Web Tools for Free on swebtools.com

Search Suggest

How to Set DNS to 8.8.8.8 in Linux?

How to Set DNS to 8.8.8.8 in Linux, ?, linux dns server, linux dns server configuration, simple dns server linux, configure dns
How to Set DNS to 8.8.8.8 in Linux

As a Linux user, you may want to set your DNS server to 8.8.8.8, which is a widely used DNS server by Google. In this article, we will guide you on how to set DNS to 8.8.8.8 in Linux.

Domain Name System (DNS) is a system that translates domain names into IP addresses. DNS servers act as a directory service for the internet, and they are responsible for resolving domain names to IP addresses.

By default, your Linux system will use the DNS servers provided by your internet service provider (ISP). However, you may want to use a different DNS server for various reasons, such as to improve your internet speed or to bypass censorship. One popular DNS server is 8.8.8.8, which is operated by Google.

Table of Contents

  1. Checking the current DNS server
  2. Editing the /etc/resolv.conf file
  3. Setting the DNS server using Network Manager
  4. Setting the DNS server using systemd-resolved
  5. Verifying the DNS server

Checking the current DNS server

Before setting the DNS server to 8.8.8.8, you may want to check the current DNS server. To do this, open the terminal and type the following command:

cat /etc/resolv.conf

This command will display the current DNS server.

Editing the /etc/resolv.conf file

The /etc/resolv.conf file is a configuration file that contains information about the DNS servers to use. To set the DNS server to 8.8.8.8, you need to edit this file. To do this, open the terminal and type the following command:

sudo nano /etc/resolv.conf

This command will open the /etc/resolv.conf file in the nano text editor. Then, add the following line at the top of the file:

nameserver 8.8.8.8

Save the changes and exit the text editor.

Setting the DNS server using Network Manager

If you are using a desktop environment that uses Network Manager, you can set the DNS server using the graphical interface. To do this, follow these steps:

  1. Click on the network icon in the system tray.
  2. Select "Network Settings" or "Network Connections."
  3. Select your network connection and click on the gear icon.
  4. Select the "IPv4" or "IPv6" tab, depending on your network configuration.
  5. In the "DNS" section, select "Manual" and add 8.8.8.8 to the DNS servers list.
  6. Click "Apply" and close the window.

Setting the DNS server using systemd-resolved

If you are using a newer version of Linux that uses systemd-resolved, you can set the DNS server using the following steps:

  1. Open the terminal and type the following command:
sudo systemctl edit systemd-resolved
  1. This command will open a new file in the text editor. Add the following lines to the file:
[Resolve]
DNS=8.8.8.8
  1. Save the changes and exit the text editor.
  2. Restart the systemd-resolved service using the following command:
sudo systemctl restart systemd-resolved

Verifying the DNS server

After setting the DNS server to 8.8.8.8, you may want to verify that it is working correctly. To do this, open the terminal and type the following command:

nslookup example.com

Replace "example.com" with any domain name you want to test.

Related Searches and Questions asked:

  • Does Malwarebytes Work for Linux?
  • Is Linux Mint Secure for Online Banking?
  • Do I Need Antivirus with Linux Mint?
  • What Antivirus Should I Use for Linux Mint?
  • That's it for this post. Keep practicing and have fun. Leave your comments if any.