I don’t know about you, but I really don’t like when clocks all display a different time, even when it is usually at most a 5 minute difference. When it comes to computer technology, time differences between devices is annoying and is also considered a security threat for some protocols, such as Kerberos.
This article is not to argument security threats, but instead to show you how to configure an NTP server on Ubuntu Server 9.10. Once you have the NTP Server functioning, you may configure devices that understand NTP to get time from your new NTP Server. Let’s get started.
Install NTP Server
Remember that installing packages in Linux will require elevated privileges, so make sure you sudo first.
1. root@server:/# apt-get install ntp
Configure the NTP Server
Next we will configure the NTP server to use a NTP pool and to allow access for your network to do NTP queries to this server.
1. root@server:/# vi /etc/ntp.conf
Locate the following section in the conf file:
# You do need to talk to an NTP server or two (or three).
server ntp.ubuntu.com
Change that to be this instead (servers from pool.ntp.org):
# You do need to talk to an NTP server or two (or three).
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
Next locate the “restrict” statements and add the following new line (replace with your subnet):
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
Set Time on Server
This is an important step, as you will not be able to synchronize your NTP Server with the NTP pool time if the time is off by too many minutes.
Make sure the NTP Server is stopped, as the following command will require the same port:
1. root@server:/# /etc/init.d/ntp stop
Set the system time:
2. root@server:/# ntpdate pool.ntp.org
Start the NTP Server.
3. root@server:/# /etc/init.d/ntp start
Check the NTP Server Status
In order for your clients to be able to successfully query time from your new NTP Server, your NTP Server must be synchronized with the specified Internet NTP servers. After you have started the NTP Server, this may take 10 minutes for synchronization.
To check the status, use:
1. root@server:/# ntpq -pn
If you server is not synchronized yet, and assuming your configured the servers as explained above, you should see something similar to the following:
Once it is synchronized, it will display something similar to the following:
Notice the * and + symbols next to the IP addresses, the one with the * is the server that your computer is synchronized with.
Note: If you try to synchronize a Windows device with the NTP Server before it is synchronized with the Internet, you will probably receive an error similar to: “An error occurred while Windows was synchronizing with 192.168.0.10. The time sample was rejected because: The peer’s stratum is less than the host’s stratum.”