dhcp not matching subnet if not first address on interface

Simon Hobson dhcp1 at thehobsons.co.uk
Tue Sep 6 07:00:39 UTC 2011

Steve Clark wrote:

>>I am using dhcp-4.1.1-11.P1 on EL6. I am running dhcpd without 
>>specifying an interface
>>expecting dhcpd to match the interface based on the subnet defined 
>>in the dhcpd.conf file.
>>This works as expected unless I have multiple addresses on the 
>>interface and the
>>subnet that matches the dhcpd.conf file is not the first address 
>>listed on the interface.
>>Is this a known problem? Is there a work around?

Yes it's a known problem - it's called "administrator didn't 
configure things right"
The workaround is to configure things right - see below !

>Here is an example:
>         ddns-update-style interim;
>         shared-network DHCP{
>                 subnet netmask {
>                 range;
>                 option domain-name-servers;
>                 option routers;
>                 option subnet-mask;
>                 option broadcast-address;
>                 default-lease-time 86400;
>                 max-lease-time 86400;
>                 deny bootp;
>         }}
>ip a s eth2
>2: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state 
>DOWN qlen 1000
>     link/ether 00:02:b6:36:d1:39 brd ff:ff:ff:ff:ff:ff
>     inet brd scope global eth2
>     inet scope global eth2

OK, eth2 is what we call a shared-network - it has two IP ranges on 
the same network (you appear to have realised that bit). What you 
need to do is define **ALL** subnets on that shared-network and group 
them in a shared-network statement like this :

shared-network DHCP{
   ... shared options
   subnet netmask {
     ... subnet options
   subnet netmask {
     ... subnet options

DHCPD will not work unless you correctly tell it about your network 
and it's topology. That means you accurately tell it about **all** 
subnets on **all** networks it will be servicing - you forgot to tell 
it about a subnet.

What I'm guessing is that you've assumed it will spot the other 
subnet at boot time, and since you don't want to declare anything in 
it, then you'll accept a default empty subnet. DHCPD doesn't do that 
- local subnets attached to local interfaces are effectively a 
special case, the general case is that a subnet may or may not be 
locally attached and for most operations it doesn't make any 
difference. For networks that aren't locally attached, the only 
information the server will have about it is what you put in the 
config file. It would have been something of a waste of effort to 
code auto-config of local subnets - especially since in most cases 
the admit would still need to declare them so as to configure options 
within them.

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