2008/05/13

The Labs.Com Admin Lab DNSTool
Last update 2003/02/02
The Labs - Design & Functionality For The Net

Tool to handle domains with BIND-4.x/8.x

$MyVersion: 0.021 - Sun Feb 2 15:02:08 CET 2003 - kiwi$

  1. Purpose
  2. Disclaimer
  3. Source-Code
  4. Usage
  5. Syntax
  6. Sample Files
  7. Further Infos
  8. Literature
DNSTool
1. Purpose
We run DNS (bind-4.x & bind-8.x or also called named) and I studied the files I had to write in order to serve different virtual domains and MX, A and CNAME records and I thought to make it much more simple, dnstool is a small perl-script which just serves my desire, maybe yours too.

Jan 30, 2001: Multiple BIND Volnerabilities again, like every year; now is just enough, we switch now to DJBDNS (same author as qmail, sendmail replacement this is). The DNSTool will updated for djbdns and also other BIND alternatives support as well.

DNSTool
2. Disclaimer

This program comes WITHOUT ANY WARRANTY AND NO SUPPORT.

DNSTool
3. Source-Code

dnstool, you require perl, copy it into /usr/sbin/.

 $MyHistory$ 
    02 Feb 2003: 0.021: -zones-only and -conf-conly as switches . 
    24 Jan 2003: 0.020: support of * as host . 
    23 Apr 2001: 0.019: explicit cname supported . 
    02 Feb 2001: 0.018: secondary dns fix . 
    02 Feb 2001: 0.017: bug fix serial-no . 
    26 Jun 2000: 0.012: bind-8.x support (default) . 
    30 Mar 1998: 0.008: secondary dns support. 
    17 Nov 1997: 0.001: first version. 

DNSTool
4. Usage

Bind-8.x
 

 % dnstool domains 

which creates various db.* files, and named.conf.

Bind-4.x
 

 % dnstool -dns4 domains 

to creates various db.* (same as under bind-8.x) and named.boot.

Don't forget to give named a HUP so the new data are loaded:

 % ps -aux | grep named 
 ... you get process id (pid) then 
 % kill -HUP <pid> 

Having dnstool doesn't avoid you get to know DNS by yourself, it's just a tool, you still should analyze the result and understand what your named-files actually do.

DNSTool
5. Syntax

domain name
starting dns-definition of domain
dnstime a b c d
refresh times, use 86400 3600 1296000 604800
primary hostname
primary dns
secondary hostname
secondary dns
mx priority hostname
use for priority 10-100
domainip ip
have domain resolve too (good for having http://domain without www.)
network subip submask
e.g. 192.168.0 255.255.255.0
host sub-dom1 ... subdomN ip
add 'www', 'ftp' etc and such

secondary-dns domain ip
domains you serve 2nd-dary dns
cname hostname full-qualified-host
define an alias (CNAME), e.g. cname me me.test.org

Hint for BIND 8.x/9.x: If you require to add special options in named.conf call dnstool normally once, and then after only with the -zones-only switch so your edited named.conf is not overwritten.

DNSTool
6. Sample Files

domains sample-file:

 # -------------------------------------------------- 
 # Howto: edit it, and run 'make' in this directory 
  
 path /var/named/ 
  
 # -------------------------------------------------- 
  
 domain          mycompany.com 
 dnstime         86400 3600 1296000 604800 
 primary         master.mycompany.com 
 secondary       dns.sample1.com 
 secondary       dns.sample2.com 
 mx              10         master.mycompany.com 
 domainip        128.121.10.91 
 network         192.123    255.255.255.0 
  
 host            master www dns ftp irc  192.123.42.32 
  
 host            members    192.124.1.2 
 host            www.za     128.12.12.1 
 host            www.nz     128.12.12.5 
 host            www.eu     195.75.1.1 
 host            www2.eu    195.75.1.1 
 host            www3.eu    134.12.7.1 
  
 domain          anotherdomain.com 
 dnstime         86400 3600 1296000 604800 
 primary         master.anothercompany.com 
 secondary       dns.anothersecondary.com 
 mx              10         master.anothercompany.com 
 network         192.124    255.255.255.0.0 
  
 host            master www dns ftp irc 192.124.1.2 
  
 host            members    192.124.1.1 
 host            www.za     196.34.2.2 
 host            www.eu     195.75.1.1 
 host            www2.eu    195.75.1.1 
 host            www3.eu    195.75.1.1 

Makefile

 all::    
    dnstool domains 

DNSTool
7. Further Infos

ISC.ORG: BIND Source
Get the latest bind (named)
DJB-DNS
Alternative to BIND
MaraDNS
Another DNS
DNS Resource Directory
Stuff only system-admin cares about

DNSTool
8. Literature

"DNS and BIND - Paul Albitz & Cricket Liu, O'Reilly & Associates, Inc..
Buy it, it's worth and gives you a reference how to handle and debug named stuff

                                                                                                                                   

UndoRM Admin LabNet Security

Last update 2003/02/02

All Rights Reserved - (C) 1997 - 2008 by The Labs.Com

Top of Page

The Labs.Com