[TriLUG] Quick question about time syncing to linux servers
Ed Hill
ed at eh3.com
Wed Feb 27 11:32:29 EST 2002
On Wed, 2002-02-27 at 08:31, Matthew Hoover wrote:
> All,
> I know that there is a command to stick into a cron job to synchronize
> on linux server's time to another's. My problem is that I have
> mounted a filesystem from our main server onto my local server, and
> when I do makes, gmake is complaining about time skew. The NFS
> server is syncing its time to a time server on the net, so I don't
> need to worry about that. I just want to make the time on my box the
> same as the time on the NFS server.
Check out ntpd and ntpdate.
For a one-time sync, ntpdate is helpful. It syncs your clock to a time
server that you specify and reports the difference. See "man ntpdate".
Even better, the ntpd daemon will do exactly what you want as it
continuously queries a list of name servers and *gradually* adjusts the
system time so that there is a minimum of disruption. Its very accurate
and convenient if your box is always (or almost always) connected to the
net--which is probably the case if you use NFS a lot.
Included below is a sample config file for ntpd. You may want to try
the UNC timeservers (clock[1,2,3].unc.edu) if you can get access or find
some other local time servers (search for NTP servers on google). I'm
in CO, so don't use the servers I list.
hth,
Ed
ps - You might need to adjust your firewall to let NTP traffic through.
I use the following on my RH v7.2 boxen---add to your
/etc/sysconfig/ipchains config:
#eh3 Add ntp protocol support
#eh3 function firewall_enable_ntp_client {
#eh3 $IPCHAINS -A output -j ACCEPT $EXTIF -p udp -d 0/0 ntp
#eh3 $IPCHAINS -A input -j ACCEPT $EXTIF -p udp -s 0/0 ntp
#eh3 }
-A output -j ACCEPT -p udp -d 0/0 ntp
-A input -j ACCEPT -p udp -s 0/0 ntp
#eh3
--
Edward H. Hill III, PhD
Post-Doctoral Researcher | Email: ed at eh3.com, ehill at mines.edu
Division of ESE | URL: http://www.eh3.com
Colorado School of Mines | Phone: 303-273-3483
Golden, CO 80401 | Fax: 303-273-3311
Key fingerprint = 5BDE 4DA1 66BE 4F7B BC17 3A0C 932B 7266 1E76 F123
-------------- next part --------------
#This file was generated by dateconfig
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
# server 127.127.1.0 # local clock
# fudge 127.127.1.0 stratum 10
# server tick.cs.unlv.edu
server utcnist.colorado.edu
# navobs1.usnogps.navy.mil
# server clock1.unc.edu
# tick.cs.unlv.edu
tock.cs.unlv.edu
ntp1.cs.wisc.edu
#
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /etc/ntp/drift
multicastclient # listen on default 224.0.1.1
broadcastdelay 0.008
#
# Authentication delay. If you use, or plan to use someday, the
# authentication facility you should make the programs in the auth_stuff
# directory and figure out what this number should be on your machine.
#
authenticate no
#
# Keys file. If you want to diddle your server at run time, make a
# keys file (mode 600 for sure) and define the key number to be
# used for making requests.
#
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will. Note also that
# ntpd is started with a -A flag, disabling authentication, that
# will have to be removed as well.
#
#keys /etc/ntp/keys
More information about the TriLUG
mailing list