dns-hosts

Langue: en

Version: dnsutl (mandriva - 01/05/08)

Section: 1 (Commandes utilisateur)

NAME

dns-hosts - generate /etc/hosts entries from DNS tables

SYNOPSIS

dns-hosts [ option... ][ infile [ outfile ]]
dns-hosts -Help
dns-hosts -VERSion

DESCRIPTION

The dns-hosts program is used to generate the /etc/hosts entries from DNS tables.

If the input file is not named, or the name '-' is used, the standard input is read.

If the output file is not named, or the name '-' is used, the startdard output is written.

OPTIONS

The following options are understood:
-Delete_Foreign_Names
This option may be used to delete A and NS records which reference names in domains outside the domain specified in the closest preceeding SOA record.
-Verbose

This option may be used to see what dns-hosts deciphers each resource record as.
-Help

This option may be used to get more information about how to used th dns-hosts program.
-VERSion

This option may be used to see what version of the dns-hosts program is running.
-Idirectory

This option may be used to set the search path for include files.

All other options will produce a diagnostic error. Options may be abbreviated, the minimum abbreviation is shown in upper-case. Options are case insensitive. Options and file names may be mixed arbitrarily on the command line.

EXIT STATUS

The dns-hosts command will exit with a status of 1 on any error. The dns-hosts command will only exit with a status of 0 if there are no errors.

EXAMPLE

The idea is that you have all of the information concerning each computer in the one file. This makes it less likely that something will be omitted, and simpler to change if the name or IP address changes.

Given a database file called ``example.com'' and which contains the following text

 
 $origin example.com.
 @       in      soa     exmaple.com. hostmaster.example.com. (
                         990101001       ; serial
                         10800           ; refresh: 3 hours
                         1800            ; retry: 30 minutes
                         3600000         ; expire: 1000 hours
                         86400 )         ; minimum: 24 hours
 mercury in      a       182.168.1.1
         ether   a       2:7:1:f:b7:fb
         in      hinfo   "IBM-PC 486" "MSDOS"
 venus   in      a       182.168.1.2
         ether   a       2:60:8c:2d:20:c4
         in      hinfo   "IBM-6000/590" "UNIX AIX 3.2.5"
 earth   in      a       182.168.1.3
         ether   a       08:00:20:79:1f:0d
         in      hinfo   "Sun-4/5 (SPARCstation 5)" "UNIX SunOS 5.4"
 mars    in      a       182.168.1.4
         ether   a       aa:0:4:0:86:53
         in      hinfo   "DEC-Alpha 3000" "UNIX OSF/1 V3.2"
 jupiter in      a       182.168.1.5
         ether   a       8:0:2b:99:49:ad
         in      hinfo   "DEC-VXT2000+ XTerminal" "Other: X11R5"
         bootp   tc      dec-vxt-2000
 saturn  in      a       182.168.1.6
         ether   a       0:40:10:56:43:57
         in      hinfo   "Apple-Macintosh IIsi" "MacOS 7.5.3"
 neptune in      a       182.168.1.7
         ether   a       0:aa:0:69:7c:5b
         in      hinfo   "IBM-PC" "MSDOS"
 uranus  in      a       182.168.1.8
         ether   a       0:0:e8:a4:0:25
         in      hinfo   "IBM-PC" "MSDOS"
 pluto   in      a       182.168.1.9
         ether   a       8:0:9:d:2a:87
         in      hinfo   "HP-Laser-Jet 4" "None"
 lp      in      cname   pluto
 
You can generate the /etc/ethers file using the following command
 % dns-hosts example.com /etc/ethers
 %
 
Here is what you would see as the output
 
 182.168.1.1     mercury
 182.168.1.2     venus
 182.168.1.3     earth
 182.168.1.4     mars
 182.168.1.5     jupiter
 182.168.1.6     saturn
 182.168.1.7     neptune
 182.168.1.8     uranus
 182.168.1.9     pluto lp
 
Note that the output uses relative names.

Makefile

All of this can be automated using the following makefile fragment:
 
 /etc/hosts: example.com
         dns-hosts example.com $@
 
By doing this, all you need to do is edit the example.com file, and the use the make(1) command to bring everything up-to-date.

If you were using NIS, NIS+ or LDAP you would update them, rather than the static file.

dns-hosts version 1.8,
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Peter Miller; All rights reserved.

The dns-hosts program comes with ABSOLUTELY NO WARRANTY; for details use the 'dns-hosts -VERSion Warranty' command. The dns-hosts program is free software, and you are welcome to redistribute it under certain conditions; for details use the 'dns-hosts -VERSion Redistribution' command.

AUTHOR

Peter Miller E-Mail: millerp@canb.auug.org.au
/\/\* Web: http://www.canb.auug.org.au/~millerp/