In an organization, there are many administrative processes that need the registry to be correct. An essential field of the records is the date and time they are made. Therefore, it is necessary that all computers have synchronized the date and time. So, to do this it is necessary to configure an NTP server.
NTP (Network Time Protocol) is an Internet protocol for synchronizing the time and date of computer devices on a computer network. In addition, it uses port 123 of the UDP transport layer.
So, let’s set up an NTP server on CentOS 7.
1. Upgrade the system
The first step in this tutorial is to update the system. This ensures that the security patches are properly installed on your system.
Access your server and run.
:~$ su :~# yum update
So, that’s it. You can continue.
2. Install NTP server
Now it is necessary to install the NTP package. It is simple as it is available in the official repositories.
:~# yum install ntp
Once the installation process is completed, it is necessary to edit the
/etc/ntp.conf file, which is where the NTP server configuration is hosted.
First, go to the page where the official NTP servers are hosted. Here you locate the server closest to where the server is physically located.
Find a server in the same country and add those lines to the configuration file. As I show you in the image.
:~# nano /etc/ntp.conf
Of course, now we have to allow network members to synchronize with the server we are configuring. In addition, it is advisable to restrict clients who cannot modify NTP server settings.
Finally, you can include a log file to find out what’s going on with the NTP server. So, it is advisable to do this because if there is a problem viewing that file you can fix it.
3. Set the Firewall rule and start the service
For the NTP server to work, it is necessary to set the standard in the Firewall so that it can have access.
:~# firewall-cmd --add-service=ntp --permanent :~# firewall-cmd --reload
Next, enable and start the service.
:~# systemctl enable ntpd :~# systemctl start ntpd
Now, let’s verify the NTP server.
4. Check the NTP server
It is now necessary to verify that everything has gone well. run this commands to check.
:~# ntpq -p :~# date -R
In case you want to synchronize with a specific server, you can do it with the following command.
:~# ntpdate -q 0.us.pool.ntp.org
And that’s it.
As you can see, setting up an NTP server is not a complicated thing. However, doing so guarantees that our computer equipment has a synchronization in time and date necessary for all processes can be performed properly.
Please share this article with your friends.