Maurice Janssen wrote:
On Thursday, May  3, 2007 at 00:23:00 +0200, Tom Van Looy wrote:
Hi, I wanted to let my ntp client use the servers it receives from the dhcp server (3.0 from packages). I made it working like this:

I added ntp-servers to /etc/dhclient.conf, and the following function to the /sbin/dhclient-script script:

add_new_ntp() {
  if [ -n "$new_ntp_servers" ]; then
     sed "/^server/d" /etc/ntpd.conf > /etc/ntpd.conf.new
     for address in $new_ntp_servers; do
        echo "server" $address >> /etc/ntpd.conf.new
     done
     mv /etc/ntpd.conf.new /etc/ntpd.conf && pkill -KILL ntpd && ntpd
  fi
}

I use add_new_ntp after add_new_routes in BOUND|RENEW|REBIND|REBOOT)

Is this the right way to do let ntp use dhclient?
And, is what I did in add_new_ntp() the best way to do it?

I'm not sure if it is wise to restart ntpd each time your dhcp
lease is renewed.  ntpd needs some time to settle and this will
interrupt this process again and again.

Maurice


You could be right. I changed it to only do it on REBOOT now.
Any idea about the DHCPACK from 127.0.0.1? That's still strange.

Reply via email to