How to Change Your DNS Server on Your Device?
In this guide, I’ll discuss several ways to change the DNS server on your device, whether you have a Windows machine, Linux or MacOS.
Why would you change your DNS server?
Well, the DNS Servers of your ISP can do the job required to serve your DNS queries, however, there are some benefits that you can get from Third-Party DNS providers like Security, faster responses, and better privacy compared to your ISP’s DNS servers.
Also, some DNS Providers support DNS-over-Https (DoH) which encrypts your DNS Query for extra security.
What are the best Third-Party DNS Providers available?
1) Google Public DNS (8.8.8.8 & 8.8.4.4 ):
fast response and highly available DNS Servers.
2) Cloudflare DNS (1.1.1.1 & 1.0.0.1 ):
focused on privacy, and supports DNS-over-Https (DoH) and DNS Over TLS ( DoT ).
3) Quad9 (9.9.9.9) :
focused on security, it provides a mechanism to block malware and suspicious websites.
4) OpenDNS (208.67.222.222 & 208.67.220.220 ):
provides adult content blocking (parental control ) with a paid version providing advanced security for businesses.
Changing DNS Servers on Windows:
From Settings:
Open windows settings from your startup menu, the Go to “Network & Internet” >> “Advanced network settings”:
Now, Choose your connection whether it’s Wi-Fi or Ethernet and expand it, then on “More adapter options” click on “Edit”:
The Properties tab will open, Look for the option “Internet Protocol Version 4 (TCP/IPv4)”, then double click on it:
When it opens, toggle the option “Use the following DNS server Addresses”, then add your new DNS Server IP Addresses, then Click “OK”:
Then click again on “OK”.
Using Command Prompt:
Open Command Prompt as Administrator:
On the Command Prompt, write the command netsh interface show interface,
Then, choose the name of the interface that you are using.
Next, enter this command to setup the first static dns server:
netsh interface ip set dns “<your interface name>” static <first dns ip>
Then, enter this command to setup the second dns server:
netsh interface ip add dns “<your interface name>” <second dns ip> index=2
Then clear the DNS Cache with the command ipconfig /flushdns
Changing DNS Servers on Linux:
To change the DNS Settings on Linux, we need to modify the file /etc/systemd/resolved.conf
Once the file opened, scroll down to the section [Resolve] :
You will find the line #DNS=
Uncomment the “DNS=” line and change it to “ DNS= <first dns ip> <second dns ip>”
Same as below:
Then, click “ctrl+o” to save it, then hit Enter, and click “ctrl+x” to Exit from the editor.
To Clear the DNS Cache on Linux:
restart the systemd-resolved service, with the command sudo systemctl restart systemd-resolved
Changing DNS Servers on MacOS:
To change the DNS Settings on your MacOS, open “System Preferences” in your Finder app:
Go to “Network” Section:
On the left, choose your connection type that’s connected to the internet, it can be wifi or ethernet,
Than, Click on “Advanced” :
On the DNS tab, locate the + sign to Add DNS Servers:
Add your DNS Server IP Addresses, then click “OK”:
Check your setting, make sure your DNS Servers appear, then click “Apply” :
To clear the DNS Cache on your Mac:
Open Utilities from Your Finder app:
Find and Open the “Terminal” app:
On the Terminal , write the following command line, then hit Enter:
Sudo killall -HUP mDNSResponder
DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT) For Extra Security:
DoH and DoT are two methods to increase the security of your DNS Queries by encrypting the DNS Queries.
Enable DNS-over-HTTPS on Windows 11:
On Settings, open the connected interface, could be WiFi or Ethernet, then expand it.
Noq, open “View additional properties”:
Click on “Edit”:
For Preferred DNS, turn on “DNS over HTTPS”.
Do the same for “Alternate DNS”, then click “Save”:
Enable DNS-over-TLS on Linux:
Currently, Linux Systemd-Resolved only supports DoT.
To enable it, open the file /etc/systemd/resolved.conf with the command:
sudo nano /etc/systemd/resolved/conf
Change the line DNSSEC and DNSOverTLS to YES:
DNSSEC=yes
DNSOverTLS=yes
Then, click “ctrl+o” to save it, then hit Enter, and click “ctrl+x” to Exit from the editor.
restart the systemd-resolved service, with the command sudo systemctl restart systemd-resolved
Conclusion:
changing your DNS server can provide significant advantages in terms of security, speed, and privacy. By switching to a third-party DNS provider, you gain options like DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT), which offer encrypted DNS queries for extra protection. The steps for configuring DNS settings may differ across Windows, Linux, and MacOS, but the process is relatively straightforward on each platform.