- Linux Training
- Desktop Tutorials
- Server Tutorials
|Keeping Your Desktop Time|
|Desktop Training - Ubuntu 8.04|
NTP is a Network Time Protocol that connects your local machine to a remote server to configure your local time correctly. Often users do not realize that their machine is actually making these remote connections.
In order to synchronize to Internet time servers you will need to install NTP support. Choose System/Administrator/Time and Date and then select “Keep synchronized with Internet servers” Instead of Manual. If NTP support is not available you will be asked to install it by supplying your administrator password.
Once it is installed close Time and Date and then reopen if for the changes to take effect.
Note your Time zone and that the Configuration is set to Internet servers. Now it is time to Select Servers. It makes sense to select time servers that are close to you.
Select one or more time servers so that your system will synchronize with the time server on a regular basis.
Network Time Protocol is a daemon so it will listen for connections to be made to the NTP time server.
Open a terminal and type:
udp 0 0 192.168.5.43:123 0.0.0.0:*
udp 0 0 127.0.0.1:123 0.0.0.0:*
udp 0 0 0.0.0.0:123 0.0.0.0:*
This shows that your Desktop is listening on port 123 for a time update from the remote Internet Servers.
The other indication that you will see is when you look at your logs in /var/log/syslog.
Jun 17 08:21:21 ub ntpd: precision = 1.000 usec
Jun 17 08:21:21 ub ntpd: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Jun 17 08:21:21 ub ntpd: Listening on interface #1 wildcard, ::#123 Disabled
Jun 17 08:21:21 ub ntpd: Listening on interface #2 lo, ::1#123 Enabled
Jun 17 08:21:21 ub ntpd: Listening on interface #3 eth0, fe80::21b:fcff:fe68:6833#123 Enabled
Jun 17 08:21:21 ub ntpd: Listening on interface #4 lo, 127.0.0.1#123 Enabled
Jun 17 08:21:21 ub ntpd: Listening on interface #5 eth0, 192.168.5.43#123 Enabled
Jun 17 08:21:21 ub ntpd: kernel time sync status 0040
Jun 17 08:25:41 ub ntpd: synchronized to 220.127.116.11, stratum 2
Jun 17 08:25:41 ub ntpd: time reset -0.209526 s
Jun 17 08:30:51 ub ntpd: synchronized to 18.104.22.168, stratum 2
From these logs you can see that the Desktop is synchronized to two separate time servers each which are stratum 2. Stratum 1 is a time server connected to an atomic clock or a radio frequency clock. So a stratum 2 gets it's time from a server that is a stratum 1 server. Each time the connection is made to the server a time offset will occur.
You can view stats, which are not too useful, by enabling stats in the /etc/ntp.conf file and uncommenting the lines so it looks like this:
# Enable this if you want statistics to be logged.
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
Once you do this restart your ntp server.
# /etc/init.d/ntp restart
* Stopping NTP server ntpd [ OK ]
Starting NTP server ntpd [ OK ]
Here is a look at those stats.
54634 54912.805 22.214.171.124 9014 -0.003789257 0.215213312 7.937502568 0.000000954
54634 54913.693 126.96.36.199 9014 -0.010979699 0.102440485 7.937516505 0.000000954
Here is a helpful command to be done as root to see what server is keeping your time.
# ntpq -p
remote refid st t when poll reach delay offset jitter
+europium.canoni 188.8.131.52 2 u 35 64 377 213.401 2.271 2.136
*egr-dns-1.egr.u 184.108.40.206 2 u 27 64 377 98.623 -6.359 1.565
The line with the * is the server that is currently used to set the clock on your Desktop.