cancel
Showing results for 
Search instead for 
Did you mean: 

Time Synchronisation

SOLVED
Go to solution
Donald Thaler
Super Advisor

Time Synchronisation

trying to sync a client to a master both servers are internal.
master (10.2.2.28)
etc/ntp.conf
server 127.127.1.1
etc/rc.config.d/netdaemons
xtnpd=1
client..etc/ntp.conf
server artemis version 3
*(artemis is hostname of master)
etc/rc.config.d/netdaemons
xtnpd=1
ntpdate_server=10.2.2.28

stopped and started xtnpd on both servers.
client is 4 minutes faster than master and it doesn't seem to be slowing down... did i miss a step somewhere ??
42 REPLIES
TTr
Honored Contributor

Re: Time Synchronisation

Adding a drift file in /etc/ntp.conf is a ggod idea. I don't know if xntpd uses a default if you don't specify it.

Check the syslog for any xntp messages.

In etc/rc.config.d/netdaemons add debugging option and if you want a separate log file option as in XNTPD_ARGS="-d -l /var/adm/syslog/xntpd.log". Then restart the daemon and check the log.
Heironimus
Honored Contributor

Re: Time Synchronisation

How long have you waited for it to correct? Does ntpq -p on the client look good?
Donald Thaler
Super Advisor

Re: Time Synchronisation

the ntpq -p on the client is not returning the full name of the master, instead of artemis.lccc.edu, it's returning artemis.lccc.ed and the ref id is 0.0.0
Heironimus
Honored Contributor

Re: Time Synchronisation

The ntpq output is truncated to fit the field width, so don't worry about a missing "u" at the end of the server name. The refid is "0.0.0.0" because the server isn't configured with an upstream time provider and is also not a cause for concern. Is there a character (like a "*" or "+") in the first column next to the server name?

The time that has passed since you started ntpd on the client is important because a 4-minute difference could take days to correct.
Donald Thaler
Super Advisor

Re: Time Synchronisation

no special character in front of server name.. guess i'll wait till monday to see the time on the server is changing
Donald Thaler
Super Advisor

Re: Time Synchronisation

when i do ntpq -p on the master i get this ntpq: read: Can't assign requested address
James R. Ferguson
Acclaimed Contributor

Re: Time Synchronisation

Hi Donald:

The "can't assign..." message from 'ntpq' means that XNTP has died or isn't running.

Verify that your server's time is actually correct in UTC units:

# date -u

...should match a real world clock. If not, 'Xntpd' will not syncrhonize since it uses UTC time. Your 'TZ" setting simply changes your perception of UTC to a localtime by adding or subtracting an approprate offset.

Regards!

...JRF...
Emil Velez
Honored Contributor

Re: Time Synchronisation

I configure it in sam that way the file is correctly configured.
Bill Hassell
Honored Contributor
Solution

Re: Time Synchronisation

ntp is very easy to configure but impossible to make work if you cannot contact the ntp servers. Before you do anything, make sure xntp is not running:

UNIX95=1 ps -fC xntdp

That should return nothing which is correct. Otherwise, kill the xntpd process. Now test that your server can see the NTP server:

ntpq -p 10.2.2.28

You will see something like this:

# ntpqp -p 10.2.2.28
remote refid st t when poll reach delay offset disp
==============================================================================
192.147.38.60 0.0.0.0 16 - - 1024 0 0.00 0.000 16000.0
*ntp.pbx.org clock.nyc.he.ne 2 u 755 1024 377 13.18 18.193 9.28
+kyna.dalbaech.n time-A.timefreq 2 u 824 1024 377 59.59 -29.138 0.53

The first line indicates that server 10.2.2.28 cannot get any time info from 192.147.38.60. That is the remote server's problem, not yours. The next 2 lines show that the remote server can talk to these time servers. This is a normal display.

However, if you get errors from ntpq such as unreachable, can't assign address, timeout, etc, don't go any farther. Your server cannot talk NTP to 10.2.2.28. Until this is fixed, the rest of the steps will be ineffective.

Once you fix the communication problem, now you can configure ntp.conf. While there are dozens of options, leave all that out and make it as simple as possible:

# cat /etc/ntp.conf
10.2.2.28 # company serverserver
fudge 127.127.1.1 stratum 10 # localhost fallback
driftfile /etc/ntp.drift

And that's it. NOTE: 127.127.1.1 should always have stratum 10 listed. This address is a fallback for NTP to use itself for sync until the servers return. But it must be the last choice, hence stratum 10.


Bill Hassell, sysadmin
Donald Thaler
Super Advisor

Re: Time Synchronisation

how do i trouble shoot 'Your server cannot talk NTP to 10.2.2.28. Until this is fixed, the rest of the steps will be ineffective.'
i'm still getting "Can't assign requested address" ?


Bill Hassell
Honored Contributor

Re: Time Synchronisation

> i'm still getting "Can't assign requested address" ?

Did you simply type the command: ntpq -p? If so, this is normal because you told ntpq to query xntpd on your local server and it is not running, or not running correctly. Be sure you type the command completely:

ntpq -p 10.2.2.28

Once you get a good response, change your ntp.conf file as mentioned above and stop/restart xntpd:

/sbin/init.d/xntpd stop
/sbin/init.d/xntpd start

then look at the end of syslog.log:

tail /var/adm/syslog/syslog.log

which will show what happened when ntpdate was run to set the current time.


Bill Hassell, sysadmin
Suraj K Sankari
Honored Contributor

Re: Time Synchronisation

Hi,

Did you check whether your xntpd demon is running or not ?
Are you using drift file ? if not then try with drift file restart the demon

/sbin/init.d/xntpd stop
/sbin/init.d/xntpd start

after restart give
ntpd â q

Then check you /var/adm/syslog/syslog.log

Still problem then post last 100 line of your syslog.log

Suraj
Fadia Almarei
Super Advisor

Re: Time Synchronisation

attached file is steps how to configure the ntp on hp-ux and you have then to restart the servers and wait on them to take the effect
fadia.marei
Donald Thaler
Super Advisor

Re: Time Synchronisation

following fadia's suggestion i get this in the syslog.log files

from client

Dec 22 09:40:02 apollo xntpd[450]: tickadj = 625, tick = 10000, tvu_maxslew = 61875
Dec 22 09:40:02 apollo xntpd[450]: precision = 6 usec

from server

Dec 22 09:45:49 artemis xntpd[3269]: refclock_open: /dev/hpgps1: No such file or directory
Dec 22 09:45:49 artemis xntpd[3269]: configuration of 127.127.26.1 failed
Dec 22 09:47:43 artemis xntpd[3405]: tickadj = 625, tick = 10000, tvu_maxslew = 61875
Dec 22 09:47:43 artemis xntpd[3405]: precision = 6 usec
Dec 22 09:47:43 artemis xntpd[3405]: refclock_open: /dev/hpgps1: No such file or directory
Dec 22 09:47:43 artemis xntpd[3405]: configuration of 127.127.26.1 failed
Dec 22 09:49:48 artemis xntpd[3456]: tickadj = 625, tick = 10000, tvu_maxslew = 61875
Dec 22 09:49:48 artemis xntpd[3456]: precision = 25 usec
Dec 22 09:49:48 artemis xntpd[3456]: refclock_open: /dev/hpgps1: No such file or directory
Dec 22 09:49:48 artemis xntpd[3456]: configuration of 127.127.26.1 failed

there is not ntp.drift file on either server?

the ntpq -p 10.2.2.28 now returns this on the client
# ntpq -p 10.2.2.28
remote refid st t when poll reach delay offset disp
==============================================================================
*LOCAL(0) LOCAL(0) 3 l 66m 64 377 0.00 0.000 10.01
artemis.lccc.ed 0.0.0.0 16 - - 64 0 0.00 0.000 16000.0

the time on the client remains 5 minutes faster than the time on the server



Donald Thaler
Super Advisor

Re: Time Synchronisation

on the client:
after stopping and starting xntpd...
Dec 22 14:15:11 apollo xntpd[23525]: synchronized to 10.2.2.28, stratum=4
Dec 22 14:15:11 apollo xntpd[23525]: time error -3918.453608 is way too large (set clock manually)

nothing shows up in the ntp.drift on the client, on the server the value is 0.0.0..

can i specify a smaller value in the ntp.drift file file on the client, and see if the client time changes ?
TTr
Honored Contributor

Re: Time Synchronisation

Now it appears that the client is connecting to the server but the time correction is too large to change the clock. Shutdown the ntp service on the client and adjust the time manually first. Either use the date command, the "date -a" command or the "ntpdate -B ntpserver" command and after the client has adjusted then restart the ntp service on the client.
Donald Thaler
Super Advisor

Re: Time Synchronisation

by issuing a 'date -a -360' on the client, i was able to slow the clock down so that the time which was 5 minutes faster than the ntp server is now about 30 seconds slower, i started up xntpd on the client. I'm assuming the problem i was having was due to the fact that the client was originally faster than the server and xntpd doesn't change the time backwards ?
Donald Thaler
Super Advisor

Re: Time Synchronisation

i notice that on the client if i run the xntpd start, and then wait about 5-10 mins and try the xntpd stop i get the message "Unable to stop xntpd (cannot find pid)..."

if i do the xntpd stop soon after the xntpd start then i don't get the error message.

on the ntp server i never get the error message when trying to do the xntpd stop...




James R. Ferguson
Acclaimed Contributor

Re: Time Synchronisation

Hi (again) Donald:

> i notice that on the client if i run the xntpd start, and then wait about 5-10 mins and try the xntpd stop i get the message "Unable to stop xntpd (cannot find pid)..."

> if i do the xntpd stop soon after the xntpd start then i don't get the error message.

This behavior is consistent with the 'xntpd' dying after it is started. This is likely the result of too large a time difference between your server and client.

Did you ever verify that the UTC time for your server is correct as I originally suggested?

# date -u

...should return a value very close to the correct time if NTP is going to begin to synchronize.

Regards!

...JRF...
Donald Thaler
Super Advisor

Re: Time Synchronisation

i was so busy trying to synch the times, i overlooked the date -u. It turns out that the ntp server shows 21:50:02 utc (date = 17:51 ast) while the ntp client shows 22:50:02 utc (date = 17:51 est)..What time zone is ast ?
What do you suggest would be the easiest way to change the ntp server from ast to est ?
James R. Ferguson
Acclaimed Contributor

Re: Time Synchronisation

Hi (again) Donald:

> It turns out that the ntp server shows 21:50:02 utc (date = 17:51 ast) while the ntp client shows 22:50:02 utc (date = 17:51 est)..What time zone is ast ?
What do you suggest would be the easiest way to change the ntp server from ast to est ?

The timezones don't matter, although a look in '/usr/lib/tztab' should show you. What matters is that NTP works in UTC. The 'xntpd' daemon will abandon synchronization efforts if the time delta is too large. This avoids insane settings. You 'syslog' actually showed about a 65-minute difference and reported the complaint.

The best way to correct this is to set both your server's times correctly using 'date -u' so that you know they match the correct universal time. Having done this, reboot.

You should really have at least three external time sources. Use something like:

server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org

These are freely available sources from:

http://support.ntp.org/bin/view/Servers/NTPPoolServers

Edit '/etc/rc.config.d/netdaemons' and set XNTPD=1.

Remember, localtime (as expressed by your TZ setting) is merely an offset (+-) from UTC. Local time is your *preceived* time. In fact, you could have users with different TZ settings in their login profiles on the same server if you need or want. Timekeeping occurs in UTC.

Regards!

...JRF...


Dennis Handly
Acclaimed Contributor

Re: Time Synchronisation

>What time zone is ast?

There is an Aleutian Standard Time.
There also is an Atlantic Standard Time (Quebec) that matches the hour off you have.
Donald Thaler
Super Advisor

Re: Time Synchronisation

when i try to specify mutliple external source's e.g server 0.98.172.32.171
server 1.1.69.31.13.210
in the ntp.conf file
i get this error in the syslog.log file:

Dec 23 08:15:23 artemis xntpd[24766]: precision = 34 usec
Dec 23 08:15:25 artemis xntpd[24767]: couldn't resolve `0.98.172.32.171', giving up on it
Dec 23 08:15:25 artemis xntpd[24767]: couldn't resolve `1.69.31.13.210', giving up on it

yet if i use server 0.pool.ntp.org i don't get the error... can't you use ip addresses when specifying multiple external sources ?
James R. Ferguson
Acclaimed Contributor

Re: Time Synchronisation

Hi Donald:

> can't you use ip addresses when specifying multiple external sources ?

I never tried. That aside, you cited 1.1.69.31.13.210 and then appear to have used 1.69.31.13.210 (without the first octet). Perhaps this is your error.

Why would you want to use IPAdrresses? DNS or at least a local '/etc/hosts' file doing the name resolution would be far, far better for long-term support.

Regards!

...JRF...