I have two machines,
- host A with IP 192.168.0.1
- host B with IP 192.168.0.2
They connected to the same network and I would like to set the date and time of machine B to match those of machine A. While I can set up the machines with an internet connection initially, they will not have access to it once deployed and they will be rebooted every day.
Current Approach using Chrony Reference.
This configuration is not correct, based on some test results, the synchronization succeeds when the NTP server has an internet connection and fails otherwise.
Do you have any advice or suggestions for configuring them effectively?
Machine A - Configured as NTP server
sudo apt update && sudo apt upgrade
sudo apt install chrony
sudo vim /etc/chrony/chrony.conf
Used this configuration to set up the NTP server
confdir /etc/chrony/conf.d
pool ntp.ubuntu.com iburst maxsources 4
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
pool 2.ubuntu.pool.ntp.org iburst maxsources 2
allow 192.168.0.0/24
sourcedir /run/chrony-dhcp
sourcedir /etc/chrony/sources.d
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift
ntsdumpdir /var/lib/chrony
logdir /var/log/chrony
maxupdateskew 100.0
rtcsync
makestep 1 3
leapsectz right/UTC
Restarted the chrony service, checked that was running and enabled it to start on boot
sudo systemctl restart chrony
sudo systemctl status chrony
CTRL+C
sudo systemctl enable chrony
Machine B - Configured as Chrony Client
Synced the date and time with a pool of servers and set the 192.168.0.1
sudo apt update && sudo apt upgrade
sudo apt install chrony
sudo vim /etc/chrony/chrony.conf
Used the following configuration file
pool 192.168.0.1 iburst prefer
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift
logdir /var/log/chrony
log measurements statistics tracking
maxupdateskew 100.0
rtcsync
makestep 1.0 3
Restarted, checked the service and enabled it at startup
sudo systemctl restart chrony
sudo systemctl status chrony
CTRL+C
sudo systemctl enable chrony
Update If I manually synchronize the time, I get the following error No suitable source for synchronisation.
sudo systemctl stop chrony
sudo chronyd -d 'server 192.168.0.1 iburst'
2023-03-15T15:54:55Z chronyd version 3.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)
2023-03-15T15:54:55Z Initial frequency -36.773 ppm
2023-03-15T15:55:03Z No suitable source for synchronisation
2023-03-15T15:55:03Z chronyd exiting
Update 2
If I connect the NTP server to internet, then the synchronization succeeds.