Configure NTP Server on FreeBSD

Configure a NTP time server on FreeBSD is fairly easy. We will spend about 10 minutes to configure a NTP Server on FreeBSD.

Select Global NTP Server to Sync

Before setting up configuration file, you might want to find out which global NTP servers to sync with on strategy locations. Strategy means select the NTP server nearby your country/continent. Here is the list of Asia NTP servers which can be obtained here http://www.pool.ntp.org/zone/asia. If you already have selected NTP server to go with, put the URL into your NTP configuration file.

NTP Configure on ntp.conf

On FreeBSD, ntp.conf configuration file can be create at /etc/ntp.conf;


shell> touch /etc/ntp.conf

On ntp.conf file, here is the sample configuration;


shell> vi /etc/ntp.conf
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org

driftfile /var/db/ntp.drift

On FreeBSD 8.0, there is a default configuration on for ntp.conf. That’s it, simple and nice ntp.conf ready. Make the necessary changes on the configuration to reflect the nearer NTP servers.

Starting NTP Service on FreeBSD

To enable ntpd on FreeBSD, add the follow configuration into /etc/rc.conf;


ntpd_enable="YES" 
ntpd_config="/etc/ntp.conf"

After service enabling has been defined, run the command below to start up ntpd.


/etc/rc.d/ntpd start
Starting ntpd.

NTP Server Post-install and Troubleshooting

It’s good to double check is ntpd started properly


ps ax | grep ntpd
 3750  ??  Ss     0:00.01 /usr/sbin/ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid -f /
 4143  p0  S+     0:00.00 grep ntpd

Well, all is up. Let’s do ntpdate to sync your current time with your NTP time server


shell> ntpdate -d localhost
23 Mar 16:51:57 ntpdate[4282]: ntpdate 4.2.4p5-a Wed Nov 26 06:21:53 UTC 2008 (1)
transmit(127.0.0.1)
receive(127.0.0.1)
transmit(127.0.0.1)
receive(127.0.0.1)
transmit(127.0.0.1)
receive(127.0.0.1)
transmit(127.0.0.1)
receive(127.0.0.1)
transmit(127.0.0.1)
transmit(::1)
receive(::1)
transmit(::1)
receive(::1)
transmit(::1)
receive(::1)
transmit(::1)
receive(::1)
transmit(::1)
127.0.0.1: Server dropped: strata too high
::1: Server dropped: strata too high
server 127.0.0.1, port 123
stratum 16, precision -19, leap 11, trust 000
refid [127.0.0.1], delay 0.02563, dispersion 0.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036 14:28:16.000
originate timestamp: cf52ffad.c3c9f2ed  Tue, Mar 23 2010 16:51:57.764
transmit timestamp:  cf52ffad.c3c7e9fd  Tue, Mar 23 2010 16:51:57.764
filter delay:  0.02565  0.02563  0.02563  0.02563 
         0.00000  0.00000  0.00000  0.00000 
filter offset: -0.00000 -0.00000 -0.00000 -0.00000
         0.000000 0.000000 0.000000 0.000000
delay 0.02563, dispersion 0.00000
offset -0.000004

server ::1, port 123
stratum 16, precision -19, leap 11, trust 000
refid [::1], delay 0.02565, dispersion 0.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036 14:28:16.000
originate timestamp: cf52ffad.f6d01f64  Tue, Mar 23 2010 16:51:57.964
transmit timestamp:  cf52ffad.f6cc145e  Tue, Mar 23 2010 16:51:57.964
filter delay:  0.02567  0.02565  0.02565  0.02565 
         0.00000  0.00000  0.00000  0.00000 
filter offset: -0.00000 -0.00000 -0.00000 -0.00000
         0.000000 0.000000 0.000000 0.000000
delay 0.02565, dispersion 0.00000
offset -0.000005

23 Mar 16:51:57 ntpdate[4282]: no server suitable for synchronization found

Opps, no server suitable for synchronization? Don’t panic, it’s normal error message. I

If you take a close look on the message, you will see an error message stated 127.0.0.1: Server dropped: strata too high. It will take some time for your NTP time server to sync with the NTP servers you have configure on ntp.conf.

Run ntpdate again after approximately 15-30 minutes, your NTP time server should work now.

2 Responses to “Configure NTP Server on FreeBSD”

  1. David Says:

    Thanks for the walkthrough re: the ntpdate error. Helped a lot! Cheers.

  2. Jared Says:

    Thanks bud. Good to know that the ntpdate error is to be expected.

Leave a Reply