How to Configure NTP in Linux Operating Systems?

What is NTP?

An abbreviation for “ NTP Network Time Protocol”. NTP is a protocol used to synchronize the clocks of computers on packet-switched networks with variable latency. The protocol is specifically designed to be resistant to the effects of variable delay, thanks to the use of jitter buffers. NTP is one of the oldest Internet protocols still in use. NTP uses the User Datagram Protocol (UDP) over port 123. NTP settings are made from either the  /etc/ntp.conf or /etc/xntp.conf file, depending on which Linux distribution is used.

Now let’s move on to our configuration. We will examine our configuration under two headings, “NTP Client and “NTP Server“. We will also examine the configuration for the “Oracle Real Application Cluster” environments.

NTP Client

1. We log in to our server with the “root” user and install our NTP package.

2. We are starting the NTP Service on our server and at the same time, we are making the necessary configuration for it to start automatically when our server starts up.

3. If we are going to make any configuration in our NTP service, we do it in the “/etc/ntp.conf” file.

4. If we change any settings in this file, we must restart the NTP Service.

5. If our Firewall is open, we need to make the necessary adjustments in the Firewall service so that our NTP service can work. If our Firewall service is turned off, we can skip this step.

A-) Let’s Configure NTP Client

1. We add the addresses of our time servers in the NTP configuration file “/etc/ntp.conf”.

2. After making these changes, we restart our service for the settings to take effect.

3. We can check the accuracy or availability of our server by querying the time of our local network environment or other server.

B-) NTP Server Configuration

1. If we want to configure our server to provide NTP Server service, we must make the necessary arrangements in the “/etc/ntp.conf” file after the above installation steps. In order for our server to update its own date and time, it must be able to access servers on the internet. Otherwise, we have to manually adjust the settings of our server ourselves. In addition, security settings must be made in order for our server to serve computers on the local network.

2. After making these changes, we restart our service for the settings to take effect.

Configuring “Oracle Real Application Cluster” Builds

1. If we are going to use “Oracle Cluster Time Synchronization” instead of “NTP” for time synchronization in Oracle Real Application Cluster installation, we should make our settings as follows to turn off the NTP service.

2. If we are going to use the “NTP” service for time synchronization in the Oracle Real Application Cluster installation, we should make our settings as follows.

The steps applied here have been tested on the “Oracle Enterprise Linux 6.4” operating system. It is also compatible with other Linux distributions.

I hope it was a useful article.