Welcome to my personal blog. The main purpose of this blog is to describe the projects that keep me busy in my spare time and hopefully this will help other people out who are working on similar projects.
Feel free to ask any questions concerning the topics described here! Use the contact form to contact me.

How to setup time synchronisation on Ubuntu 10.04LTS.

Source: https://help.ubuntu.com/10.04/serverguide/C/NTP.html

Afbeelding 1 NTP is a TCP/IP protocol for synchronising time over a network. Basically a client requests the current time from a server, and uses it to set its own clock.

Standard Ubuntu comes with ntpdate, which is a ntp client that runs on boot time to synchronise the machines clock with the Ubuntu NTP server. Normally this will do fine for most of us. However a clock is likely to drift between boot times and for some applications it would be better to always have the correct time in sync.

I needed this feature @ my work since our maintenance department server is connected to the PLC to get the latest alarm logs for our technicians. So here time was critical for the logging, if the time would be able to drift, the logs would not have been synchronous between the server and the PLC!
How do we accomplish this? First we need to install ntpd to the machine that you want to be synchronised, then you setup some time servers to synchronise with. Follow the instructions below.

1. Install NTP.
Open a terminal and install ntp with this command:

Source code
  • 1
sudo apt-get install ntp



2. Configuring NTP.
In the terminal screen issue this command which will open the config file in nano:

Source code
  • 1
sudo nano /etc/ntp.conf


Go to the line that says "# You do need to talk to an NTP server or two (or three)."
Here you will see that the ubuntu ntp server is set as standard.

Source code
  • 1
server ntp.ubuntu.com


you can add your own time-servers here to synchronise with, http://www.pool.ntp.org/zone/europe or http://www.pool.ntp.org/zone/north-america lists good servers to start with!
I have commented out the Ubuntu server in this example:

Source code
  • 1
  • 2
  • 3
  • 4
  • 5
#server ntp.ubuntu.com
server 0.europe.pool.ntp.org
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org
server 3.europe.pool.ntp.org


At work I have used the NTP servers given by our network administrator.

After configuring you need to restart the ntp service to be able to start the synchronisation with the servers you have given.
Use this command to restart the NTP service:

Source code
  • 1
sudo service ntp restart


You will see these messages appear when restarting:

Source code
  • 1
  • 2
 * Stopping NTP server ntpd                                              [ OK ]
 * Starting NTP server ntpd                                              [ OK ]


The NTP service should be synchronising right now.

3. Check if NTP is synchronising.
You can check if the NTP service is synchronising with this command:
sudo ntpq –np
It will list the NTP servers by their IP address:

Source code
  • 1
  • 2
  • 3
  • 4
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 19.148.2.129    10.241.0.1       4 u   21   64    7    0.484   -5.148   0.635
 10.241.0.1      10.244.0.10      3 u   22   64    7    1.141   -1.300   5.325


If you want to see the same list, but with the servers listed by their dns address, use this command instead:
sudo ntpq -c lpeer

4. Manual synchronising.
It could be handy sometimes to sync manually to a given server, you can do this as follows:

Source code
  • 1
ntpd -q <IP-address_of_ntp_server>



5. Log check.
You can monitor the logs to see how the synchronisation is going:

Source code
  • 1
sudo tail -f /var/log/syslog


You should see a log message appear when synchronising as this one:

Source code
  • 1
Dec 16 16:19:43 <hostname> ntpd[10946]: synchronized to 10.241.0.1, stratum 3


Where hostname is the hostname of your machine.

6. Firewall ports.
The only thing that needs to be checked when your firewall is on that it allows port 123 on UDP level.

For any support, also check this forum http://ubuntuforums.org/showthread.php?t=862620

Article was posted on Friday 16th of December 2011 @ 16:42u. |

Search

Pictures

Links

Take a look

Ubuntu.com

XBMC.org

Mythtv

TV Vlaanderen

Related stuff:

© 2010 geoffke.be      website door Geoffrey Timmerman        Home | Sitemap | RSS Feed | XHTML | CSS