dns-dhcp

Langue: en

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

Section: 1 (Commandes utilisateur)

NAME

dns-dhcp - generate dhcp tables from DNS tables

SYNOPSIS

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

DESCRIPTION

The dns-dhcp program is used to generate portions of the /etc/dhcp.conf file from the forward DNS tables, augmented with ``ether a'' entries.

This is supplemented with an additional ``dhcp'' class, so that extra information may be defined.

The output format is described in the dhcpd (8) manual entry. Usually, the output of the dns-dhcp command is included into the /etc/dhcp.conf file, rather then define the entire file with the output in the dns-dhcp command.

DHCP TYPES

The ``dhcp'' class has the following defined types:
filename
The absolute path of the bootfile.

THE * DEFAULT

The special host name ``*'' may be used to specify defaults. These may be over-riden by specific entries. The most recently see default of each type name is remembered. This may be exploited, for example, to set different servers and gateways for different networks.

OPTIONS

The following options are understood:
-Help

Provide some help with using the dns-dhcp program.
-VERSion

Print the version of the dns-dhcp program being executed.

All other options will produce a diagnostic error.

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-dhcp command will exit with a status of 1 on any error. The dns-dhcp 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/dhcp.conf file using the following command
 % dns-dhcp example.com /etc/dhcp.conf
 %
 
Here is what you would see as the output
 
 host mercury {
         fixed-address 182.168.1.1;
         hardware ethernet 02:07:01:0f:b7:fb;
 }
 host venus {
         fixed-address 182.168.1.2;
         hardware ethernet 02:60:8c:2d:20:c4;
 }
 host earth {
         fixed-address 182.168.1.3;
         hardware ethernet 08:00:20:79:1f:0d;
 }
 host mars {
         fixed-address 182.168.1.4;
         hardware ethernet aa:00:04:00:86:53;
 }
 host jupiter {
         fixed-address 182.168.1.5;
         hardware ethernet 08:00:2b:99:49:ad;
 }
 host saturn {
         fixed-address 182.168.1.6;
         hardware ethernet 00:40:10:56:43:57;
 }
 host neptune {
         fixed-address 182.168.1.7;
         hardware ethernet 00:aa:00:69:7c:5b;
 }
 host uranus {
         fixed-address 182.168.1.8;
         hardware ethernet 00:00:e8:a4:00:25;
 }
 host pluto {
         fixed-address 182.168.1.9;
         hardware ethernet 08:00:09:0d:2a:87;
 }
 
Note that the output uses relative names.

Makefile

All of this can be automated using the following makefile fragment:
 
 /etc/dhcp.conf: example.com
         dns-dhcp 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-dhcp 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-dhcp program comes with ABSOLUTELY NO WARRANTY; for details use the 'dns-dhcp -VERSion Warranty' command. The dns-dhcp program is free software, and you are welcome to redistribute it under certain conditions; for details use the 'dns-dhcp -VERSion Redistribution' command.

AUTHOR

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