1832964 Members
2606 Online
110048 Solutions
New Discussion

Setting the server time

 
Scott Dunkley
Regular Advisor

Setting the server time

Hi all,

We would like our UNIX server to pick up its time from another server on the network. is this possible and how do I do that?

cheers,

Scott.
Better to regret something you have done, than something you havn't
16 REPLIES 16
Geoff Wild
Honored Contributor

Re: Setting the server time

Yes - it's called ntp.

For more info:
man xntpd


http://www.ntp.org/ntpfaq/NTP-a-faq.htm

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Pete Randall
Outstanding Contributor

Re: Setting the server time

Scott,

The simple way is to use SAM to configure NTP (Network Time Protocol).


Pete

Pete
Jeff Schussele
Honored Contributor

Re: Setting the server time

Hi Scott,

Yes, you would use NTP (Network Time Protocol).
The other server would be an NTP server & this system a client.
man xntpd for details

You have to set up the server first then configure the NTP client locally using the /etc/ntp.conf file & point it at the server.
Then edit /etc/rc.config.d/netdaemons & set
export XNTPD=1
to autostart NTP at boot.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Cheryl Griffin
Honored Contributor

Re: Setting the server time

Scott Dunkley
Regular Advisor

Re: Setting the server time

have read through some of the stuff posted on here. And tried it with SAM.

What I am trying to do is get the time from a windows server on our network so tried adding the server using SAM and it cam up with a message about internet connectivity, can i ignore this as the server is on my local network?

Do I need to install some sort of NTP software on the windows server? The document sort of implied this but I am not usre if it is necessary or not?
Better to regret something you have done, than something you havn't
Geoff Wild
Honored Contributor

Re: Setting the server time

Yes, your Windows server needs to have NTPSERVER software.


http://geodsoft.com/howto/timesync/wininstall.htm


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Scott Dunkley
Regular Advisor

Re: Setting the server time

Ok, I have installed NetTime on the windows server and set it up for UDP on port 23 (this was the default). On the UNIX side I have:

# ps -ef | grep ntp
root 1048 1 0 14:51:30 ? 0:00 /usr/sbin/xntpd
# tail /etc/ntp.conf
#filegen clockstats file clockstats type day enable
#
# Authentication stuff
#
#keys /usr/local/bin/ntp.keys # path for keys file
#trustedkey 3 4 5 6 14 # define trusted keys
#requestkey 15 # key (7) for accessing server variables
#controlkey 15 # key (6) for accessing server variables
#authdelay 0.000159 # authentication delay (SPARC4c/65 SS1+ MD5)
server ssi-tropos1 version 3 minpoll 10 prefer

so I would have assumed it would poll every 10 seconds and get the time from the windows server. but its not.

Looking at /etc/services port 23 on the unix side is reserved for TElnet, would this be why NTP isnt working?

what have i missed?
Better to regret something you have done, than something you havn't
Scott Dunkley
Regular Advisor

Re: Setting the server time

actually its on port 37 which in my services file is correct:

time 37/tcp timeserver # Time
time 37/udp timeserver #

what else have I missed?
Better to regret something you have done, than something you havn't
Jeff Schussele
Honored Contributor

Re: Setting the server time

Hi Scott,

Actually NTP uses port 123/udp
37 is for "homegrown" or application specific time functions. 23 is for good ole telnet.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Scott Dunkley
Regular Advisor

Re: Setting the server time

here is a screen shot from the windows box:

see attached.

It is using SNTP on port 123 and still no joy.
Better to regret something you have done, than something you havn't
Jeff Schussele
Honored Contributor

Re: Setting the server time

Hi Scott,

Couple of things:

You should use ntpq to query the server & check round trip times:
ntpq ntp_server_name

Then you must be within about 14 minutes (999 seconds to be exact) of the server or NTP will not sync up. If you're not then you need to use the date command to get close before starting the NTP client.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Scott Dunkley
Regular Advisor

Re: Setting the server time

Hi jeff,

Funny enough I was just looking at ntpq. My servers are within a minute of each other.

I did an ntpq ssi-tropos1 and it took me into the ntpq utility. tried a few of the commands but the interesting one is clocklist, it returns:

ntpq> clocklist
ssi-tropos1: timed out, nothing received
***Request timed out

So guess I dont have a connection, why would this be? I can ping ssi-tropos1 from the server ok.

# ping ssi-tropos1
PING ssi-tropos1: 64 byte packets
64 bytes from 192.0.1.113: icmp_seq=0. time=1. ms
64 bytes from 192.0.1.113: icmp_seq=1. time=0. ms
64 bytes from 192.0.1.113: icmp_seq=2. time=0. ms

----ssi-tropos1 PING Statistics----
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/1
Better to regret something you have done, than something you havn't
Jeff Schussele
Honored Contributor

Re: Setting the server time

Try to connect to it on port 123

telnet server_name 123

Although it will be a TCP connection, chances are that if 123/tcp is closed - 123/udp will be as well.

Is there a firewall between these two?
If so is 123/udp open - both directions?

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Scott Dunkley
Regular Advisor

Re: Setting the server time

I can telnet to it without a port number but get a connection refused when trying with the port number.

There is no firewall between them, they are both on a 192.0.1.xxx ip- address on our internal network.

Better to regret something you have done, than something you havn't
Jeff Schussele
Honored Contributor

Re: Setting the server time

Well...the telnet connection would be a TCP connection, but I may still indicate that the NTP server is not accepting 123/udp connections which would indicate that the NTP server is not running or not running correctly.
You might try setting up another Microslop system as an NTP client & see IF it can get it's time from the other Micro$oft system.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Scott Dunkley
Regular Advisor

Re: Setting the server time

will be wednesday now, thanks for your help Jeff, I'll sort out the points then as well.
Better to regret something you have done, than something you havn't