How to Find and Change Your DNS Server on Linux
Domain Name System (DNS) is an essential system used to translate domain names to IP addresses on the internet. Every computer connected to the internet needs to have access to a DNS server to query IP addresses to access websites and online services. By default, your Linux operating system is configured to use the DNS server provided by your internet service provider (ISP). However, you may want to change your DNS server for improved performance or privacy reasons.
Finding Your Current DNS Server
Before making any changes, it’s important to first identify your current DNS server. To do this, follow the steps below:
- Open a terminal window by pressing the Ctrl + Alt + T keys simultaneously or by clicking on the terminal icon on your desktop.
- Type the command “cat /etc/resolv.conf” and press the Enter key. This will display your current DNS server and other network settings.
The output of the command may look like this:
“`
nameserver 192.168.0.1
“`
This means that your current DNS server is set to 192.168.0.1.
Changing Your DNS Server
Now that you know your current DNS server, you can proceed to change it. You can change your DNS server manually or by using a tool like Network Manager, which is available on most Linux distributions.
Method 1: Changing DNS Manually
To change your DNS server manually, follow these steps:
- Open the terminal window.
- Edit the resolv.conf file using the nano editor by typing the command “sudo nano /etc/resolv.conf” and press the Enter key.
- In the editor window, delete the current DNS server address and replace it with the new DNS server address you want to use. You can use any DNS server address of your choice. Some popular options include Google DNS (8.8.8.8, 8.8.4.4) and Cloudflare DNS (1.1.1.1, 1.0.0.1).
- Save the changes by pressing the Ctrl + X keys, then press the Y key, and then press the Enter key.
- Restart the networking service by typing the command “sudo service networking restart” and press the Enter key.
Method 2: Changing DNS using Network Manager
To change your DNS server using Network Manager, follow these steps:
- Click on the network icon located at the top right corner of your desktop.
- Select the Network Settings option.
- In the Network Settings window, click on the gear icon next to your network connection.
- Click on the IPv4 or IPv6 tab, depending on the connection type you want to configure.
- Under the DNS section, select the Automatic option and toggle it off.
- Add your new DNS server addresses in the DNS field separated by commas (e.g., 8.8.8.8, 8.8.4.4).
- Save the changes.