<div>Anybody here to help me with this ? </div><div><br></div><div>I am trying to write a simple perl script that helps me sending DHCP packets like DHCPDISCOVER, REQUEST,RENEW,RELEASE.</div><div>I have setup two VM's in a Vswitch and eth1 of VM1 works as dhcp server with ISC DHCP 4.1.1-P1 on RHEL6 64-bit while the client VM1 is RHEL5 64bit in which i am writing the perl script.</div>
<div>I am able to send the DHCPDISCOVER AND DHCPREQUEST, that gets me a valid IP successfully. But the problems so far i observe are </div><div><br></div><div>1. Whenever i send a DHCPREQUEST, it gets me a new IP even though the lease for the earlier request still remains valid. How do i get over this so that it gets me the same IP that was last sent if the lease is not expired otherwise can give me a new IP ? If i don't send a DHCPDISCOVER to send DHCPREQUEST directly, it does not get through...</div>
<div><br></div><div>....</div><div># create DHCP Packet REQUEST</div><div>$request = Net::DHCP::Packet->new(</div><div> #Xid => int rand(0xFFFFFFFF),</div><div> Xid => int(rand(0xFFFFFFFF)),</div>
<div> Chaddr => $MAC,</div><div> Ciaddr => '0',</div><div> Yiaddr => $response->yiaddr(),</div><div> Siaddr => $response->siaddr(),</div>
<div> Giaddr => $handle -> sockhost(),</div><div> DHO_DHCP_RENEWAL_TIME() => 24*60*60,</div><div><br></div><div> DHO_DHCP_MESSAGE_TYPE() => DHCPREQUEST(),</div>
<div> #DHO_VENDOR_CLASS_IDENTIFIER() => 'foo',</div><div> DHO_DHCP_REQUESTED_ADDRESS() => $response->yiaddr(),);</div><div>...</div><div><br></div><div>2. By Sending a LEASEQUERY, I get details like LEASE_TIME etc., to know how long the lease is valid for a IP but if i need to RENEW or RELEASE this, how do i do ? I am unable to achieve this when i attempt sending DHCPFORCERENEW or DHCPRELEASE , both just hangs ? Do you guys have some sample scripts to achieve this ? </div>
<div>...</div><div> DHO_DHCP_MESSAGE_TYPE(53) = DHCPLEASEACTIVE</div><div> DHO_DHCP_SERVER_IDENTIFIER(54) = 192.168.1.2</div><div> DHO_DHCP_LEASE_TIME(51) = 2153</div><div> DHO_SUBNET_MASK(1) = 255.255.255.0</div><div> DHO_ROUTERS(3) = 192.168.1.0</div>
<div> DHO_DHCP_RENEWAL_TIME(58) = 653</div><div> DHO_DHCP_REBINDING_TIME(59) = 1778</div><div> DHO_CLIENT_LAST_TRANSACTION_TIME(91) = \x00\x00\x03O</div><div>...</div><div><br></div><div>3. While using LEASEQUERY, only if send IP, i get the details. How about getting the details by sending MAC ? It did not work for me. I see messages like these in the server...</div>
<div>DHCPLEASEQUERY from 192.168.1.3 for MAC address 00:50:56:aa:bb:cc</div><div>DHCPLEASEUNKNOWN to 192.168.1.3 for MAC address 00:50:56:aa:bb:cc (0 associated IPs)</div><div><br></div><div>I posted my problems earlier here <a href="https://groups.google.com/forum/#!msg/comp.lang.perl.misc/T_7TsEBGjSk/BLeRRuArQ9wJ">https://groups.google.com/forum/#!msg/comp.lang.perl.misc/T_7TsEBGjSk/BLeRRuArQ9wJ</a> until i reached this level. </div>
<div>Now i require some help from you so that i can proceed writing end to end solution through my script that can be used for our internal dhcp requirement..</div><div><br></div><div>Thanks in-advance.</div><div><br></div>