View Full Version : NTP can't resolve host names
dennylin93
January 17th, 2010, 04:39
I upgraded to RELENG_8_0 a while ago, and I noticed that ntpd couldn't resolve host names during the boot process.
This is what pops up on the console:
Jan 16 17:03:12 mail kernel: Jan 16 17:03:12 mail ntpd_initres[1101]: host name not found: 0.tw.pool.ntp.org
Jan 16 17:03:12 mail kernel: Jan 16 17:03:12 mail ntpd_initres[1101]: couldn't resolve `0.tw.pool.ntp.org', giving up on it
Jan 16 17:03:12 mail kernel: Jan 16 17:03:12 mail ntpd_initres[1101]: host name not found: 1.tw.pool.ntp.org
Jan 16 17:03:12 mail kernel: Jan 16 17:03:12 mail ntpd_initres[1101]: couldn't resolve `1.tw.pool.ntp.org', giving up on it
Jan 16 17:03:12 mail kernel: Jan 16 17:03:12 mail ntpd_initres[1101]: host name not found: 2.tw.pool.ntp.org
Jan 16 17:03:12 mail kernel: Jan 16 17:03:12 mail ntpd_initres[1101]: couldn't resolve `2.tw.pool.ntp.org', giving up on it
I have to do /etc/rc.d/ntpd restart manually every time I reboot, or else ntpd won't work. The order of the scripts in /etc/rc.d/ seem to be correct, so I'm not sure what's causing the problem.
crsd
January 17th, 2010, 04:51
Try changing DHCP to SYNCDHCP in ifconfig_<ifaceN> (if you are using DHCP, of course :) )
fronclynne
January 17th, 2010, 05:09
Try changing DHCP to SYNCDHCP in ifconfig_<ifaceN> (if you are using DHCP, of course :) )
Purely out of curiosity ;) where is this documented?
crsd
January 17th, 2010, 05:28
rc.conf. Check synchronous_dhclient variable also.
dennylin93
January 17th, 2010, 05:53
Try changing DHCP to SYNCDHCP in ifconfig_<ifaceN> (if you are using DHCP, of course :) )
Unfortunately, I'm not using DHCP, so I hope there's another work around I can use.
graudeejs
January 17th, 2010, 08:59
show /etc/rc.conf
dennylin93
January 17th, 2010, 09:36
Here it is (I removed some unrelated parts):
defaultrouter="10.0.0.1"
hostname="example.com"
ifconfig_bge0="inet 10.0.0.2 netmask 255.255.255.0"
# PF
pf_enable="YES"
pflog_enable="YES"
pflog_logfile="/var/log/pflog/pflog"
ntpd_enable="YES"
This problem appeared after I upgraded to RELENG_8_0 from RELENG_7_2.
graudeejs
January 17th, 2010, 09:44
ok show pf.conf perhaps you're blocking access to DNS
Also if you want to simply sync clock with internet use ntpdate
here's mine:
ntpdate_enable="YES"
ntpdate_hosts="ntp.linux.edu.lv"
BobBilly5
January 17th, 2010, 12:04
I had the same problem when I ran tinydns/dnscache and only had 127.0.0.1 in /etc/resolv.conf....
What if you specify those ntp hosts by IP instead of name, does it make a difference?
dennylin93
January 17th, 2010, 13:48
ok show pf.conf perhaps you're blocking access to DNS
Also if you want to simply sync clock with internet use ntpdate
here's mine:
ntpdate_enable="YES"
ntpdate_hosts="ntp.linux.edu.lv"
I think my configuration is ok. I didn't do any major changes when I went from 7.2 to 8.0, and ntpd works if I restart it using /etc/rc.d/ntpd. The problem seems to be with the boot process/scripts.
I had the same problem when I ran tinydns/dnscache and only had 127.0.0.1 in /etc/resolv.conf....
What if you specify those ntp hosts by IP instead of name, does it make a difference?
It would probably work, but I'd prefer to know why host names don't work properly like they used to. I'll see if I can reproduce this on a fresh install.
J65nko
January 17th, 2010, 14:05
If you are running a nameserver on that box it needs to be started before ntpd.Have you checked with rcorder whether that happens?
What is the contents of your "/etc/resolv.conf" file?
jalla
January 17th, 2010, 14:55
Also if you want to simply sync clock with internet use ntpdate
here's mine:
ntpdate_enable="YES"
ntpdate_hosts="ntp.linux.edu.lv"
ntpdate will sync your clock at boot, but won't keep it sync'ed unless you put it in cron.
Also, note that ntpdate is deprecated. ntpd is the way to go for the future
graudeejs
January 17th, 2010, 15:14
hmm didn't know it was deprecated....
And it's for my desktop so syncing once at boot is just what I want
jalla
January 17th, 2010, 16:45
hmm didn't know it was deprecated....
And it's for my desktop so syncing once at boot is just what I want
From ntpdate(8)
Note: The functionality of this program is now available in the ntpd(8)
program. See the -q command line option in the ntpd(8) page. After a
suitable period of mourning, the ntpdate utility is to be retired from
this distribution.
joel@
January 17th, 2010, 18:12
FWIW, I see the same thing on a machine running 8.0.
dennylin93
January 20th, 2010, 09:19
On a few computers, the error disappeared after reboot, but the problem still persists on 2 computers. I tried tweaking a few things, but I still haven't found the cause of the problem yet.
SirDice
January 20th, 2010, 11:46
Make sure /etc/resolv.conf contains the correct IP addresses for your DNS servers.
dennylin93
January 20th, 2010, 13:47
Make sure /etc/resolv.conf contains the correct IP addresses for your DNS servers.
They're ok. NTP just doesn't work during the boot process. It works if I restart it manually using /etc/rc.d/ntpd.
DutchDaemon
January 20th, 2010, 14:06
I only use ntpdate with IP addresses of NTP servers in rc.conf. That takes care of setting the correct time at boot without problems. The 'regular' ntpd server that starts after that (I use openntpd) has NTP server names in its config file, which works fine.
SirDice
January 20th, 2010, 14:22
Yeah, I use ntpd too, with hostnames. The only 'problem' I have is ntpd can't bind to the workstation's IPv6 address. The IPv6 address (rtadvd/rtsol) seems to get set rather late (I'm talking minutes after the system is fully booted). Every few updates this process seems to get fixed, next update it's broken again, next it's fixed etc.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.