Categories: LinuxRouter Tricks

How to Tell Whether DNS Is Using Local Configuration Files or Router

I’ve setup Pihole recently which is an in-network DNS server which is designed to block ads by screening DNS requests against blacklists. I’ve set it up on a Raspberry Pi in a docker container. The IP address shows up as an internal ip address (say 192.168.1.198). My router than specifies that the DNS server should be 192.168.1.198. Any device on the network that specifies the router as its DNS server (or if network settings are set to automatic) then uses Pi Hole as its DNS server.

The problem with DNS is that it can be specified locally through a computer’s configuration files (e.g., in Windows using the Network Adapter property settings, or in Linux using the /etc/resolv.conf file) or as mentioned, on the network level through the router. That can lead to confusion as to what DNS you are using.

How do you know which nameserver your computer is using to get a particular address ? You could rely on looking at your configuration files, but a better way is using the nslookup tool in Linux.



nslookup google.com

That results in something like this showing that the request is using the router for its lookup:

Server:         192.168.1.1
Address:        192.168.1.1

Non-authoritative answer:
Name:   google.com
Address: 216.58.193.142
Name:   google.com
Address: 2607:f8b0:4000:816::200e

If I edit /etc/resolv.conf and specified google’s name servers I get:

Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.1.238
Name:   google.com
Address: 2607:f8b0:4000:816::200e


Simple, but very helpful when diagnosing problems.

Charlie

Recent Posts

Pi-Hole Easy: Using Docker with Macvlan To Block Ads Without Taking Over Your Server

Pi-Hole is a fantastic ad-blocking software that can run on a Raspberry Pi or pretty…

7 hours ago

DIY Covid 19 Masks from A&M University Biomedical Engineering

A team consisting of Texas A&M University faculty and graduate students in the Biomedical Engineering…

3 days ago

Generating a Random Post in WordPress Using Shortcodes Ultimate

Shortcodes Ultimate by Vladimir Anokhin is a popular plugin for Wordpress supplying numerous helpful shortcodes…

1 month ago

How to Get A Year’s Access to Thousands of Top Line Computer Books, Courses, and Live Seminars for $75

O'Reilly Media is that iconic media publisher most well known for its books having covers…

2 months ago

Fixing BCD Boot Problems After a Blue Screen of Death in Windows 10

Occasionally in Windows 10 when a Blue Screen of Death (or "BSOD") occurs similar to…

2 months ago

How To Easily Replace Camera Audio with External Microphone Audio Using Kdenlive

It's common for those recording musical or other performances to record audio separately from the…

2 months ago