Ubuntu NTPd Time Server

=Ubuntu time/date with NTP daemon=

ntpdate runs on system boot and (theoretically) sets the clock, but if your are using a server / leave your pc on a long time / network isnt up when it tries, then time drifts. Either set a cron job to run it constantly or use ntp daemon to keep it constantly tweaked.

Install
Check what/if anything currently running ps aux | grep -i ntp sudo service ntp status
 * or

If nothing is running install ntp

sudo apt-get install ntp

This should immediately sync and just work. The default time servers (e.g. server 1.ubuntu.pool.ntp.org) etc. are in /etc/ntp.conf

ntp.conf
Can add working servers to /etc/ntp.conf. Add a line in the config file like this.

server ntp.ubuntu.com server ntp3a.le.ac.uk
 * 1) Use Ubuntu's ntp server as a fallback.
 * 1) My own fallback server

Fix
Sometimes it doesn't sync (possibly if its miles out?) automatically, to manually force a resync you must stop ntp service, manually run ntpdate (wont work with service still running), then restart ntp service.

$ sudo service ntp stop $ sudo ntpdate time.windows.com 7 Apr 11:26:38 ntpdate[15270]: step time server 65.55.21.13 offset -105.920608 sec $ sudo service ntp start
 * 1) enter a working NTP server e.g. time.windows.com or ntp3a.le.ac.uk
 * 1) clock should now be corrected

You may need to try several servers before you find one that works! When you do it may be worth tagging this into /etc/ntp.conf