Operating System - Linux
1828340 Members
3779 Online
109976 Solutions
New Discussion

Re: Synchronize system time

 
SOLVED
Go to solution
peterchu
Super Advisor

Synchronize system time

We have many RH linux servers , some are on remote sites , I want to find the best way to synchronize the system time , I know NTP is good , but it require
all servers access the internet to update the time ( I may wrong ) , could suggest the way ? thx.
12 REPLIES 12
Stuart Browne
Honored Contributor
Solution

Re: Synchronize system time

I take it they have access to each other on a WAN?

You can set up your own NTP *SERVER* and get every machine to sync off that, but it's probably easier to use the 'rdate' command, and have the 'time' port open (udp 37).

Simply put, enable the time UDP service on one server ('chkconfig time on' on a RH system), and on your remote systems:

rdate -s

Schedule it (with cron) to run semi-regularly, and you're done!

Quick way to sync time on multiple servers.
One long-haired git at your service...
peterchu
Super Advisor

Re: Synchronize system time

Thx reply , one more qestion, if use your method , do you mean I only need to update one server system time and then syn. to other server ? if yes , you would suggest me to use NTP to update this server system time ? thx.
Stuart Browne
Honored Contributor

Re: Synchronize system time

If you don't trust your central server's clock to keep accurate time, then yea. Have the central one NTP to the outside-clock, and get the rest to rdate from your one central server.
One long-haired git at your service...
Martin P.J. Zinser
Honored Contributor

Re: Synchronize system time

Hi Peter,

setting up one central server as the NTP provider for your network is also easy enough. Thats what I do at home here ;-). If you do not can/want to connect this server to the Internet you can buy an external clock to hook-up to your server.

E.g. http://www.linux-mag.com/cgi-bin/printer.pl?issue=2000-12&article=guru

has a discussion on this.

Greetings, Martin
peterchu
Super Advisor

Re: Synchronize system time

one more question , as there are other machines are at remote site , and we don't have the root password , if no root password , is it possible to update the system time ? thx.
John Collier
Esteemed Contributor

Re: Synchronize system time

Maybe this is out of my field a little bit, but if it is important that all of the boxes are sync'd on time, then wouldn't it be possible to get the local admin's there to set up their end? It's not like you would be asking them to set up a time server on their end, just connect to the one you have 'graciously' provided. Do you see that being or creating a problem?
"I expect to pass through this world but once. Any good, therefore, that I can do, or any kindness that I can show to any human being, let me do it now. Let me not defer or neglect it, for I shall not pass this way again." Stephen Krebbet, 1793-1855
Martin P.J. Zinser
Honored Contributor

Re: Synchronize system time

Hi,

I agree with John, this is the beauty of NTP. You setup the server, they configure it on their end and you do not need any access to the remote system. Else setting the date/time usually does require privs (and this for good reasons since this can wreck havoc on applications).

Greetings, Martin
Stuart Browne
Honored Contributor

Re: Synchronize system time

For the 'rdate' thing, no host equivalency is required.
One long-haired git at your service...
Martin P.J. Zinser
Honored Contributor

Re: Synchronize system time

Hi Stuart,

but rdate would need to be executed on the remote system, so again privs on the remote system are required or do I have this wrong?

Greetings, Martin
Charles Holland
Trusted Contributor

Re: Synchronize system time

Stuart,
Use NTP on one or two servers to get the time from a stratum 1 server on the internet. Have these two servers be a peer to each other. That way you can have one off line while the other continues on.
Lets say you have 10 additonal servers. Have 5 get their time from off, your now stratum 2 servers, and do a peer between all 10. Repeat process for other 5.
Once everything is set up and synced you should be able to even take the two main time sync systems off line at the the same time and the other 10 will sync to themselves.

It works here. We then sync our Windows servers from our UNIX boxes and some individual pc's as well.
Regards
"Not everything that can be counted counts, and not everything that counts can be counted" A. Einstein
Stuart Browne
Honored Contributor

Re: Synchronize system time

Yes. For all of the idea's here, you'll have to have administrative privileges to configure.

Once configured however, they are all leave-alone.

They all also require the central server to have it's firewall opened up to allow the associated protocol.
One long-haired git at your service...
Steven E. Protter
Exalted Contributor

Re: Synchronize system time

Hello Sir,

The original suggestion, ntp is the way to go. Its easy to implement, just do this:


Pick a time server.
chkconfig --level 12345 xntpd on
service xntpd start

Mr. Browne and others have given of their time in hopes that you would show the courtesy of assigning points.

Your record 1 of 155 at this time is atrocious.

Please Click here:
http://forums1.itrc.hp.com/service/forums/pageList.do?userId=CA1084347&listType=unassigned&forumId=1

Fix the problem.

I'm sure you'd have more suggestions if you were a better citizen of the itrc community.

0 points from me, and this is the last you'll hear from me on your questions until you improve your assignment record.

Apologies to any itrc membership offended by my tirade.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com