0

I have one server: 192.168.0.40 and 4 clients: 192.168.0.61-192.168.0.64. The clients are Raspberry Pis and so have no real time clock. Therefore the time is always wrong.

I have followed instructions here to make ntp.conf files:

server:

restrict default nomodify notrap noquery
restrict 127.0.0.1 

# -- CLIENT NETWORK -------
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap

# --- OUR TIMESERVERS ----- 
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 127.127.1.0

# --- NTP MULTICASTCLIENT ---

# --- GENERAL CONFIGURATION ---

# Undisciplined Local Clock.
fudge   127.127.1.0 stratum 9

# Drift file.
driftfile /var/lib/ntp/drift
broadcastdelay  0.008

# Keys file.
keys /etc/ntp/keys

client:

restrict default nomodify notrap noquery
restrict 127.0.0.1 

# -- CLIENT NETWORK -------

# --- OUR TIMESERVERS ----- 
# 192.168.1.2 is the address for my timeserver,
# use the address of your own, instead:
server 192.168.0.40 iburst
server  127.127.1.0

# --- NTP MULTICASTCLIENT ---

# --- GENERAL CONFIGURATION ---

# Undisciplined Local Clock.
fudge   127.127.1.0 stratum 12

# Drift file.
driftfile /var/lib/ntp/drift
broadcastdelay  0.008

# Keys file.
keys /etc/ntp/keys

However, the time on the clients is still wrong (unchanged from before). When I try connecting specifically to the server, the client cannot find it. They are 100% on the same subnet and the IP addresses are right as I can ssh no problem.

The result of ntpq -c lpeer is:

localhost: timed out, nothing received
***Request timed out

Edit:

sudo ntpdate -u 192.168.0.40 :

12 Dec 07:45:09 ntpdate[12815]: no server suitable for synchronization found

Edit 2:

The clients are on a subnet on the ethernet, and the server is connected on wifi. The system works when wifi is disabled. Is there a way around this?

  • Can you use ntpdate 192.168.0.40 to force a sync? – muru Feb 9 '15 at 14:15
  • That gets an error. I've added the result to the question. – user2290362 Feb 9 '15 at 14:39
  • It doesn't look as if your NTP server is listening for 192.168.0.40 has an NTP service listening. Did you restart the service? – muru Feb 9 '15 at 14:41
  • That seems to be the answer. I had definitely restarted it before, but I think it needs to be restarted when I change the network? Post this as an answer and I'll nark it - thanks – user2290362 Feb 9 '15 at 14:45
  • See edit for more info on this – user2290362 Feb 9 '15 at 14:50
1

NTP probably needs to be restarted if you change networking settings (SSH does as well, for example). You can test if NTP is up and listening by using netstat on the server and ntpdate on the client

On the server:

$ sudo netstat -unlp | grep ntp
udp        0      0 192.168.122.1:123       0.0.0.0:*                 2786/ntpd          
udp        0      0 127.0.0.1:123           0.0.0.0:*                 2786/ntpd       
udp        0      0 0.0.0.0:123             0.0.0.0:*                 2786/ntpd       
udp6       0      0 fe80::4e72:b9ff:fe4:123 :::*                      2786/ntpd       
udp6       0      0 ::1:123                 :::*                      2786/ntpd       
udp6       0      0 :::123                  :::*                      2786/ntpd     

On the client:

sudo ntpdate <server-ip/hostname>
  • Can this be done on boot/at regular intervals? – user2290362 Feb 9 '15 at 15:03
  • 1
    @user2290362 Cron, perhaps?. Though I still think your routes are not properly configured and that you should look into fixing them. – muru Feb 9 '15 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.