Wright & Brown

A writing and research partnership | Karl Wright & Karen Brown

  • Home
  • Work
  • About
  • Blog

Who’s using my local DNS? Here’s how to find out

27th May 2016 By Karl Wright Leave a Comment

Use tail and grep to query your Bind server
‘Grep’ always reminds me of a made-up swear word from a comic book, like Judge Dredd’s ‘drokk‘!

Occasionally, I want to check and see what the kids are up to online. I don’t have a content filter set up yet (it’s on the to-do list) but we run Bind as a local-network domain name server (DNS). To see what someone’s doing, I just use the tail and grep utilities to view Bind’s log files.

Every time someone on the network clicks on a link or types in a URL, that request is routed via the local network DNS. Using tail lets me see current activity in DNS server’s log files. With grep, I filter out irrelevant information to see only the activity of the PC or laptop I’m interested in.

Using tail to check DNS activity from the command line

First, you need to tell Bind to log its activity. Without this, there won’t be anything for you to see. Open the command line and type this:

sudo rndc querylog

Check whether this has worked by typing the following:

sudo rndc status

Bind will spit out a chunk of text in response to this command. Look for the line:

query logging is ON

If it says OFF, then something has gone wrong. Try restarting Bind (sudo service bind9 restart) and then refer to the Bind troubleshooting tips on ubuntu.com.

Once querylogging is enabled, you can easily see current DNS activity by typing:

tail -f /var/log/syslog

The tail utility shows you the last 20 lines of any file, in this case syslog. The -f command stands for follow: telling tail to display new lines as the file grows. Now you just need to sit back and watch what everyone’s up to as they surf the web.

Befuddled by programmatic advertising

And that’s the catch. You’re watching everyone. It’s a little unethical and, even on a small network, impractical. If just one person connects to a major site, it generates dozens of DNS requests in seconds, as your browser pulls together all the dynamic ad-content required to build the page.

And that’s before you factor in activity from your home’s consoles, PCs and mobile devices all paging various cloud services and update servers. On even a moderately busy network, it very quickly becomes almost impossible to separate noise from meaningful data.

Filter out ad-servers with grep

The answer is grep. Grep is a tool that lets you parse a file for a specific word or term and then display only those lines in the file which contain that term. In our case, we want to see lines containing the IP address of the networked device we want to monitor.

Assuming that device in question has the static IP address 192.168.1.31, we type:

tail -f /var/log/syslog | grep  192.168.1.31

The functions of tail and -f remain unchanged. The command grep 192.168.1.31, tells the system that you only want to see lines containing the IP address 192.168.1.31.

So now you really can sit back and check the network activity of specific devices. In our screenshot, taken on a VMWare machine not the real server, we can see that someone is watching Netflix, checking out Facebook, and has just entered a Google search.

It’s not the most user friendly of systems. At times, it can be hard to filter out significant activity from requests to ad servers. And when someone is surfing a content-rich site such as YouTube, you can tell they’re on the site but not what they’re looking at.

But with a bit of attention, you can build a fairly good picture of what someone’s browsing. You can certainly see if someone’s surfing the web when they should be doing their homework.

Filed Under: Linux Tagged With: howto

Leave a Reply Cancel reply

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

Got a question?

    Then email us.    

Recent Posts

  • To win awards, Mindshare needed a new approach
  • Now explain highly technical AT&T networks to time-poor teachers
  • “We need the definitive e-commerce and payments guide”
  • How to make an auto-updating Gantt chart in Excel: part 2
  • Who’s using my local DNS? Here’s how to find out

Topics

customerexperience howto

Recent Posts

  • To win awards, Mindshare needed a new approach
  • Now explain highly technical AT&T networks to time-poor teachers
  • “We need the definitive e-commerce and payments guide”
  • How to make an auto-updating Gantt chart in Excel: part 2
  • Who’s using my local DNS? Here’s how to find out

Company information

  • Cookie Policy (UK)
  • contact@wrightandbrown.com

Copyright © 2025 · Modern Portfolio Pro Theme on Genesis Framework · WordPress · Log in

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behaviour or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}