IMPORTANT: ntpdc seems a better tool than ntpq to see if your ntpd is working.
restrict 128.117.0.0 mask 255.255.0.0
disable auth
broadcastclient
I did
/etc/init.d/ntpd stop
/etc/init.d/ntpd start
,,,and waited a few minutes for the router's broadcast packets to
be heard. Then I did ntpq and "peers" and saw the router listed.
One other possible problem: if your machine's time is too far out of sync with the router's, ntpd won't correct it. To force synchronization, do "ntpdate mlra".
The ntp.conf file has a section that configures a fake driver. If you leave that on, you'll see the "LOCAL" peer. When you comment it out, ntpq "peers" will give "No association ID's returned".
Ntp version 4.1.0-4 came installed with Red Hat 7.2, but it wasn't turned on. I turned it on by doing
chkconfig ntpd on
THERE ARE NO MAN PAGES, only
HTML docs or the
xntp home page. The
latter includes something about how to check if xntp is working.
WARNING: !!!!! the following discusses ntp configuration files. The dhcpcd program will silently "help" you by overwriting /etc/ntp.conf, destroying whatever you put in /etc/ntp.conf. This isn't a problem for me on the laptop because I use a nondefault config file, but I wasted 1/2 a day figuring it out. If you need to use /etc/ntp.conf, you can use the -N command-line option to dhcpcd to stop the overwriting. Under Red Hat 7.2, dhcpcd is run when /etc/init.d/network runs /etc/sysconfig/network-scripts/ifup.
The NTP daemon reads a configuration file. Under Linux, the
default file is /etc/ntp.conf by default. On the
laptop, I use /etc/ntp.conf.work-server-client,
/etc/ntp.conf.work-broadcast-client, or
/etc/ntp.conf.home. The latter two don't work,
dunno why. Under Solaris, the file is
/etc/xntpd.conf.
To set up to use /etc/ntp.conf.work-server-client as the config file instead of the default /etc/ntp.conf, edit /etc/sysconfig/ntpd so that it contains
# Drop root to id 'ntp:ntp' by default. Requires kernel >= 2.2.18.
OPTIONS="-U ntp -c /etc/ntp.conf.work-server-client"
Notes about how to set the file up can be found in
DSG NTP configuration page.
The contents of /etc/ntp.conf.work-server-client are
logfile /var/log/ntp.log
server 128.117.8.251
Under Linux with ipchains, you'll have to allow NTP packets to
enter your system. Edit the
/etc/sysconfig/ipchains file to add this line:
-A input --source 0/0 --destination 0/0 123 --protocol udp --jump ACCEPT
By default, the /etc/init.d/ntpd startup script starts ntp with the -U ntp command-line option, which causes ntpd to run as user "ntp". This can cause /var/log/ntp.log to get messages like "can't open /etc/ntp.drift.TEMP: Permission denied". To prevent this, do:
touch /etc/ntp.drift /etc/ntp.drift.TEMP
chown ntp /etc/ntp.drift /etc/ntp.drift.TEMP
When running with an explicit peer (not in broadcast-client mode),
you can see how ntp is doing using the "ntpq" command and then
"peers". The "offset" column shows the difference between the
local host and the given peer, in millisconds (500 is 1/2 a
second).
To run the daemon in debug mode, do
ntpd -d -d -d U ntp -c /etc/ntp.conf.work-server-client
Check file /var/log/ntp.log to see
what's happening.
When you run ntpd, it seems to fix the system (software) clock and the hardware clock.
To do a one-time synchronization with a specific NTP server, like mlra, do
ntpdate mlra
(as root)
cd /usr/src
gunzip ntp-4.0.99k23.tar.gz
tar xf ntp-4.0.99k23.tar
rm ntp-4.0.99k23.tar
cd ntp-4.0.99k23
./configure
make
make install
make clean
This installs the following:
cd /etc/rc.d/rc2.d
ln -s ../ntpd S92ntpd
ln -s ../ntpd K06ntpd