Jérôme Belleman
Home  •  Tools  •  Posts  •  Talks  •  Travels  •  Graphics  •  About Me

A Blunt Way to Configure NTP on Linux

23 Mar 2014

A really quick note about setting up an NTP client on Linux. I realised there are two main approaches, one which I found blunt at first but learned to like.

Googling for ubuntu ntp took me to the Ubuntu Server Guide which explains that there are two ways of setting up a client for NTP. There is on the one hand one which I found at first to be a blunt way, which entails calling the ntpdate command from time to time. On the other hand, the more delicate approach is to run the ntpd daemon. While I had trouble at first accepting it, I ended up quite liking the blunt way because it's easier to set up and, pragmatically speaking, more suitable for laptops. It's used in essence as follows:

ntpdate -u pool.ntp.org

Note that the -u option, which has ntpdate use an unprivileged port to send the packets from (to quote the man page), is necessary when using a firewall, lest you get no server suitable for synchronization found error messages.

Setting up an NTP client on your machine is then just a case of writing the command line suggested above to a file such as /etc/cron.daily/ntpdate. Change its mode to 755 to make it executable and you're good to go.

References