Posts Tagged ‘ ntpd

ntpq timed out on freeBSD

I was running locally on a server and wanted to check in on ’s status. ntpq -p was not producing any output even though was running.

# ntpq -p
localhost: timed out, nothing received
***Request timed out

This is because I had the option “restrict default ignore” set in /etc/.conf. ntpq. This makes ntpd ignore EVERYTHING, even queries to the loopback interface. Ntpq queries ntpd over the loopback interface at 127.0.0.1. To allow these local queries, add:

 restrict 127.0.0.1

to /etc/ntp.conf, then also add restrict lines for your other upstream ntp servers.

restart ntpd:

/etc/rc.d/ntpd restart

Now ntpq -p will show you status of it’s peers

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 dns3.untangle.c .INIT.          16 u    -   64    0    0.000    0.000   0.000
 mirror          .INIT.          16 u    -   64    0    0.000    0.000   0.000
 153.16.4.133    .INIT.          16 u    -   64    0    0.000    0.000   0.000

FreeBSD time updates with ntpdate and ntpd

So ’s is out of wack. Two options:

1. . This is manual. To run a time sync manually, just run

ntpdate -b pool..org

You can replace pool.ntp.org with whatever you want. To tell it to run whenever the system is booted, add this to /etc/rc.conf:

ntpdate_enable="YES"
ntpdate_hosts="[your ntp server]"

This works, but if you don’t reboot often, could be unreliable.

2. ntdp. just runs all the time and keeps you nsync with internet time servers. You would want to use this for servers that you don’t reboot all the time. for this:

create an /etc/ntpd.conf file:

server pool.ntp.org
driftfile /etc/ntp.drift
logfile /var/log/ntpd.log

you can start ntpd manually:

ntpd

and/or add a startup entry for it in /etc/rc.conf:

ntpd_enable="YES"

I recommend setting up both of these on servers. Ntpdate will snap your system to a good point before you begin synchronizing with ntpd. ntpd by itself will take a lot longer to get you synced up.

Staying on time in Debian

To stay on , you should really use . It is a daemon that runs all the and makes tiny changes to the system clock. All you need to do is install :

aptitude install ntp

after it’s installed, I encourage you to go over to http://www.pool.ntp.org/zone/@ and pick a pool in your continental zone. Debian has some defaults, and they are fine, i just like using the ntp pool. If you want to change where you are syncing to, open up /etc/ntp.conf and change the “server” lines.

nano /etc/ntp.conf

to manually sync Debian’s time, just install “

apt-get install ntpdate

run this:

-debian [a ntp server]