IT ALL WORKS!

Kamesh Patel cs97kkp at brunel.ac.uk
Wed Feb 28 11:50:33 UTC 2001


>Hi Kam,
>
>Can you please submit a summary of steps that you ended up having to do
>to accomplish this?
>
> >Kamesh Patel wrote:
> >
> > With the help of the mailing list and the helpful people here I now have
a
> > fully fledged dhcp server (DHCPD v30b2pl18), doing dynamic updates
(DDNS)
> > with a fully fledged DNS server (BIND v8.2.3)
> >
> > Thanks everyone!
> >
> > Kam




I had a question asked about whether I would post up how I did it. After
roughly 2 days if not less here it is.

So How did I do it is the question!.

Lets start with BIND then do DHCPD then get a bit confused and mix up the
stuff for DDNS!.


BIND
====


Firstly I had BIND configured as follows:

The following file is stored in /etc/ as named.conf
theviews is my domain
192.168.1.1 is the IP address of the NIC of the machine that has BIND
installed on it.
---------------------------------
// generated by named-bootconf.pl

acl "homenet" {192.168.1.0/24;};

options {
        directory "/var/named";
        allow-query { "homenet";};
        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        // query-source address * port 53;
};

controls {
        unix "/var/run/ndc" perm 0600 owner 0 group 0;
};

//
// a caching only nameserver config
//
zone "." {
        type hint;
        file "named.ca";
};

zone "0.0.127.in-addr.arpa" {
        type master;
        file "named.local";
};

zone "theviews" {
        type master;
        file "named.theviews";
        notify no;
        allow-update {localhost;};
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "named.theviews.rev";
        allow-update {localhost;};
};
--------------------------------


the following are stored in /var/named/
my NAMED.DOMAINNAME file was something like this:
------------------------------
;BIND DUMP V8
$ORIGIN .
domainname        86400   IN      SOA     monty.domainname.
root.monty.domainname. (
                1997022711 28800 14400 3600000 86400 )  ;Cl=1
        86400   IN      NS      localhost.      ;Cl=1
        86400   IN      MX      10 monty.domainname.      ;Cl=1
$ORIGIN domainname.
homer   86400   IN      A       192.168.1.232   ;Cl=1
------------------------------

The last entry here is that of the manual DNS entries which are outside the
range of the dhcp server.
The MX entry is that of a mail server and its port!

my NAMED.DOMAINNAME.REV file was something like the following:
-----------------------------
;BIND DUMP V8
$ORIGIN 168.192.in-addr.arpa.
1       86400   IN      SOA     monty.domainname. root.monty.domainname. (
                1997022711 28800 14400 3600000 86400 )  ;Cl=5
        86400   IN      NS      localhost.      ;Cl=5
$ORIGIN 1.168.192.in-addr.arpa.
232     86400   IN      PTR     homer.domainname. ;Cl=5
-----------------------------

The last entry here is for the reverse lookup of the DNS entry in
named.domainname!
Remember if the server that the BIND server is on is not using DHCP then
ensure that an entry into both named.domainname and named.domainname.rev is
made, so that it can and you can resolve were it is!



DHCPD
=====

Once this was completed I downloaded DHCP v30b2pl18

Run the command:
tar -zxvf filename.tar.gzip

This will untar and ungzip the file into a directory named the same as the
file without .tar.gzip on the end.

In the documentation there are a large number of occurrences where it
mentions stuff about CONFIG_PACKET and CONFIG_FILTER in the .config file.

The error message associated with this will appear if you do not have these
both set to Y.
PLEASE be careful with the .config file which is in the /usr/src/linux
directory. BACK IT UP!!!
Set the values of CONFIG_PACKET and CONFIG_FILTER to Y and recompile your
kernel!
You can find the file typically in /usr/src/linux.

If these are already set Y don't worry, just continue with what I did below!

Go into the directory, as root type:
./configure

This will compile the .c files,
now type:
make

This prepares the installation

now type:
make install

Once this is complete if you have no error messages then you are ready to
configure the DHCP server. If you got warning messages don't worry too much,
normally the application will complete the install procedure, but on the off
chance that it does not, consult the README file or another on of the doc
files held in the doc directory where the binaries for the DHCP server are
kept.

Firstly, as root create the directory /var/state/dhcp/
and type:
touch dhclient.leases
touch dhcpd.leases

This will create empty files for which the dhcp server can store the state
of leases that are being handed out.

Now lets create the dhcpd.conf file which you should create in /etc/

The following file is what mine looks like I will step you through it!

------------------------
# dhcpd.conf
#
# Modified Sample configuration file from ISC DHCP binaries!
#

#The DDNS update style to be use, one of two can be used ad-hoc or interim
ddns-update-style ad-hoc;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
#subnet 10.152.187.0 netmask 255.255.255.0 {}

#Lease times for a default and maximum allowed time to hold an address
default-lease-time 7200;
max-lease-time 7200;

#This is the zone declaration for the dhcpd.conf, noted as a bug in
#3.02bplx up until 3.02bpl19
zone 1.168.192.in-addr.arpa. {
  primary 127.0.0.1;
}
zone theviews. {
  primary 192.168.1.1;
}


# This configures what range of IP's will be used on DHCP
subnet 192.168.1.0 netmask 255.255.255.0 {
  authoritative;
  range 192.168.1.50 192.168.1.100;
  option domain-name "theviews";
  option broadcast-address 192.168.1.255;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 192.168.1.1;
  option netbios-name-servers 192.168.1.1;
  option netbios-node-type 8;
  option routers 192.168.1.1;
  ddns-updates on;
  ddns-domainname "theviews";
  ddns-rev-domainname "in-addr.arpa";
}
-----------------------

If you are not concerned with DDNS (Dynamic DNS) leave out all of the
statements starting ddns.

ddns-update-style ad-hoc
:You can read about this in the dhcpd.conf(5) file just run man on it!

log-facility local7
:Very useful when using the real-time logging facility, it does take much to
do the hack just take a look in your howto's, if not just ask some on
comp.os.linux they should help!.

default-lease-time 7200;
max-lease-time 7200;
:The are lease times for an IP given out over DHCP, I think 7200 is
equivalent to 2 or so hours, but don't take my word for it! Pretty self
explanatory!

zone theviews. {
  primary 192.168.1.1;
}
zone 1.168.192.in-addr.arpa. {
  primary 127.0.0.1;
}
:These zone statements are very important for DHCP to do the DDNS part, I am
not sure how well or even if at all the DHCP works without these. But they
represent the zone which is to be updated and  the same zone in reverse as
specified in the named.domainname.rev file. These statements caused me quite
some pain so I will explain them to you in a bit of detail.

zone theviews.
:This is the zone to be updated, ensure you put the dot at the end of your
zone name
{ primary 192.168.1.1;}
:This is the address of the primary names server. In other words your BIND
server

zone 1.168.192.in-addr.arpa.
:This is the reverse lookup of what zone theviews. would look like so take
note and adapt it to your domain name.
{primary 127.0.0.1;}
:I just could not be bothered here, I just specified the primary names
server as the local host, well because the localhost is where my BIND server
is.


# This configures what range of IP's will be used on DHCP
subnet 192.168.1.0 netmask 255.255.255.0
:This specifies that you are specifying something to do with this subnet and
netmask
{
  authoritative;
:if the DHCP server is the official one for the domain then this should be
set!

  range 192.168.1.50 192.168.1.100;
:This specifies the range that will be used by the DHCP server to assign
IP's

  option domain-name "theviews";
:This says the domain name is theviews

  option broadcast-address 192.168.1.255;
:Broadcast address for DHCP is 192.168.1.255

  option subnet-mask 255.255.255.0;
:This is the subnet-mask

  option domain-name-servers 192.168.1.1;
:This is the address of the DNS server

  option netbios-name-servers 192.168.1.1;
:Netbios address, if you have a server that deals with NetBios

  option netbios-node-type 8;
:NetBios type, mine is currently set to HYBRID which is 8

  option routers 192.168.1.1;
:Router is...

  ddns-updates on;
:Dynamic DNS updates are enabled

  ddns-domainname "theviews";
:Domain name for DDNS is theviews

  ddns-rev-domainname "in-addr.arpa";
:The reverse domainname is "in-addr.arpa which is the reverse
}

:If you have Microsoft clients you are going to have to take note that DHCP
will be difficult to them if you do not tell the server to broadcast out to
255.255.255.255.

:The README file talks about it but below I have abstracted out what you
need to do:

:type:
	route add -host 255.255.255.255 dev eth0

:On some older Linux systems, you will get an error if you try to do
:this.   On those systems, try adding the following entry to your
:/etc/hosts file:

255.255.255.255 all-ones

:Then, try:

        route add -host all-ones dev eth0

:Another route that has worked for some users is:

        route add -net 255.255.255.0 dev eth0

:Bearing in mind I need not try it and therefore would not say anything
about it.

If you are not using eth0 as your network interface, you should
specify the network interface you *are* using in your route command.

I think that is the whole of DHCP.
but if you are interested heres DDNS!

DDNS
====

now we must do some stuff in your named.conf file if you look at the
named.conf file at the top it has the following entries:
-----------------
zone "theviews" {
        type master;
        file "named.theviews";
        notify no;
        allow-update {localhost;};
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "named.theviews.rev";
        allow-update {localhost;};
};
-----------------

Look closely and you will see that both entries have allow-update
{localhost;};
This means for the domain which I am master, DHCPD is allowed to request for
dynamic updates with BIND. This is VERY IMPORTANT so do not miss it!


Mentioned earlier was zone entries in the dhcpd.conf file, I believe this is
only required in versions of DHCPD less than pl19 and greater than pl12, in
pl19 it was fixed!

But if you are running pl18 you will need then, they are as follow:
------------------
zone theviews. {
  primary 192.168.1.1;
}
zone 1.168.192.in-addr.arpa. {
  primary 127.0.0.1;
}
------------------

Now as far as I can remember, that was it, set up a client and test it,
start the BIND server! DHCPD server watch the logs and with all luck it
should work.

I don't believe that I have forgotten anything but its all that I can
remember for the minute.

Thanks

Kam



More information about the bind-users mailing list