Visit The New, Modern Unix Linux Community


Auto NTP Time Synchronization


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Auto NTP Time Synchronization
# 1  
Question Auto NTP Time Synchronization

Good morning,

My first post and first visit, so hello. I have been asked to see if one of our Linux boxes can have it's time sync automatically because the person who built the system has told our staff it cannot be done. To me that raised some flags because although I am no Linux expert, I just thought, that's impossible.

So I did a bit of research before seeking help form the experts before I try anything.

First thing I came across was the command,

Code:
ntpdate pool.ntp.org <- which would sync the box to public NTP servers

Then this command
Code:
crontab -e 
0 4 * * * /usr/sbin/ntpdate pool.ntp.org <- which would create a schedule to sync every night at 4am

Am I on the right track? We are using Red Hat 5.2 (tikanga), and I don't want to screw anything up, like I said I'm familiar with Linux to some point but no expert. Boils down to wanting this system to synchronize daily with EST Time server.

Thank you for any suggestions and tips or tricks for a linux newb.Smilie


Moderator's Comments:
Mod Comment Please use code tags!

Last edited by YSupport; 12-13-2011 at 02:52 PM.. Reason: code tags, see PM
# 2  
That's almost exactly what we have, except instead of syncing every night at 4am, we do so every boot.

Generally there's no such thing as an 'EST time server'. Your system clock is supposed to be set to time zone 0, Greenwich mean time, and the local time zone controlled by the TZ variable, or a profile file, or other means. If your admin set the clock itself to local time, I'm not sure what to do.

---------- Post updated at 09:17 AM ---------- Previous update was at 09:10 AM ----------

Actually I do know what to do. Run ntpdate -q pool.ntp.org and see if it wants to advance the time 9 hours or something crazy, or whether it's just off by minutes or seconds. -q tells it not to set the time, just query.
This User Gave Thanks to Corona688 For This Post:
# 3  
Firstly, my apologies for not enclosing my code samples within the proper tags, corrected now.

Thank you Corona688 for the reply. I will do as you mentioned, our system rarely reboots so having our at boot time would not work in my case anyway. Thank you for the explanation of time zone offsets, I never knew this with Linux. Appreciate your input.
# 4  
That seems like such a convoluted way to use NTP, which actually DOES sync time automatically.

Normally, you would just run ntpd and synchronize to a time server, rather than slamming the clock and creating additional drift.
# 5  
Quote:
Originally Posted by mark54g
That seems like such a convoluted way to use NTP, which actually DOES sync time automatically.

Normally, you would just run ntpd and synchronize to a time server, rather than slamming the clock and creating additional drift.
So mark54g how would your suggestion of running ntpd be utilized on our system then to automatically keep the system continually synchronized because right now they are having to on monthly basis resync cause it drifts 3-4 minutes out. Using the same kind of crontab command to set up the scheduling? Thanks.
# 6  
Absolutely not using cron. ntpd is a daemon. It is constantly running and should be set up via an appropriate ntp.conf file to ensure that it stays within milliseconds, not minutes. You may need a step tickers and drift file, as well as statistics, but you can, with a good time source, be within about 20 milliseconds over the internet without much issue.

Personally, I would suggest you get a master clock, but if you don't need sync to be that tight, you can sync to the internet as long as there are not a lot of machines.

Quick HOWTO : Ch24 : The NTP Server - Linux Home Networking

You should not have to download it, but configure it as instructed.

Essentially, you will end up, with the appropriate configuration and init scripts, set up your server to slew the clock toward the appropriate time so that you are within a margin of error. The speed/latency to the internet does not actually matter as much as the differential between answers, and you should be polling those upstream lower stratum servers every few minutes to make sure you are not out of the ballpark. Then, the algorithm for ntp will be able to "Train" your clock on the server to stay within acceptable ranges by use of a drift file.
This User Gave Thanks to mark54g For This Post:
# 7  
Thank you mark54g, I have set up ntpd and hopefully that should take care of our problem. The service was not running and when I looked it up it was only checking locally, so added a known NTP that were using for our manual execution.

Appreciate you pointing me in the right direction.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #940
Difficulty: Medium
Ping was not included in 4.3BSD.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Ntp : How is the synchronization time scheduled?

Hello, one of my clients has the following task for me: To write a Perl script that checks, whether ntp is active on a particular AIX or Linux box. Obviously the last synchronization is logged in the file ntp.log So, my task would be find out, when the synchronization SHOULD have taken... (1 Reply)
Discussion started by: Bloehdian1
1 Replies

2. HP-UX

Ntp time synchronization problems

There is one server in my company where the time is out of sync. When I checked (compared with other servers whose time is correct), the XNTPD variable in /etc/rc.config.d/netdaemons was set as 0. I changed this to 1, and tried restarting the xntpd process with : # /sbin/init.d/xntpd start ... (4 Replies)
Discussion started by: anaigini45
4 Replies

3. AIX

NTP time problem

I got an ntp time problem on AIX server. os version is AIX7.1 OS LEVEL 7.1.0.0 i got below output,when i run the below command bash-3.2# ntpdate -dv XXXXXXXXXXXXXXXXXXXXXXXX 4 Dec 12:50:49 ntpdate: 3.4y transmit(xxxxxxxxx) receive(xxxxxxxxx) transmit(xxxxxxxx) receive(xxxxxxxxx)... (9 Replies)
Discussion started by: murali969
9 Replies

4. Red Hat

ntp time synchronization

hello all,, am trying to do a time synchronization between a ntp server and a client, but facing some problems in doing so: i run the ntpdate in debug mode and this is what i got. please help me out.. # ntpd -d -u 172.22.1.207 ntpd 4.2.2p1@1.1570-o Sun Aug 28 19:21:03 UTC 2011 (1)... (1 Reply)
Discussion started by: rahul11c
1 Replies

5. Linux

How often does Linux NTP server update its time with the external NTP server?

All here, thank you for listening. Now I've set up a Linux NTP server by adding a external windows NTP server in /etc/ntp.conf. Then I start the ntpd daemon. But how often does the Linux NTP server update its time with the external NTP server? I've looked up everywhere but found no information... (1 Reply)
Discussion started by: MichaelLi
1 Replies

6. AIX

NTP - with time difference

We have configured most of 1200 servers with an NTP server. For the rest of the servers, I have a strange requirement. I want to synchronize them with NTP time with a lag of 15 minutes. Is it possible ? If yes How ? (0 Replies)
Discussion started by: shauche
0 Replies

7. UNIX for Advanced & Expert Users

time synchronization

i have an HP UNIX box w/c acts as ntp server... I tried to change the time plus 8 minutes... the problem is that the other HP UNIX ntp client did not follow the time... when I tried to restart ntp client... using stop start it only sync to the server once... when I issue the command "ntpq -p", w/c... (2 Replies)
Discussion started by: inquirer
2 Replies

8. HP-UX

NTP time

Is anyone familiar with adding NTP timing to a HPUX 10 OS? Thanks Brian (2 Replies)
Discussion started by: breigner
2 Replies

9. UNIX for Dummies Questions & Answers

Time synchronization

All What is the best way to keep the system clock synchronized? I have looked at ntp and netdate. Is one good over the other? Basically I want to know if what is the most secure way to keep the system clock insync. netdate will require me to open up some port 37... is this safe? ntp also... (1 Reply)
Discussion started by: skotapal
1 Replies

10. UNIX for Advanced & Expert Users

ntp across time zones

I've been tasked to implement ntp on my SCO Unix servers. I have over 600 servers spread across the US in different time zones. Each remote server has network connectivity to a main server here, through their local ISP. (That's how we currently deliver mail to them). My question is, how can... (5 Replies)
Discussion started by: Howeird
5 Replies

Featured Tech Videos