[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: NTP syncing best practice

Kai Hendry wrote:
I am little confused to how I am supposed to keep my RH servers synced.

Use ntpd. The preferred way is to have something like this in your ntp.conf file (I believe something like this is default):

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

Those contain round-robin lists of public NTP servers. If you have many machines, you should consider configuring one (or two for redundancy) of them to be server(s) (synced to above time sources), and the rest should sync to your time server. You'll save a lil bit of bandwith and do a world big favour.

Why ntpd and not ntpdate? ntpdate steps time. It simply queries the time source and sets the system time. On the other hand, ntpd will gradually speed up or slow down the local clock to keep it in sync with time source(s). This is a huge difference (much bigger than it might look at first). Some databases might not function correctly if time is stepped at the wrong moment. If you are compiling something, make command might not work correctly if time suddenly shifts. There are many more things that might go wrong. Use of ntpdate should be limited to system boot time, to set initial (starting) time before anything else important on the machine is started. This is exactly how ntpdate is used in ntpd startup script. Using it from command line on running system (or from cron job) is simply wrong and might even be dangerous.

As for the other methods you mentioned, most of them are rather archaic. Ntpd is the way to go, it is by far techically superior to any other method. The "hwclock" command does not sync the time. It simply copies time from BIOS (hardware) clock to system time, or from system time to BIOS clock, or can be used to read out BIOS clock. Red Hat systems will usually call hwclock command during system shutdown to sync hardware clock to current system time.

While we are at hwclock. If machine is Linux-only box (no Windows on it) it might be good idea to have UTC option in /etc/sysconfig/clock set to true. At least if you are unlucky to live in part of the World that observes that nonsense called daylight savings time. Otherwise, there's possibility that in some cases time on your system will be one hour off (for example system crash after switch to/from DST, and ntpdate fails at boot for whatever reason). After you change UTC to true, run "hwclock -w -u" from command line. If you change it the other way for whatever reason from true to false (you go nuts for example), you'll need "hwclock -w --localtime".

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]