Need help with LEASEQUERY..

Pat Winn ptwinn at cimtel.net
Fri May 21 19:24:15 UTC 2010


For what it's worth, I'm attaching a (albeit crappy) diagram
of the flow of what I'm trying to accomplish..


-- 
Patrick T. Winn
Systems Engineer
Cimarron Telephone Co.
(918) 865-3311 x280 - office
(918) 606-6602 - cell




While counting 0's and 1's, roger murray said:
> Hey,
>
> This code works for me to query a CNR DHCP server (Cisco's DHCP), I
> haven't tested it with ISC, but might have the opportunity next week.
> I use it too loop through 3 servers to find out which server a client
> is on. 99% of the code is based on:
> http://search.cpan.org/~shadinger/Net-DHCP-0.66/lib/Net/DHCP/Packet.pm
> and the example Sending a LEASEQUERY (provided by John A. Murphy).
> Hopefully it will be a little help.
>
> Best regards,
>
> Roger Murray
>
>   #!/usr/bin/perl
>   # Simple DHCP client - send a LeaseQuery (by mac and receive the IP)
> and receive the response
>   use strict;
>   use warnings;
>   use IO::Socket::INET;
>   use Net::DHCP::Packet;
>   use Net::DHCP::Constants;
>
>   my $usage = "usage: $0 DHCP_CLIENT_MAC\n"; $ARGV[0] || die $usage;
>
>  # loop through cnr-A-F looking for the client.
> my $cnr;
> #foreach $cnr (qw/ 1 2 3 4 5 6 /) {
> foreach $cnr (qw/ 1 3 5 /) {
>         my $cnrip = "10.125.$cnr.11";
>   # create a socket
>         my $handle = IO::Socket::INET->new(Proto => 'udp',
>                                   Broadcast => 1,
>                                   PeerPort => '67',
>                                   LocalPort => '67',
>                                   Timeout => '1',
>                                   PeerAddr => $cnrip)
>                 or die "socket: $@";     # yes, it uses $@ here
>
>   # create DHCP Packet
>         my $inform = Net::DHCP::Packet->new(
>                       op => BOOTREQUEST(),
>                       Htype%
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhcp_layout.png
Type: image/png
Size: 22715 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/dhcp-hackers/attachments/20100521/6512af3c/attachment.png>


More information about the dhcp-hackers mailing list