DHCP Static binding not working as expected??

Sten Carlsen stenc at s-carlsen.dk
Sun Sep 9 17:41:09 UTC 2012


Hi

My first guess was right, see below for comments:

On 09/09/12 17:50, chamara samarakoon wrote:
> Hi,
> First thank you very much for reply.
>
> In my set up ip's issued first time will be bind as static using dhcp
> on commit script.
>
> Below are the all related conf files,
>
>
>
> dhcpd.conf:------------------------------------------------------------------------------------
>
> # DHCP Server - Configuration file for Primary
>  #
>  # File $Id: dhcpd.conf,v 1.9 2009/07/09 16:31:20 root Exp root $
>  
>  # Global configuration
>  set vendorclass = option vendor-class-identifier;
>
>  #record  the relay agent information options sent during
>  #the client's initial DHCPREQUEST message
>  stash-agent-options true;
>
>  # Make the server authoritative for the network segments that
>  # are configured, and tell it to send DHCPNAKs to bogus requests
>  authoritative;
>
>  # Allow each client to have exactly one lease, and expire
>  # old leases if a new DHCPDISCOVER occurs
>  one-lease-per-client true;
>    deny duplicates;
>
>  # Log to the local0 facility by default
>  #log-facility local0;
> log-facility local7;
>
>  # Ping the IP address that is being offered to make sure it    isn't
>  # configured on another node. This has some potential  repercussions
>  # for clients that don't like delays.
> ping-check true;
>  
>  # Dynamic DNS Updates
>  #include "/etc/ddns-update.dnskey";
>  #include "/etc/dhcpd.conf_ddns";
>  
>  # DHCP Failover, Primary
>  include "/etc/dhcpd.conf_primary";
>  
>  # Subnet declaration
>  include "/etc/dhcpd.conf_subnet";
>  
>  # Static IP addresses
>
> include "/etc/dhcp_static_lease/dhcp_static_conf/dhcpd_static.conf";
>
>
> on commit {
> set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
> set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
> set ClientName = binary-to-ascii(10, 8, ".", leased-address);
> set ClientGW =  binary-to-ascii(10,8,".",config-option routers);
> log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac, " Name: ",
> ClientName ,"ClientGW: ",ClientGW));
> execute("/etc/script/dynamic2Static.sh",ClientIP,ClientMac,ClientName,ClientGW);
> }
>
> # EOF
> -----------------------------------------------------------------------------------------------------------------------
>
> /etc/dhcpd.conf_subnet:------------------------------------------------------------------------------------
>
> subnet 51.101.0.0 netmask 255.255.224.0 {
> option ntp-servers 172.17.0.1;
> deny client-updates;
> authoritative;
> option broadcast-address 51.101.31.255;
> option routers 51.101.0.1;
> max-lease-time 31536000;
> default-lease-time 31536000;
> pool {
> failover peer "XXXX";
> deny dynamic bootp clients;
> range 51.101.0.10 51.101.0.254;
This range includes 51.101.0.10, that means the server is allowed to
hand that out to any client that is not a bootp client.
The problem is caused by the fact that you are not aware that hosts with
fixed leases go through a completely different part of the system and do
not reserve the address so it can not be handed out dynamically.

The solution is that any fixed address MUST be outside the dynamic range.

The other method to solve this is to use reserved leases, those are
handled by the same code as normal leases and reside in the normal
range. A lease can be made reserved by editing the leases file or by
using omshell.

I have never used omshell but AFAIK you could include such a call in
your commit script. Others will have to step in here and explain more
about this.

> }
> -----------------------------------------------------------------------------------------------------------------------
>
> /etc/dhcp_static_lease/dhcp_static_conf/dhcpd_static.conf----------------------------------
>
> include "/etc/dhcp_static_lease/51.101.0.0.txt";
>
>
> ---------------------------------------------------------------------------------------------------------------------------
>
> /etc/dhcp_static_lease/51.101.0.0.txt---------------------------------------------------------------------
>
> host 51.101.0.10{
>                        hardware ethernet 00:20:d2:3a:51:69;
>                     fixed-address 51.101.0.10;
>                     }
>
> ---------------------------------------------------------------------------------------------------------------------------
>
> Regards,
> chamara samarakoon.
>
>
> On Sun, Sep 9, 2012 at 8:58 PM, Sten Carlsen <stenc at s-carlsen.dk
> <mailto:stenc at s-carlsen.dk>> wrote:
>
>     Hi
>
>     It is very likely doing what you have asked it to do.
>
>     For anybody on this list to be able to help you find out what
>     happens and why that  is different from what you want to happen,
>     please post your dhcpd.conf in its entirety with no edits (except
>     secret keys).
>
>     First guess is that you give the fixed address inside your range
>     of dynamic IPs, it must be outside or you will see the below
>     happening.
>
>
>
>     On 09/09/12 17:17, chamara samarakoon wrote:
>>     Hi,
>>
>>     I am new to isc dhcp, and i am facing following situation , and
>>     need help to understand,
>>
>>     Scenario.:
>>     I am having 3 devices called, A,B,C. On dhcp conf pool is
>>     restricted to *only one IP*.
>>     Also on dhcpd conf *static bind is enabled* for device A.
>>
>>
>>     1.Plug device A to network -> with out issue device got IP
>>
>>     DHCPOFFER on 51.101.0.10 to 00:20:d2:3a:51:69 via 51.101.0.1
>>     Commit: IP: 51.101.0.10 Mac: 0:20:d2:3a:51:69 Name:
>>     51.101.0.10ClientGW: 51.101.0.1
>>
>>     2.Unplug device A and change the static conf MAC to B's
>>     MAC(Restart dhcpd server) and Plug device B
>>
>>     No issue device B got IP,
>>     DHCPOFFER on 51.101.0.10 to 00:20:d2:39:24:f8 via 51.101.0.1
>>     Commit: IP: 51.101.0.10 Mac: 0:20:d2:39:24:f8 Name:
>>     51.101.0.10ClientGW: 51.101.0.1
>>
>>     3. Replug the device A *with out removing device B*,
>>     A received the IP even though B is having it, A's IP is active
>>     and B's IP is not active.
>>
>>     DHCPDISCOVER from 00:20:d2:3a:51:69 via 51.101.0.1
>>     <http://51.101.0.1>: network 51.101.0.0/19
>>     <http://51.101.0.0/19>: no free leases
>>     Reclaiming abandoned lease 51.101.0.10.
>>     ICMP Echo reply while lease 51.101.0.10 valid.
>>     Abandoning IP address 51.101.0.10 <http://51.101.0.10>: pinged
>>     before offer
>>     DHCPDISCOVER from 00:20:d2:3a:51:69 via 51.101.0.1
>>     <http://51.101.0.1>: cancel load balance to peer XXX - no free leases
>>     DHCPDISCOVER from 00:20:d2:3a:51:69 via 51.101.0.1
>>     DHCPOFFER on 51.101.0.10 to 00:20:d2:3a:51:69 via 51.101.0.1
>>     Commit: IP: 51.101.0.10 Mac: 0:20:d2:3a:51:69 Name:
>>     51.101.0.10ClientGW: 51.101.0.1
>>
>>
>>
>>
>>
>>     Why this is happening, I do not want DHCPD to offer the IP to
>>     another device when it is bind on static file to another
>>     device.But strange thing is when i plug device C when only device
>>     B(*same way as device A plug in step 3 but this time not device A
>>     instead device C is used.*) is there , C naver receive a IP as i
>>     expected.Help is very much appreciated,What is happening with
>>     device A and B??
>>
>>
>>     Thank You,
>>     chamara
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>     -- 
>>     chthsa
>>
>>
>>     _______________________________________________
>>     dhcp-users mailing list
>>     dhcp-users at lists.isc.org <mailto:dhcp-users at lists.isc.org>
>>     https://lists.isc.org/mailman/listinfo/dhcp-users
>
>     -- 
>     Best regards
>
>     Sten Carlsen
>
>     No improvements come from shouting:
>            "MALE BOVINE MANURE!!!"
>
>
>     _______________________________________________
>     dhcp-users mailing list
>     dhcp-users at lists.isc.org <mailto:dhcp-users at lists.isc.org>
>     https://lists.isc.org/mailman/listinfo/dhcp-users
>
>
>
>
> -- 
> chthsa
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-- 
Best regards

Sten Carlsen

No improvements come from shouting:
       "MALE BOVINE MANURE!!!"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20120909/defe907a/attachment-0001.html>


More information about the dhcp-users mailing list