CentOS / Red Hat Configure an NTP Client And Server

CentOS / Red Hat Configure an NTP Client And Server

To configure an NTP (Network Time Protocol) client and server on CentOS or Red Hat Linux, you can follow these steps:

  1. Install the ntp package using the package manager:
refer‮‬ to:lautturi.com
sudo yum install ntp
  1. Edit the /etc/ntp.conf file and specify the NTP servers you want to use. You can use the server directive to specify the NTP servers. For example:
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server 3.centos.pool.ntp.org
  1. Start the ntpd service:
sudo systemctl start ntpd
  1. Enable the ntpd service to start automatically at boot:
sudo systemctl enable ntpd
  1. Check the status of the ntpd service to make sure it's running:
sudo systemctl status ntpd
  1. Use the ntpq -p command to check the status of the NTP servers and make sure they are in sync.

To configure the system as an NTP server, you can use the restrict directive in the /etc/ntp.conf file to specify which clients are allowed to connect to the NTP server. For example:

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

This will allow clients on the 192.168.1.0/24 network to connect to the NTP server, but they will not be able to modify the server's configuration or request time samples.

It's always a good idea to carefully review the documentation and use the appropriate options to configure your NTP client and server. This will help ensure that your system is able to accurately synchronize its clock with the NTP servers.

Created Time:2017-10-27 14:56:37  Author:lautturi