Install ntp package that provides ntpd daemon.
dnf install ntp -y
After the installation, you need to edit the
/etc/ntp.conf configuration file to add the address of your NTP server.
The server command takes the following syntax;
where address is either the IP or resolvable hostname of the NTP server.
... # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). #pool 2.fedora.pool.ntp.org iburst server 192.168.43.69 iburst ...
Save the configuration file and restart ntpd daemon.
Verify the connection to the server using the netcat command;
# nc -zuv 192.168.43.69 123 Ncat: Version 7.70 ( https://nmap.org/ncat ) Ncat: Connected to 192.168.43.69:123. Ncat: UDP packet sent successfully Ncat: 1 bytes sent, 0 bytes received in 2.01 seconds.
Now that your client can successfully connect to your NTP server, verify that time synchronization is working;
# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== 192.168.43.69 184.108.40.206 4 u 31 64 7 0.292 67.320 12.531
If you want to synchronize the time of your client with NTP server once, you can use
ntpdate as follows;
dnf install ntpdate -y
Once the installation is done, you can use the ntpdate to synchronize the time as follows;
Start and enable ntpdate
systemctl start ntpdate systemctl enable ntpdate
To use ntpdate, you need to stop and disable ntpd
systemctl stop ntpd systemctl disable ntpd
To verify that time synchronization works fine, run ntpdate command as shown below
# ntpdate 192.168.43.69 18 Nov 12:30:02 ntpdate: step time server 192.168.43.69 offset 3608.684470 sec
Great. That is all it takes to configure local NTP server on Fedora 29.
To configure NTP server on Fedora 30 using NTPd, then check our guide by following the link below;