Configure NTP server

To configure your Linux system as an NTP server, you will need to install the ntp daemon (ntpd). You can do this with the sudo apt-get install ntp command:

install ntp

The ntpd configuration file is /etc/ntp.conf. Open this file in a text editor:

etc ntp.conf

This file contains the list of internet NTP servers that will be used for time synchronization by your NTP server. You should also add a range of IP addresses that will be allowed to use this server as their NTP server. This can be done using the restrict command:

ntp conf restrict

In our example, the restrict mask nomodify notrap line will allow clients from the – subnet to query our NTP server.

Next, restart the NTP deamon with the sudo service ntp reload command:

service ntp reload

Next, you need to configure your NTP clients to use your NTP server for time synchronization.:

configure ntp client

Restart the NTP deamon on the NTP client (sudo service ntp reload). You can check whether time synchronization is successful by executing the sudo ntpq -p command on your NTP client:

ntpq p client

Geek University 2022