Solved Pass -u option to ntpdate on startup

decuser

Active Member

Reaction score: 74
Messages: 216

I've read dozens of ntpdate posts and have not been able to find a working fix for this problem. When I start up my server, ntpdate complains:

Code:
29 Jun 13:45:55 ntpdate[515]: no server suitable for synchronization found

Like most posters, I am able to manually set the time using ntpdate with the -u option:
Code:
ntpdate -u pool.ntp.org
29 Jun 13:53:47 ntpdate[790]: step time server 129.250.35.250 offset -0.890322 sec

ntpdate is started after the nics. I'm thinking it's a firewall between my server and the internet that is blocking well-known ports

So, I tried this and rebooted:
Code:
sudo sysrc -f /etc/rc.conf ntpdate_args="-u"

but that didn't change the outcome.

Is it possible to get the ntpdate daemon to use the behind a firewall logic during bootup?
 

Jose

Aspiring Daemon

Reaction score: 685
Messages: 790

/etc/rc.conf
Code:
...
ntpdate_enable="YES"
ntpd_enable="YES"
...
/etc/ntp.conf
...
#
# The option `iburst' is used for faster initial synchronization.
#
pool 0.freebsd.pool.ntp.org iburst
...
Works for me.
 
OP
decuser

decuser

Active Member

Reaction score: 74
Messages: 216

Jose that's what I have as well, but since my ISP appears to be blocking port 123, it doesn't work. That's what the -u option is needed for, but the daemon doesn't seem to know about the -u...
 

Jose

Aspiring Daemon

Reaction score: 685
Messages: 790

First I looked for the default ntpdate settings in /etc/defaults/rc.conf.
Code:
grep -i ntp /etc/defaults/rc.conf
Then I read the ntpdate(8) man page
...
-b Force the time to be stepped using the settimeofday(2) system
call, rather than slewed (default) using the adjtime(2) system
call. This option should be used when called from a startup file
at boot time.
...
-u Direct ntpdate to use an unprivileged port for outgoing packets.
This is most useful when behind a firewall that blocks incoming
traffic to privileged ports, and you want to synchronise with
hosts beyond the firewall. Note that the -d option always uses
unprivileged ports.
...
 
OP
decuser

decuser

Active Member

Reaction score: 74
Messages: 216

Shoulda known, rtfm :). I didn't realize that /etc/defaults/rc.conf was so informative, but there it was ntpdate_flags, perfect.
 
Top