authorized mac ONLY dhcp

Glenn Satchell Glenn.Satchell at uniq.com.au
Mon Nov 10 13:31:38 UTC 2008


>Date: Sun, 09 Nov 2008 18:14:36 -0500
>From: Zhaohui Wang <zwange at gmu.edu>
>Subject: authorized mac ONLY dhcp
>To: dhcp-users at isc.org
>
>Hi all
>
> 
>
>I am using isc dhcpd version3. Can anyone present a conf file example
>showing that how to config dhcpd for autherized mac address only?
>
>I need all other unknow MACs dhcp request ignored.
>
>Here is my draft dhcpd.conf file, but can not get dhcpd started. Any
>correction or guide would be greatly appreciated.
>
> 
>
> 
>
>============================================
>
>ddns-update-style interim;
>
>ignore client-updates;
>
>range dynamic-bootp 192.168.0.128 192.168.0.254;
>
>default-lease-time 21600;
>
> 
>
> 
>
>host mx {
>
>                hardware ethernet 00:1e:0f:fa:75:2e;
>
>                fixed-address 192.168.0.7;
>
>                option routers                  192.168.0.1;
>
>                option subnet-mask              255.255.255.0;
>
>                option broadcast-address        192.168.0.255;
>
>#               option nis-domain               "domain.org";
>
>#               option domain-name              "domain.org";
>
>        }
>
>==============================================
>
> 
>
>Best Regards
>
>Zhao Wang

Hi Zhao

Is an error message printed when you try to start dhcpd? Often this
will tell you which bit of dhcpd.conf is missing or wrong. In this case
if I create a dhcpd.conf and run it with the -t (test) flag I get:

% dhcpd -t -cf /tmp/dhcpd.conf
Internet Systems Consortium DHCP Server V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
/tmp/dhcpd.conf line 3: range declaration not allowed here.
range 
^
Configuration file errors encountered -- exiting

It tells me that the range statement is not allowed in that part of the file. If 
I look in dhcpd.conf and search for "range" and the first hit I see:

     If clients on a sub-
     net are  to  be  assigned  addresses  dynamically,  a  range
     declaration must appear within the subnet declaration.   For
     clients with statically assigned addresses, or for installa-
     tions  where  only  known  clients will be served, each such
     client must have a host declaration.

So I need a subnet declaration. Searching a bit further through dhcpd.

EXAMPLES
     A typical dhcpd.conf file will look something like this:

     global parameters...

     subnet 204.254.239.0 netmask 255.255.255.224 {
       subnet-specific parameters...
       range 204.254.239.10 204.254.239.30;
     }

So I need a subnet description. From the first bit I found I don't need
a range for where I am using known hosts. So (with a bit of guess work)
I think your dhcpd.conf needs to be something like:

ddns-update-style interim;
ignore client-updates;
default-lease-time 21600;
subnet 192.168.0.0 netmask 255.255.255.0 {
}
host mx {
                hardware ethernet 00:1e:0f:fa:75:2e;
                fixed-address 192.168.0.7;
                option routers                  192.168.0.1;
                option subnet-mask              255.255.255.0;
                option broadcast-address        192.168.0.255;
#               option nis-domain               "domain.org";
#               option domain-name              "domain.org";
}

Note that if you have more than one host, then all the common parameters
can be located in the global or subnet scopes. So your dhcpd.conf could
then look like:

ddns-update-style interim;
ignore client-updates;
default-lease-time 21600;
option nis-domain               "domain.org";
option domain-name              "domain.org";

subnet 192.168.0.0 netmask 255.255.255.0 {
                option routers                  192.168.0.1;
                option subnet-mask              255.255.255.0;
                option broadcast-address        192.168.0.255;
}
host mx {
                hardware ethernet 00:1e:0f:fa:75:2e;
                fixed-address 192.168.0.7;
}

The key point is to take note of the error messages from dhcpd. The
parser is not perfect, but most times the error message is clear about
what is wrong with the configuration file.

regards,
-glenn



More information about the dhcp-users mailing list