Problem
How do I configure NTP to synchronize correctly to set and maintain a UNIX system's time-of-day in agreement with the Internet standard time servers.
Solution
Configuring a Simple NTP CLIENT:The first section is concerned with configuring an NTP client.
ie. a client obtaining it's time from another local Unix or Windows
or Linux Master Time Server either within the Intranet or, if
available, the Internet.1. Verify that you are able to ping xxx.xxx.xxx.xxx, where this is your Master Time Server.
2. Synchronize the clocks manually with the following command:
# ntpdate -v -b xxx.xxx.xxx.xxxor use the additional options:-d debug-s write the information into syslog rather than console-o 3 specify the ntp version (default is 3)Use "ntpdate" to ensure that the clocks are synchronised before the "ntp" daemon starts and it is often found that no further "ntp" configuration is done other than to add this command to the cron and run on a regular basis.
This feature cannot be used if a "ntpd" daemon is already running on this client as they share the same port and you will see the error:
"the NTP socket is in use, exiting"If you see:"no suitable server for synchronization found"then it's likely the server you are communicating with is not a Master Time Server and is not advertising the time.
Running ntpdate also resets the System Clock and server's RTC.
As an alternate to using NTP, ntpdate can be placed in the cron to be run on an hourly basis, for example:
59 * * * * /etc/ntpdate -v my_time_server >> /var/log/ntp.log 2>&13. Configure the file ntp.conf as:broadcastclient no driftfile /etc/ntp.drift logfile /var/log/ntp.log server xxx.xxx.xxx.xxx server ...
where "xxx.xxx.xxx.xxx" is the IP address of the Master Time Server you wish to use.
How to configure it?You should use the "scoadmin client" or use the SCOadmin Client Manager from the GUI to set it where the operating system is either UnixWare 7.x.x, Open UNIX 8.0.x or OpenServer 5.0.x/6.0.0.
For OpenLinux, use the KDE K-> Control Center-> System-> Startup-> Services-> Network Time Protocol Daemon.
Next, use your favourite text editor to ensure it reads as above.
Please note, ntp will loose it's synchronisation if the time varies by more than 128ms.
Where is ntp.conf?ntp.conf is stored in /etc for SCO OpenServer5 and SCO OpenLinux, and is stored in /etc/inet for UnixWare 7.x.x, Open UNIX 8.0.x and OpenServer6, however, on OSR6 it is linked to /etc/ntp.conf.
For UnixWare7 it is recommended to change the driftfile location to:
driftfile /etc/inet/ntp.driftThe configured drift file is created after the next reboot if needed.
# touch /etc/inet/ntp.drift
# chmod 666 /etc/inet/ntp.drift4. Stop and start your server's TCP/IP or simply reboot your server and the "ntpd" daemon will be started if it finds the above file, "ntp.conf" has been configured.
Verify that the daemon has been started with:
# ps -ef | grep ntpntp by definition does not work with time differences larger than 1000 secs. In that case it stops and tells you to set the system time manually. (xntpd logs into /var/adm/syslog)
OpenServer starts the "ntp" daemon from /etc/tcp. UnixWare starts the "ntp" daemon from /etc/inet/config.
5. You can use the "ntpq -p" command in order to check, whether ntp has started ok.
Please note, that a drift of more than 1000 seconds will not be corrected from ntp, by default.
You can now monitor the system time by entering the date command (without any options) from time to time.
Please note that it will take some time (10 to 30 mins) until NTP corrects the system time.
Configuring a simple NTP SERVER:
===============================This next section looks at setting up your SCO server as a Master Time Server.
1. To do this change your "ntp.conf" file to read:
driftfile /etc/ntp.drift (or /etc/inet/ntp.drift for UW7.x.x)
broadcastclient no
server 127.127.1.12. Restart your TCP/IP services or reboot your server.
3. Check the service has started with "ps -ef | grep ntp", as above,
and running "ntpq -p".You will not be able to "ping 127.127.1.1" but this is the entry to use to tell "ntp" it is the Master Time Server.
Your NTP clients can then be pointed to this server.
NOTES: TROUBLESHOOTING:
===============
Check the port 123 is opened with "netstat -an" and run:# ntpq
ntpq> peers
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) LOCAL(0) 7 l 46 64 377 0.000 0.000 0.000
xxx.xxx.xxx.255 0.0.0.0 16 u - 64 0 0.000 0.000 4000.00On the Client:ntpq> peers
remote refid st t when poll reach delay offset disp
==============================================================================
LOCAL(0) LOCAL(0) 7 l 13 64 377 0.00 0.000 10.01
*my_time_server. LOCAL(0) 8 u 44 64 377 0.76 0.134 0.05or:# ntpq -pand:On the Server:#ntpq
ntpq> as
ind assID status conf reach auth condition last_event cnt
===========================================================
1 39588 8000 yes yes none reject
2 39589 8000 yes yes none reject
3 39590 9614 yes yes none sys.peer reachable 1ntpq> rv <assID>On the Client:ntpq> as
ind assID status conf reach auth condition last_event cnt
===========================================================
1 32724 9614 yes yes none sys.peer reachable 1
2 32725 9014 yes yes none reject reachable 1ntpq> rv <assID>and:You can set debugging from ntpq:ntpq> debug more debug level set to 1 ntpq> debug more debug level set to 2 ntpq> debug more debug level set to 3
ntpq> peers
Sending 12 octets
select() returns 1
Packet shows signs of authentication (total 20, data 24, mac -4) 18349014
18359634 90f2ab2a 3a010000 5f646e73 7268ad2a Authenticated with keyid 973144064
We don't know that key Got packet, size = 20 Packet okay
remote refid st t when poll reach delay offset disp
==============================================================================
Sending 12 octets
select() returns 1
Packet shows signs of authentication (total 476, data 480, mac -4) 2e30302c
0d0a0000 00000000 01000000 78fc0508 b4d7bd2a Authenticated with keyid 16777216
We don't know that key Got packet, size = 476 Packet okay
select() returns 1
Got packet, size = 168
Packet okay
LOCAL(0) LOCAL(0) 7 l 55 64 377 0.00 0.000 10.01
Sending 12 octets
select() returns 1
Got packet, size = 408
Packet okay
select() returns 1
Packet shows signs of authentication (total 244, data 248, mac -4) 362e3835
0d0a0000 3d302e30 322c2072 65616368 3d307866 Authenticated with keyid 841752690
We don't know that key Got packet, size = 244 Packet okay
*my_time_server. LOCAL(0) 8 u 22 64 377 0.69 0.126 0.02 See also
For UnixWare 7.x.x/Open UNIX 8.0.x/OpenServer6:in.xntpd (1Mtcp) - Network Time Protocol daemon
xntpd (1Mtcp) - Network Time Protocol daemon
ntpdate (1Mtcp)For SCO OpenServer 5.0.x:ntpdate(ADMN)
ntpd(ADMN)For SCO OpenLinux 3.x:/usr/share/doc/packages/xntp-4.0.99k/html/ntpdate.htmhttp://www.linuxdoc.org/HOWTO/Belgian-HOWTO/configuration.htmlwhich suggests:To change the CMOS clock and then synchronize the system time with the CMOS clock, do something like this:
hwclock --set --date="Feb 25 03:38"
clock -u -sIf your computer has Internet access, you can use NTP (Network
Time Protocol) to keep your system clock in sync using the "ntp"
daemon. However, one way of doing this is manually is by starting
"ntpdate" from cron by adding:05 0 * * * root /usr/sbin/ntpdate -s uk.pool.ntp.org > /dev/null 2>&1which syncs the clock to the NTP time server ntp.belnet.be.
For a list of public NTP servers, seehttp://support.ntp.org/bin/view/Servers/NTPPoolServershttp://support.ntp.org/bin/view/Servers/WebHome#Browsing_the_ListsThe NTP home page is at:http://www.ntp.orgFor example,uk.pool.ntp.org is a UK NTP server.ta107619, "How do I configure xntpd(ADMN) to alter timekeeping limitations?"