Network Time Protocol (NTP) is a networking protocol for time and date synchronisation between computers. By default, Windows 7 provides five servers (default being time.windows.com) to synchronise with. Time varies based on network latency however with tens of milliseconds over the Internet and almost one millisecond on LAN. Having a NTP server also reduces the amount of calls to the Internet made by hosts and achieves a better system time for all computers that rely on performance, integration and timeliness. Luckily a NTP server is very easy to build on Linux.
- Internet connection
- Ubuntu 14.04
NTP Installation Guide
1. Install Ubuntu 14.04 LTS with roughly:
- 1 CPU
- 256MB RAM
- 5GB HDD
This will be all you need.
2. Install the NTP daemon using the command:
1 $ sudo apt-get install ntp
3. Let’s configure the NTP servers we are going to retrieve from. Edit the ntp.conf using the command:
1 $ sudo nano /etc/ntp.conf
Here are the current servers that the service is currently retrieving the time from:
1 2 3 4 server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
This is something you should change to a local/country instead of the Ubuntu pools. You can find this at the NTP Pool Project. I will be using the Australian pools so change the lines as necessary:
Place the word iburst onto one pool to indicate you want to retrieve from this as soon as possible. This causes the daemon to synchronise with this server after starting up, otherwise it will take somewhere up to 20 minutes before the first synchronisation.
4. Add a fallback server. Ubuntu already provides their own fallback but we will use the current server’s time as the default. Otherwise you can specify any other server you know of:
1 2 server 127.127.1.0 fudge 127.127.1.0 stratum 10
5. Your file will look something like this now:
Hit CTRL+X, enter Y to confirm and hit Enter.
6. Restart the daemon service using the command:
1 $ sudo /etc/init.d/ntp restart
7. Monitor the log to see when it starts synchronising using the command:
1 $ tail -f /var/log/syslog
(Ctrl + C to exit)
8. It nothing comes up (which usually happens to me), run the command ‘ntpq -p’ and it should show you all the time servers you are currently connecting with. This is enough to know if it is synchronized for now.
1 $ ntpq -p
9. Find the hostname of the server (hostname -A) or its IP address (ifconfig) and start synchronising everything!
If the hostname does not work, try the IP address. If that works then use ‘ipconfig /flushdns’ to clear your cache and make Windows retrieve the hostname from the DNS instead of the cache.