I am trying to ntp sync one machine with another. both runs Debian lenny, and I installed the ntp package in both. I configured the server to synchronize with an external machine by putting
server IP.ADDRESS iburst
in it's /etc/ntp.conf file.
I configured the client to sync with the serve by putting only the server in /etc/ntp.conf of the client.
however, they do not seem to be synchronizing. ntpq shows that the state is INIT which - according to the docs - indicates that "The association has not yet synchronized for the first time"
# ntpq -n
ntpq> pe
remote refid st t when poll reach delay offset jitter
==============================================================================
10.99.84.134 .INIT. 16 u 665 1024 0 0.000 0.000 0.000
ntpq -> as shows 'reject' in the condition line:
# ntpq
ntpq> as
ind assID status conf reach auth condition last_event cnt
===========================================================
1 40102 8000 yes yes none reject
Any idea how to solve this? (I would rather not use ntpdate).
Many distributions these days are configuring ntpd to restrict access. If
restrict
lines are present in your server's/etc/ntp.conf
, only hosts/networks matching those lines will be permitted to connect to ntpd. You probably need to add additionalrestrict
lines for the hosts or networks you want to allow to sync to your server. For example, to let the client you mentioned sync, add one of the following lines:After that, restart ntpd, and your clients should be able to sync.
The problem was that the server itself was not able to synchronize with it's upstream server. the solution was to change the server configuration like this:
re-enabled the Debian pool servers instead of my single hard coded server.
I added a local clock reference, this makes the server appear synchronized to clients even when it's not, which is the desired behavior for my setup.
Once I made those changes, the server managed to synchronize itself and then the clients managed to sync with the server.
You can also say there's some sort of connectivity problem because the "reach" is still 0.
Turn off ntp for a moment, and try running ntpdate to sync it once:
If that fails, you definitely have a connectivity problem:
If there's no firewall problems, verify on 10.99.84.134 that ntp is listening
netstat -tapn | grep 123
Try to run tcpdump on the server to intercept all tcp and udp traffic that comes to and goes from port 123. Guess if the packets can reach the port without problems, they are blocked somehow on their way back, by a firewall of the client for example
make sure udp port 123 is allowed[Out] in the firewall. I had the same issue and it was because of firewall blocking the port 123.