Command Dump – One line method to find errors in a large list of bind zone files

I have found need to go through a large list of bind zone files and find any that have errors.

This loop helps me identify them:

 

for a in `ls db.*.*|grep -v db.local.`; do named-checkzone localhost $a 2>&1 >/tmp/tmp; if [ "$?" != "0" ]; then echo "ERROR ON:$a"; cat /tmp/tmp; fi; done|more

 

  • ls db.*.*|grep -v db.local.` – list each file that you would like to check (I listed all files with db.*.* and excluded any of them that started with db.local.)
  • named-checkzone localhost $a 2>&1 >/tmp/tmp – run the check and save the results to a temp file
  • if [ “$?” != “0” ]; then echo “ERROR ON:$a”; cat /tmp/tmp; fi; – if the command fails then print out the file name and the results

Matraex Domain Lookup Services

Matraex provides Website Design and Development services to local, regional and national business in many industries.   One step that is often overlooked,  for new websites and new ideas,  is the selection and purchase of a Domain Name.

Many times our clients will already have picked out or purchased their domain name.    However,  many times,  they have an idea,  but have not purchased a domain name for it.  In these cases,  we will search available names, suggest, propose and ultimately help our clients select their domain name.

Once selected,  we can quickly purchase and setup the domain name with our name servers to enable our web and mail services.   Often the process takes only a few minutes with the biggest delay is from our clients as they decide which available domains to choose.

Bulk Domain Search

There are a few cases when the process of purchasing domains is a bit more involved.  In particular, when clients would like to purchase a portfolio of domain names for related websites or services (or simply to make sure no competing company has access to them).   In this case,  clients will often do their own searches,  there are plenty of bulk domain lookup tools out there.   Name.com bulk search is one of my goto searches since we register all of our domains through them,  however this only works to help us quickly lookup availability of names that we already know.  The client often does these searches on there own.

When the client is not sure what they want to do,  we often spent a bit more time finding names using some of the bulk domain suggestion tools,   in this case we have to dig a little deeper to find good suggestion tools.  The suggestion tools below try synonyms in their search for a perfect domain name:

If you have a list of words that you want to easily find a good combination for try: bustaname.com.   You will need to know all of the synonyms you would like to try,  but the interface is great.

Domain Broker

In a few cases,  we have worked to seek and negotiate the purchase of a domain name for a client.   Occassionally clients have wanted to keep their names out of the offer,  because sellers can get big eyes and ask for more money.

In these cases we have used our name to purchase the domain name.

The services above are typically free when we also do the Website Design for the domains,   otherwise we offer the services on a simple hourly consulting basis.

DNS Nameserver Response Comparison Tool

DNS Nameserver Response Comparison Tool

Over the years, as we have worked with setting up Nameservers with A records we have found that it can be a rather complex task. So we made a DNS Nameserver Response Comparison Tool.

The work of configuring the servers is straight forward (we prefer to work with Bind on Ubuntu). We have come up with ways of automating the configuration in order to manage the large numbers of domains our Name Servers handle. However when an issue comes up it can take a considerable amount of time to identify differences between the servers.

The time that it takes for records to propagate throughout the internet and simultaneous whois record updates can add confusion.DNS Nameserver Response Comparison Tool

So,  we came up with the Nameserver Results Compare Tool.

  1. Enter Nameserver 1  and Nameserver 2
  2. Enter a list of domain names
  3. Review the results with discrepancies highlighted

The link to the tool is here:

https://www.matraex.com/nameserver-compare.php

Some other uses of the tool:

  • Know whether a new Nameserver correctly reports all of your domain names,  before you put it in production
  • Compare googles 8.8.8.8 Nameserver results against your own.
  • Identify when a recursive name server is caching the results in stead of requesting them from the authoritative source

As of this writing,  the tool is new.   If it is anything like the Bulk MX and DNS Lookup Tool we will likely add new features as we find new uses for it.

Some of the potential new features we could see for the future:

  • Add multiple additional name servers
  • Save frequently used name servers
  • Add different record types (MX, TXT, CNAME)
  • Control and report on the recursive portion of the request
  • Track the comparison history

If you find this tool to be useful,  please do provide a review for us.  If you think of an enhancement that could make this DNS Nameserver Response Comparison Tool even more useful,  please let us know (email: dnsutil @ matraex.com )

Bulk MX and DNS lookup enhanced

Bulk MX and DNS lookup enhanced

Bulk MX and DNS lookup enhanced

As our bulk MX and DNS tool has become more popular, Google has sent many people to our site looking for all sorts of DNS lookup tools.  It seems that I was not the only one that needed a simple way to quickly gather DNS information on multiple domains at once

 Many people have been able to quickly  find all of the information they need about a domain (A, MX, NS and WHOIS records) and they move on.  It turns out that even though the tool had the ability to lookup records for multiple domains at once, it is also useful for getting a quick DNS overview of a single domain.   Web professionals often bookmark the tool and come back often.

The tool evolves as we get special requests,  so my request to you is: let me know if I can add some functionality to the tool for you.

Several new features have been added in the last month.

  • A premium option allows you to buy credits to remove usage limits
  • Whois lookups are turned off on larger requests in order to avoid abuse restrictions
  • Large scale lookups can be started by uploading a text file with one domain per line.
  • For each file upload a background process builds a downloadable CSV file listing one dns record result per lin
    • A row for each www and @ A record with the ip address
    • One row for each MX record
    • One row for each NS record
    • One row displaying the ip addresses for each MX record.
  • As the process builds the records file in the background ,  you can refresh the page withe your premium code in it and watch the progress.

Future upgrades may include

  • The ability to choose to only lookup certain record types (A, MX or NS)
  • Multithreading options to speed up background lookups.
  • They ability to choose the download format of the DNS results list.

If you find the tool useful or you would like a certain type of enhancement, please leave a comment or send us a comment.

If you happen to be a techie that has to look at log files with timestamps, take a look at the tool that bulk converts timestamps to readable dates.  You can just cut an paste a big block of text from you log and click

Configuring Bind9

Configuring Bind9

This doc will show how to create the conf files for and test bind9.

Configuration files are located at /etc/bind

Become root

Create a sub-directory to store the conf files. In this doc, it will be “zones”

cd /etc/bind/
mkdir zones

Copy the default conf file that you’ll use to zones

cp db.local ./zones/example.com.db.local

Where example.com is your domain

Edit this file

cd zones
nano example.com.db.local

 

The file should appear as follows:

;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA localhost. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1

make the changes to the file to appear as this:

NOTE: Don’t forget the periods after the domain names

xxx.xxx.xxx.xxx = the target machines’ IP Address

;
; BIND data file for local loopback interface
;

$TTL 604800

@ IN SOA example.com. host.example.com. (

2 ; Serial

604800 ; Refresh

86400 ; Retry

2419200 ; Expire

604800 ) ; Negative Cache TTL

;

@ IN NS ns1.example.com.

@ IN A xxx.xxx.xxx.xxx

@ IN AAAA ::1

;

ns1 IN A xxx.xxx.xxx.xxx

mail IN A xxx.xxx.xxx.xxx

www IN A xxx.xxx.xxx.xxx
;

example.com. IN MX 10 mail.example.com.

;

Computer-Name IN CNAME www

These changes will create “A” records for ns1, (which is your dns server), and also mail and www.
It further creates an MX or Mail Exchange record for mail.example.com.
It creates an alias, or “CNAME” for “Computer-Name”.

Rules to remember:
a ; is used to uncomment. # doesn’t work here.
in-addr.your MX record must have a corresponding “A” Record. It can’t be a CNAME.

Now, create a file in your zones directory titled example.com.in-addr.arpa.local. This is for reverse lookups.

Edit the file to look like this:

$TTL 604800

@ IN SOA example.com. root.example.com. (

2010081401;

28800;
604800;

604800;
86400 );
;
IN NS ns1.example.com.

4 IN PTR example.com.

Edit the file /etc/bind/named.conf.local

This is where you’ll point the bind service to the files that you created in the zones directory

Make the file look like this:

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include “/etc/bind/zones.rfc1918”;
zone “example.com” { NOTE: THIS DOMAINNAME ENTRY IS, IN FACT, IN QUOTES
type master;
file “/etc/bind/zones/example.com.db.local”;
};

zone “3.2.1.in-addr.arpa” {
type master;
file “/etc/bind/zones/example.com.in-addr.arpa.local”;
};

As you can see in the example above, The “file” statements correspond with the path and filenames you created.

Restart the service:
service bind9 restart

To test:
Look at the syslong file
grep bind /var/log/syslog

It should look something like this:

Jan 26 15:54:13 mtxfarm-matt-test named[4602]: starting BIND 9.8.1-P1 -u bind
Jan 26 15:54:13 mtxfarm-matt-test named[4602]: built with ‘–prefix=/usr’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–sysconfdir=/etc/bind’ ‘–localstatedir=/var’ ‘–enable-threads’ ‘–enable-largefile’ ‘–with-libtool’ ‘–enable-shared’ ‘–enable-static’ ‘–with-openssl=/usr’ ‘–with-gssapi=/usr’ ‘–with-gnu-ld’ ‘–with-geoip=/usr’ ‘–enable-ipv6’ ‘CFLAGS=-fno-strict-aliasing -DDIG_SIGCHASE -O2’ ‘LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro’ ‘CPPFLAGS=-D_FORTIFY_SOURCE=2’
Jan 26 15:54:13 mtxfarm-matt-test named[4602]: loading configuration from ‘/etc/bind/named.conf’
Jan 26 15:54:13 mtxfarm-matt-test named[4602]: reading built-in trusted keys from file ‘/etc/bind/bind.keys’
Jan 26 15:54:13 mtxfarm-matt-test named[4602]: set up managed keys zone for view _default, file ‘managed-keys.bind’

Look for errors or warnings

Use the command “dig” using one of the FQDN’s that you defined in you example.com.db.local file:
dig mail.example.com @xxx.xxx.xxx.xxx

in place of xxx.xxx.xxx.xxx, use your new dns server’s ip address.

You should see this:

; <<>> DiG 9.8.1-P1 <<>> mail.test-matt.com @206.207.94.34
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48761
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;example.com. IN A

;; ANSWER SECTION:
mail.example.com. 604800 IN A xxx.xxx.xxx.xxx

;; AUTHORITY SECTION:
example.com. 604800 IN NS ns1.example.com.

;; ADDITIONAL SECTION:
ns1.example.com. 604800 IN A xxx.xxx.xxx.xxx

;; Query time: 1 msec
;; SERVER: xxx.xxx.xxx.xxx#53(xxx.xxx.xxx.xxx)
;; WHEN: Mon Jan 26 16:02:52 2015
;; MSG SIZE rcvd: 86

add an “mx” to the end of that dig command and use just the domain name (example.com) to test your mx record.

dig example.com @xxx.xxx.xxx.xxx mx

It should look like this:

; <<>> DiG 9.8.1-P1 <<>> mail.test-matt.com @206.207.94.34 mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26489
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;mail.example.com. IN MX

;; ANSWER SECTION:
example.com. 604800 IN MX 10 mail.example.com.

;; AUTHORITY SECTION:
example.com. 604800 IN NS ns1.example.com.

;; ADDITIONAL SECTION:
mail.example.com. 604800 IN A xxx.xxx.xxx.xxx
ns1.example.com. 604800 IN A xxx.xxx.xxx.xxx

;; Query time: 1 msec
;; SERVER: xxx.xxx.xxx.xxx#53(xxx.xxx.xxx.xxx)
;; WHEN: Mon Jan 26 16:06:10 2015
;; MSG SIZE rcvd: 77

Matt Long
01/26/2015

Bulk Domain NS, MX and A record lookup tool

Summary: We have two tools to help you lookup information on domains quickly

Bulk Domain NS, MX and A record lookup tool

Occassionally, we come across some sort of project in which we have to work through a list of multiple domain names and make some sort of changes.

In some cases we simply have to update contact records, in other cases we have to determine ownership, hosting and mail setups so we can assist with an ownership transfer.

There are a plethora of domain tools out there which help one at a time, But we were hard pressed to find a tool that could do a bulk lookup of multiple domains with table based out put.

 

So, we built the toolBulk Domain NS, MX and A record lookup tool

https://www.matraex.com/quick-domain-research.php

This tool has the

  • A records for the root domain (@) and the (www) domain.
  • MX records for the root domain
  • NS records for the root domain

This tool was thrown together quickly to help us identify whether an OLD but active nameserver, which had dozens of domain names on it,  was actually being used for the domains.

We were able to delete more than 20 domains cluttering up the DNS entries.

Additionally we were able to clean up associated webservers that had not been cleaned of hosting accounts after a client left the account.

Some future ideas which will make their way in next time:

  • Display whois information for the domain
  • Optionally group the domains based on which name servers, whois records or www C class they are hosted at

Bulk Domain NS, MX and A record lookup tool


Update 11/28/2015 by Michael Blood

Since this original post,  we have added several new features including the ability to upload a file with a large batch upload, and download a CSV file with the results.  You can see all of the details in this Enhanced Bulk Domain NS, MX and A record lookup tool post.

 

 

 

 

 

 

 

Call Now Button(208) 344-1115

SIGN UP TO
GET OUR 
FREE
 APP BLUEPRINT

Join our email list

and get your free whitepaper