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?

Eric Carvalho
  • 54,385
user2290362
  • 123
  • 1
  • 5

1 Answers1

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>
muru
  • 197,895
  • 55
  • 485
  • 740