On Thu, 3 May 2007, 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? > > It seems that the script works. After executing "/bin/sh /etc/netstart bce0" I > see the following in /var/log/daemon: > > May 2 22:35:51 kaat dhclient[30663]: DHCPREQUEST on bce0 to 255.255.255.255 > port 67 > May 2 22:35:51 kaat dhclient[30663]: DHCPACK from 127.0.0.1 > May 2 22:35:51 kaat ntpd[2737]: Lost child: child terminated; signal 9 > (Killed) > May 2 22:35:51 kaat ntpd[27146]: ntp engine ready > May 2 22:35:51 kaat dhclient[30663]: bound to 192.168.1.80 -- renewal in 7200 > seconds. > May 2 22:36:11 kaat ntpd[27146]: peer 192.168.1.7 now valid > May 2 22:36:14 kaat ntpd[27146]: peer 192.168.1.6 now valid > May 2 22:38:13 kaat ntpd[27146]: clock is now synced > May 2 22:52:39 kaat ntpd[12672]: adjusting clock frequency by -12.976140 to > -12.976140ppm
> > But I have two additional questions about this: > 1) my dhcpd runs at 192.168.1.5 (remote), so why DHCPACK from 127.0.0.1? No idea on this one. > 2) "adjusting clock frequency by -12.976140 to -12.976140ppm." These values > are the same, what just happend? The previous freq adjustment was 0. The new value will be persistent, the next time you reboot it'll start with the previously stored value. -Otto