DNS change - server99s

How to change the DNS of the Linux Machine

DNS or the Domain Name Server is a proof of your current Location. It is managed by your local ISP( Internet Service Provider). When your current DNS settings are misconfigured or you need to spoof it for some educational purpose, you should always know how to change the DNS of your local Linux Machine.

It is an easy and smooth process. First, you need to find your resolv.conf file. Follow this post to learn how to change your DNS step by step.

Update your configuration file

Most of the Linux distros have their resolv.conf file located in the /etc folder. You can simply find it at /etc/resolv.conf.

To open this file, use cat or less commands. They display the content of the file in your terminal

[boogieman@b00gi3m4n ~]$ cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 177.xxx.xx.x
nameserver 2403:xxx:xxxx:xxxx::xx
[boogieman@b00gi3m4n ~]$ 

Of course, I have hidden my original DNS settings behind xx for security issues. As you can see there is a “# Generated by NetworkManager“. It means these files have been modified by your Network Manager in response to your local ISP.

Both of these lines starting with “nameserver” define a DNS server setting. Therefore these settings are automatically generated and the system does not know what to do with them until after it is connected to the internet and a domain.

There should be at least 1 DNS server setting available in the resolv.conf file. If there is no file available, you can create with nano or a similar editor. We will use nano to edit this file. REMEMBER, you need root privileges to update/edit this file.

[root@b00gi3m4n boogieman]# nano /etc/resolv.conf 
# Generated by NetworkManager
nameserver 177.xxx.xx.x
nameserver 2403:xxx:xxxx:xxxx::xx

now you have to update this file. You can assign a minimum of 1 or a maximum of 3 nameservers for this setting. The system reads this file in ascending order. It means the nameserver setting mentioned on the top will be read by the system first. If this setting is incorrectly updated or is not available in the server location, the system will move to the set below it (#2)

List of the DNS servers

You can use any of these DNS servers for your resolv.conf file.

DNS SERVERDNS SETTING
OpenDNS208.67.222.222
Cloudflare1.1.1.1
Google8.8.8.8
Comodo Secure8.26.56.26
Quad99.9.9.9
VeriSign Public64.4.65.6
OpenNIC13.239.157.177
UncensoredDNS91.239.100.100
Yandex DNS77.88.8.7

Choose any of these setting from the list and update your file like this

# Generated by NetworkManager
nameserver 77.88.8.7     
nameserver 1.1.1.1

Check out this screenshot of my current DNS settings below.

Make sure you do a Ping Check before visiting any website on the internet. You can also visit this website to check if your DNS is leaking.

Ping Check

[root@b00gi3m4n boogieman]# ping server99s.com
PING server99s.com (162.252.83.203) 56(84) bytes of data.
64 bytes from 162-252-83-203.static.hvvc.us (162.252.83.203): icmp_seq=1 ttl=46 time=378 ms
64 bytes from 162-252-83-203.static.hvvc.us (162.252.83.203): icmp_seq=2 ttl=46 time=344 ms
64 bytes from 162-252-83-203.static.hvvc.us (162.252.83.203): icmp_seq=3 ttl=46 time=275 ms
64 bytes from 162-252-83-203.static.hvvc.us (162.252.83.203): icmp_seq=4 ttl=46 time=589 ms
^C
--- server99s.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 274.897/396.287/588.912/117.220 ms

Conclusion

It is working perfectly for my case. Now you know how to change the DNS of your Linux machine. Tell me in the comments if you run into any problems. I’ll be happy to help.

This tutorial/guide teaches you how to change your DNS. It is for educational purposes only. Indulging in any illegal activity and misusing this without the written permission of the party is a criminal offense and we DO NOT promote any illegal activity. It is advised to use it only for educational/white hat purpose.

If you liked it found it informative, please do share it on your social media and with your friends. It helps us keep the blog running and so much more can be shared in lesser time. It only takes a click.

Help us Grow | Share on your social Media

Leave a Reply

Your email address will not be published. Required fields are marked *