NTP can't resolve host names

dennylin93

Aspiring Daemon

Thanks: 108
Messages: 783

#1
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:
Code:
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.
 
OP
OP
D

dennylin93

Aspiring Daemon

Thanks: 108
Messages: 783

#5
crsd said:
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.
 
OP
OP
D

dennylin93

Aspiring Daemon

Thanks: 108
Messages: 783

#7
Here it is (I removed some unrelated parts):
Code:
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

Son of Beastie

Thanks: 688
Messages: 4,613

#8
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:
Code:
ntpdate_enable="YES"
ntpdate_hosts="ntp.linux.edu.lv"
 

BobBilly5

New Member

Thanks: 5
Messages: 13

#9
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?
 
OP
OP
D

dennylin93

Aspiring Daemon

Thanks: 108
Messages: 783

#10
killasmurf86 said:
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:
Code:
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.

BobBilly5 said:
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

Well-Known Member

Thanks: 127
Messages: 453

#11
If you are running a nameserver on that box it needs to be started before ntpd.Have you checked with rcorder(8) whether that happens?

What is the contents of your "/etc/resolv.conf" file?
 

jalla

Well-Known Member

Thanks: 84
Messages: 385

#12
Also if you want to simply sync clock with internet use ntpdate
here's mine:
Code:
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
 

jalla

Well-Known Member

Thanks: 84
Messages: 385

#14
killasmurf86 said:
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
.
 
OP
OP
D

dennylin93

Aspiring Daemon

Thanks: 108
Messages: 783

#16
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

Administrator
Staff member
Administrator
Moderator

Thanks: 6,578
Messages: 28,075

#17
Make sure /etc/resolv.conf contains the correct IP addresses for your DNS servers.
 
OP
OP
D

dennylin93

Aspiring Daemon

Thanks: 108
Messages: 783

#18
SirDice said:
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

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 2,714
Messages: 11,250

#19
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

Administrator
Staff member
Administrator
Moderator

Thanks: 6,578
Messages: 28,075

#20
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.
 
Top