Adding host entry dynamically using dhcpctl functions ( dhcp hungs )

Johnson koil Raj johnson.raj at wipro.com
Tue Jul 5 13:21:18 UTC 2011


Hi All,

     One of our requirement is not to change IPs of a machines once 
assigned. (first time assigning IPs will be dynamic).

     In order to reserver same IP for ever we decided to add the host 
entry using dhcpctl functions after dhcp assign IP for first time. So at 
the 'on commit' we decided to use 'execute' to run a script which will 
make an host entry by passing required parameters. But DHCP got hung 
when it was executing the script, the same script works properly when I 
execute from shell prompt.

on commit {
     log(debug, "On commit method");
     set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
     set ClientMac =  binary-to-ascii (16, 8, ":", substring(hardware, 
1, 6));
*
*    set ClientHostname = concat ("node-",
                     suffix (concat ("0", binary-to-ascii (16, 8, 
"",substring(hardware, 4, 1))),2),"-",
                     suffix (concat ("0", binary-to-ascii (16, 8, 
"",substring(hardware, 5, 1))),2),"-",
                     suffix (concat ("0", binary-to-ascii (16, 8, 
"",substring(hardware, 6, 1))),2));

     log(debug, concat("Add Static entry HOSTNAME: ", ClientHostname, " 
IP: ", ClientIP, " Mac: ", ClientMac));

     
execute("/etc/dhcpd/add_static_ip_entry","-h",ClientHostname,"-m",ClientMac,"-i",ClientIP); 

     unset ClientIP;
     unset ClientMac;
     unset ClientHostName;
}

 From the log I came to know that it got struck at dhcpctl_connect call
...
status = dhcpctl_connect (&connection, "127.0.0.1", 9991, 0);  --> here 
call not returning dhcp hungs.
......
Why the server is not able to connect when the same script used at 
execute method ?

[root at LdapVM dhcpd]# netstat -anp | grep 9991
tcp        0      0 0.0.0.0:9991                
0.0.0.0:*                   LISTEN      15923/dhcpd
tcp        8      0 127.0.0.1:9991              
127.0.0.1:37752             ESTABLISHED -
tcp        0      0 127.0.0.1:37752             
127.0.0.1:9991              ESTABLISHED 15935/add_static_ip


Any other way to reserve an IP to a Machine ( static IP configuration at 
DHCP server side) *not at the machine.*

Any help would be grateful.

Thanks,
Johnson


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20110705/84407103/attachment.html>


More information about the dhcp-users mailing list