Advance

How to Install NTP server on Linux CentOS

Install NTP server on Linux CentOS
1
(3)

[Updated] The NTP is a network time protocol. NTP is responsible for unifying the time and date of the system, to prevent communication problems on a large global network. You may have faced a message while running a program or opening a site with the content “Update your system time and time zone”. This process occurs when your system displays an incorrect date and time. On large Windows networks, the PDC Emulator service is responsible for synchronizing system time, and on Linux systems, a server is usually selected as the NTP server. The NTP server receives timely information from reputable NTP Internet servers and refers them to in-network systems. In this article on Linux tutorial collections, we are going to learn about the Install NTP server on Linux CentOS. You can visit the packages available in Eldernode to purchase a CentOS VPS server.

Tutorial Install NTP server on Linux CentOS 8 | CentOS 7

In this tutorial, we’re going to look at how to set up an NTP server on Linux CentOS with Linux commands and run an NTP server. Please stay tuned for the rest of this tutorial.

Recommended Article: How to Access Linux VPS from Windows

How does the NTP protocol work?

The NTP provides the server with a time signal from atomic clocks and distributes it in the system with the help of the UTC world clock. An NTP server consists of synchronization devices such as a client and an NTP server that receives UTC time and provides it to clients.

Clients and servers communicate in a series of requests and responses as follows:

– The client sends an NTP request packet to the time server and confirms the execution time (source start time).

– The server confirms when the request packet was received.

– The server sends a response packet to the client again.

– The customer confirms the destination time when receiving the response package.

This process may only take nanoseconds. Timestamp allows the client to calculate the latency in the roundabout, check the difference between its internal time and the time provided by the server, and reset the clock accurately if necessary.

In the continuation of this article, we will learn how to install the NTP server on Linux CentOS.

How to Install NTP server on Linux CentOS

1- First, connect to your CentOS Linux console.

2- Install the NTP service package with the yum command.

yum install ntp

3- After installation, open the NTP setting file with an editor.

nano /etc/ntp.conf

Note: In this file, you will see the related settings to your NTP server. Look for the phrases which start with “server” and then change them to comment by the # sign. You can get help from ntppool.org to choose a better and closer server. First, log in and select your geographic area to display the names of the servers closest to you. It is recommended that you add 2 or 3 servers to this file.

4- Next, enter the following command in the ntp.conf file to send service permission to your network IPs.

restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap

Note: The above command allows access to 192.168.1.0. Be sure to enter your network IP address instead of the IP address of the network. And then save it after making changes on the ntp.conf file.

5- In case you need to observe troubleshooting or service operation, create a log file and add the following phrase in the ntp.conf file.

logfile /var/log/ntp.log  

6- At the end, after executing the above commands, the image of your ntp.conf file is as follows.

 

NTP-config-file

 

7- When you made all the changes, restart the service once.

service ntpd restart

8- Enter the following command to test the accuracy of the NTP service.

ntpq -p
date -R

The first command will check the connection of added servers. The second command will display the system updated date full. If you get the correct result from the above commands, the NTP server setup process in CentOS Linux will be completed successfully. pay attention that the NTP protocol works on port 123 and with the UDP protocol, so make suitable changes on your Linux firewall to open this port.

Conclusion

Network Time Protocol is a protocol that works with the UDP 123 port in the transport layer. This protocol allows network computers to synchronize time. As time goes on, the computer’s internal clock ignores the issue of time. Especially in the case of client and server log files or if you want to replicate servers or databases. In this article, we tried to show you how to install the NTP server on Linux CentOS. You can also refer to these articles if you want to install NTP Server on Ubuntu, Debian, and Windows Server.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day