Why do we need NTP? What is its structure and how should it be built? Some people say that the NTP protocol keeps the clocks on all your hosts in sync. In the end, let's take a look!

Network Time Protocol (NTP) is used to synchronize the system clocks of different hosts on the network. All managed hosts can synchronize time with a specified time server called an NTP server. On the other hand, the NTP server synchronizes its time with any public NTP server or any server of your choice. All NTP-managed devices can be accurate to the millisecond level when their system time is synchronized.

In an enterprise environment, if a company does not want to open a firewall for NTP traffic, it is necessary to set up an internal NTP server so that employees can use internal servers instead of public NTP servers. In this tutorial we will show you how to configure the CentOS system as an NTP server. Before you go into the details, let's take a look at the NTP concept.

Why do we need NTP?

Due to manufacturing differences, all (non-atomic) clocks do not run at exactly the same speed. Some clocks tend to go faster, while others go slower. So after a long period of time, the time of one clock gradually deviates from the other clock, resulting in the so-called "clock drift" or "time drift". In order to minimize the impact of clock drift, hosts using NTP should periodically contact the specified NTP server to keep the clock synchronized.

Time synchronization between different hosts is important for transactions such as scheduled backups, intrusion detection logs, distributed task scheduling, or transaction bookkeeping, and may even be a requirement for regulatory compliance.

NTP hierarchy

The NTP clocks are organized in a hierarchical hierarchy. Each layer in the hierarchy is called a stratum. The concept of layers describes how many NTP hops a machine has from an authoritative time source.

Analysis of the Importance of NTP (Taking CentOS as an Example)

Stratum 0 contains clocks with little time drift, such as atomic clocks. These clocks cannot be used directly over the network. The Stratum N(N) 1 server synchronizes its time against the Stratum N-1 server. Stratum N clocks can be connected to each other via the network.

NTP supports up to 15 layers in the hierarchy. Stratum 16 is considered to be out of sync and unusable.

Prepare the CentOS server

Now let's talk about how to set up an NTP server on CentOS.

First, we need to make sure that the server's time zone is set up correctly. In CentOS 7, we can use the TImedatectl command to view and change the server's time zone (such as "Australia/Adelaide").

# TImedatectl list-TImezones | grep Australia

# TImedatectl set-timezone Australia/Adelaide

# timedatectl

Analysis of the Importance of NTP (Taking CentOS as an Example)

Next, use yum to install the necessary software.

# yum install ntp

Then we will add a global NTP server to synchronize the time.

# vim /etc/ntp.conf

Server 0.oceania.pool.ntp.org

Server 1.oceania.pool.ntp.org

Server 2.oceania.pool.ntp.org

Server 3.oceania.pool.ntp.org

By default, NTP server logs are saved in /var/log/messages. If you want to use a custom log file, you can also specify the location of the file.

Logfile /var/log/ntpd.log

If you really choose to use a custom log file, be sure to change its ownership and SELinux context.

# chown ntp:ntp /var/log/ntpd.log

# chcon -t ntpd_log_t /var/log/ntpd.log

Now start the NTP service and make sure it has been added to the startup item.

# systemctl restart ntp

# systemctl enable ntp

Verify the NTP server clock

We can use the ntpq command to check how the local server's clock is synchronized via NTP.

Analysis of the Importance of NTP (Taking CentOS as an Example)

The following table explains the above output columns.

Analysis of the Importance of NTP (Taking CentOS as an Example)

Control access to the NTP server

By default, the NTP server allows inbound queries from all hosts. If you want to filter inbound NTP sync connections, you can add a rule to the firewall to filter traffic.

# iptables -A INPUT -s 192.168.1.0/24 -p udp --dport 123 -j ACCEPT

# iptables -A INPUT -p udp --dport 123 -j DROP

This rule will allow NTP servers from 192.168.1.0/24 (via port UDP/123) to deny traffic from all other networks. You can update the rules to suit your requirements.

Configuring an NTP client

1. Linux

The NTP client host requires the ntpdate package to synchronize its time against the server. It is easy to install the package using yum or apt-get. After installing the package, run the command with the server IP address.

# ntpdate "server-IP-address"

If it is based on RHEL and Debian systems, the commands are exactly the same.

2. Windows

If you use Windows, look for "Internet time" under the date and time settings.

3. Cisco equipment

If you want to synchronize the time of the device, you can use the following command from the global configuration mode.

# ntp server "server-IP-address"

Solder Cup Power D-Sub Connector

ANTENK are a leader in the design, worldwide manufacture, and marketing of Solder Cup Power D-Sub miniature, D-Sub connectors designed for applications that require a rugged / robust I/O connector system.The Antenk POWER-D & Combo-D mixed contact d-sub connectors solder type are designed for rugged / robust applications where both power & signal are required from a single connection. Featuring [Solid-Pin" machined contacts, these connectors offer high reliability performance. These products are used in nearly all application markets, from control and measuring to telecommunications and computer applications. Owing to the combination of various contact types there are numerous possibilities of saving installation space and costs in the interface area. Antenk Power D solder cup connectors have a metal shell in both the plug and socket versions as well as stamped contacts with tin/lead in the solder cup area. They offers ease of termination and reliability.

ANTENK POWER SOLDER CUP D-SUB CONNECTOR
Select from a full range of premium cable mount Solder Cup D-Sub Connectors in standard & high density pin positions with either stamped or machined contacts.

ANTENK SOLDER CUP D-SUB MIXED CONTACT | MACHINED FEATURES
D-Sub Mixed Contact Connectors in 12 industry standard contact configurations: 3W3 | 3W3K | 5W1 | 5W5 | 7W2 | 8W8 | 9W4 | 11W1 | 13W3 | 13W6 | 17W2 | 21W1 | 21WA4
Available with 20 or 40 amp power contacts, 5 amp signal.
Allows signal, high current & high voltage in one connector.
Contacts are pre-loaded into the insulator.

ANTENK SOLDER CUP D-SUB MIXED CONTACT MATERIALS
Shell: Steel, nickel plated
Insulator: Glass-Filled Thermoplastic, U.L. 94V-O, Black
D-Sub Mixed Signal Contacts: Machined Copper Alloy, Full Gold Flash
D-Sub Mixed Power Contacts: Machined Copper Alloy, Full Gold Flash

Combo Power D-sub Connectors,Power D solder cup connectors, High Current D Sub Connector solder type, POWER-D Mixed Contact Connectors,Combo D-sub Connectors

ShenZhen Antenk Electronics Co,Ltd , https://www.atkconnectors.com

Posted on