I'm trying to configure NTP on my machine but it seems that the parameters I set are not being read by the system. Below is my /etc/ntp.conf
file. (I applied the most basic configuration to eliminate other issues)
server 10.45.68.47
server 127.0.0.1
After I set the above configuration, I restart the ntpd process by doing the following:
service ntpd restart
And then I get the following output:
Shutting down ntpd: [ OK ]
ntpd: Synchronizing with time server: [FAILED]
Starting ntpd: [ OK ]
Moreover, I can see the following in /var/etc/messages
:
Apr 2 10:54:07 hsystem1a ntpd[21067]: ntpd exiting on signal 15
Apr 2 10:54:07 hsystem1a ntpdate[21537]: can't find host ntpServer1
Apr 2 10:54:07 hsystem1a ntpdate[21537]: can't find host ntpServer2
Apr 2 10:54:07 hsystem1a ntpdate[21537]: no servers can be used, exiting
So it seems that the ntpServer1
and the ntpServer2
are being read from somewhere instead of the IPs I configured in /etc/ntp.conf
.
NOTE: I done init 6
on the machine just in case.
UPDATE
It seems that the target server is reachable but it is not synchronized. I know that if the synchronization is successful, then "*" should appear near the server name:
remote refid st t when poll reach delay offset jitter
==============================================================================
omap 127.0.0.1 7 u 50 64 377 0.269 -21536. 4.813
Best Answer
On Red Hat there are a couple of things that happen when you do
service ntpd restart
.ntpd
is stoppedntpdate
is run to set an initial time. This is because, by default,ntpd
will not adjust the system time past a certain threshold.ntpdate
does a one off time set using a specified time server. You can do this manually withntpdate 10.45.68.47
as long as ntpd isn't running.ntpd
is started againntpd's servers are specified in
/etc/ntp.conf
butntpdate
takes them from a file called/etc/ntp/step-tickers
. If you look in thentpd
script in/etc/init.d
you'll notice thatntpdate
uses this file if there is anything in it (if it is empty, thentpdate
step is skipped). You can put your time servers in here:and
ntpdate
will use them to set the initial time.As an aside, you shouldn't have localhost as a time server. Use a local server and maybe some servers from the ntp pool project. Make sure they are geographically close to you for best results. Also, I would re-instate the default Red Hat config as it has some sensible defaults i.e. not allowing other servers to set the time on your server.