Setting up NTP on Ubuntu 14.04

  • Many customers bring up the question; why does my cloud-server time show incorrectly? Why does my cloud-servers time drift? Why does the time shown of my cloud-server not accurately represent the real time?

    The reason is that Cloud-Servers are virtualized, and the portion of the timer clock, which normally runs on physical hardware for the OS, is also virtualized. What this does, is, because the virtualization control will be starting and stopping the Virtual Machine, the timer is also stopped, and, although we are talking about inconceivably small drift, over time it can add up to minutes, even hours or days, after many years drift.

    Such issues are common in cloud, and, have existed long before cloud, albeit not to the same extent.

    Such issues are also very easy to resolve. You can use an NTP service (network time protocol), and set it to sync your time regularly, to prevent any real drift from ever becoming established!

    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo apt-get install ntp ntpdate

    The defaults for NTP are actually fine, and this should work out of the box. However, you still might want to choose a timeserver that is a bit closer to where your server is. Say for LON server, you might want a UK NTP server. etc.

    https://www.pool.ntp.org/en/

    If you want to change the timeservers used, or even configure your own timeserver then run:

    sudo nano /etc/ntp.conf


    Comment out the following lines using a #, and ensure # is in front of all the entries

    #server 0.ubuntu.pool.ntp.org
    #server 1.ubuntu.pool.ntp.org
    #server 2.ubuntu.pool.ntp.org
    #server 3.ubuntu.pool.ntp.org
    # Use Ubuntu's ntp server as a fallback.
    #server ntp.ubuntu.com

    Put in 4 of your own servers of your choice for instance:

    server 0.uk.pool.ntp.org
    server 1.uk.pool.ntp.org
    server 2.uk.pool.ntp.org
    server 3.uk.pool.ntp.org


    Cheers &
    Best wishes,
    Adam

  • Great post! Thank you Adam!