RENEW/RELEASE through PERL script

PARAM KRISH mkparam at gmail.com
Fri Aug 10 05:21:55 UTC 2012


Thanks for replies.

I use the ClientID as mac-address.

I have written the script in such a way that it ask for "mac-address" as
argument so that i use that Mac address against 'Chaddr' everywhere ...
...
$discover = Net::DHCP::Packet->new(
op=> BOOTREQUEST(),
Htype => '0',
Hlen => '6',
Ciaddr => '0',
*Chaddr => $MAC,*
Giaddr => $handle -> sockhost(),
Xid => int(rand(0xFFFFFFFF)),
DHO_DHCP_MESSAGE_TYPE() => DHCPDISCOVER(),
...
$request = Net::DHCP::Packet->new(
                      #Xid =>  int rand(0xFFFFFFFF),
                      Xid => int(rand(0xFFFFFFFF)),
*                      Chaddr => $MAC,*
                      Ciaddr => '0',
                      Yiaddr => $response->yiaddr(),
                      Siaddr => $response->siaddr(),
                      Giaddr => $handle -> sockhost(),
                        DHO_DHCP_RENEWAL_TIME() => 24*60*60,

                      DHO_DHCP_MESSAGE_TYPE() => DHCPREQUEST(),
                      #DHO_VENDOR_CLASS_IDENTIFIER() => 'foo',
                      DHO_DHCP_REQUESTED_ADDRESS() => $response->yiaddr(),
                      );
...

So, Even with using the same MAC address against consecutive "DHCPREQUEST"s
gets me different IP's.
I am puzzled how the server can treat the requests from same MAC as
different clients ?

I see in the lease file dhcpd.leases , the duplicate exists ...

lease 192.168.1.13 {
*  starts 2 2012/08/07 07:16:24;*
  ends 2 2012/08/07 08:06:24;
  tstp 2 2012/08/07 08:06:24;
  cltt 2 2012/08/07 07:16:24;
  binding state free;
  hardware ethernet 00:50:56:aa:bb:cc;
}
lease 192.168.1.14 {
*  starts 2 2012/08/07 07:16:39;*
  ends 2 2012/08/07 08:06:39;
  tstp 2 2012/08/07 08:06:39;
  cltt 2 2012/08/07 07:16:39;
  binding state free;
  hardware ethernet 00:50:56:aa:bb:cc;
}

You can see from the above output that for the same MAC sent in the
difference of few seconds, gets different IP's.

Any thoughts now ?

-Param


On Thu, Aug 9, 2012 at 11:36 PM, Simon Hobson <dhcp1 at thehobsons.co.uk>wrote:

> PARAM KRISH wrote:
>
>  1. Whenever i send a DHCPREQUEST, it gets me a new IP even though the
>> lease for the earlier request still remains valid.
>>
>
> What are you sending as Client Identifier and Client Hardware Address ?
> If ClientID is present then it must remain constant - if it changes then
> the client is a different client.
> If ClientID is not present, then Client Hardware Address must remain
> constant - if it changes then it's a different client.
>
> --
> Simon Hobson
>
> Visit http://www.**magpiesnestpublishing.co.uk/<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.
> ______________________________**_________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/**listinfo/dhcp-users<https://lists.isc.org/mailman/listinfo/dhcp-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20120810/511df54b/attachment.html>


More information about the dhcp-users mailing list