dhcp with only static leases

Simon Hobson dhcp1 at thehobsons.co.uk
Sun Oct 11 09:34:58 UTC 2009


Sergey Ivanov wrote:
>Hello, I need dhcp configuration which serves ONLY static leases, it
>should not respond to any unknown client.
>
>Please see config below, is it correct config?

Not far off.

>ignore client-updates;
>ddns-update-style interim;
>ddns-updates off;
>boot-unknown-clients off;
>
>max-lease-time 100000;
>default-lease-time 84600;
>
>option routers 192.168.254.100;
>option domain-name-servers 192.168.254.100;
>option subnet-mask              255.255.255.0;
>
>subnet 192.168.254.0 netmask 255.255.255.0 {
>     pool {
>         range 192.168.254.100 192.168.254.100;
>         deny unknown-clients;
>         host n192_168_224_77 {
>                 hardware ethernet 00:50:56:c0:00:01;
>                 fixed-address 192.168.254.77;
>         }
>     }
>}

Two things :

1) You don't need to have a range statement at all - just by leaving 
that out the server will automatically not serve any client without a 
fixed address assignment.

2) You should always put host statements in the global scope. They 
are global in scope, but can inherit options in an unexpected way, so 
apart from some very specialised requirements you should keep them 
global.

Apart from that, a couple of other points. You've defined the routers 
option outside the subnet. In general the only place it makes sense 
is inside a subnet as it's only valid inside that subnet.

And, you've defined the router address as being the same as an 
address that's in the range statement. You state that the gateway is 
192.168.254.200, therefore unless there is something you're not 
telling us about the network, the router option should specify 
192.168.254.200.

Thus your config becomes :

option domain-name-servers 192.168.254.100;
option subnet-mask              255.255.255.0;

subnet 192.168.254.0 netmask 255.255.255.0 {
   option routers 192.168.254.200;
}

host n192_168_224_77 {
   hardware ethernet 00:50:56:c0:00:01;
   fixed-address 192.168.254.77;
}

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the dhcp-users mailing list