ubuntu server安装ntp

来源:互联网 发布:创盈门窗软件 编辑:程序博客网 时间:2024/05/18 00:01

local NTP server not used by clients. Setup issue

up vote1down votefavorite

I have a local net with no internet and want to keep all computers in there time synced. I do not care about the absolute time, it should just be the same for all.

I found several posts about this. The most useful ones were:

  • How do I setup a local NTP server?
  • Setting up a standalone NTP server on Ubuntu

server

I did setup the server with the IP 192.168.1.123 and it seems to be working ok: The deamon "ntpd" is running and I had been adding in etc/ntp.conf the lines

# this sets the source to local timeserver 127.127.1.0fudge 127.127.1.0 stratum 8# this makes the ntpd deamon to send out its time on the local net.broadcast 192.168.255.255 

I verified it with the ntpq command:

 ntpq -c lpeer     remote           refid      st t when poll reach   delay   offset  jitter==============================================================================192.168.255.255       .BCST.     16 B    -   64      0  0.000    0.000   0.000

"BCST" says its in broadcast more and the IP shows its broadcasting to all computers on the local net (a B class network, thus 2x 255).

client

On client side I also installed ntp, and used the default /etc/ntp.conf and added the lines

server 192.168.1.123 iburstserver 127.127.1.0fudge 127.127.1.0 stratum 8

where 192.168.1.123 is the local IP of the server broadcasting and the other line should tell the client (a laptop) to use its own clock when the network connection is off. I restarted the service on the client and ran ntpq to check the connection

ntpq -c lpeer     remote           refid      st t when poll reach   delay   offset  jitter==============================================================================192.168.1.123        .INIT.     16 u     1   64     0   0.000    0.000   0.000LOCAL(0)             .LOCL.     8 l      6   64     1   0.000    0.000   0.000

Repeating this command I can see the "when" column counting up both and starting with 0 again when reaching 64sec. I did expect after the 64 sec this would change to this:

ntpq -c lpeer     remote           refid      st t when poll reach   delay   offset  jitter==============================================================================*192.168.1.123        .INIT.     16 u     1   64     0   0.000    0.000   0.000LOCAL(0)              .LOCL.     8 l      6   64     1   0.000    0.000   0.000

Note the "*" before the server IP. But it did not. What I got after about 1hr was

ntpq -c lpeer     remote           refid      st t when poll reach   delay   offset  jitter==============================================================================192.168.1.123        .INIT.     16 u     1   64     0   0.000    0.000   0.000*LOCAL(0)            .LOCL.     8 l     63   64   377   0.000    0.000   0.000

I think this tells me, there are 2 sources for NTP configured, but as the remote source is not working/not available/whatever it is not used and the fallback case local clock is used, but I am not sure if that interpretation is correct.

what I tried

I waited more than 1hr, I restarted the ntpd serveral times with sudo /etc/init.d/ntp restartand I also rebooted. Further I commented out the local section clock so that the only server was server 192.168.1.123. I could not get that "*" to appear. Also I saw a section in the ntp.conf that said

#if you want to listen to time broadcasts on you local subnet, #de-comment the next lines. Please do this only if you trust #everybody on the network!#disable auth#broadcastclient

I tried un-commenting and restarting the service but still that star did not appear. I am wondering about the last section, though, because this section did turn up in any other post or internet result that I saw on the ntp configuration. There are several ones on local setups and most seem to be find with the server address alone. Ping from client to server is fine. There is not firewall etc.

question

I am out of ideas. I think I have a server with fully working ntp server which is sending out the time. But I do have a client which is failing to receive the time information from the server.

What can I do to get the client running?



原文:https://askubuntu.com/questions/885345/local-ntp-server-not-used-by-clients-setup-issue

原创粉丝点击