Detailed process of NTP server configuration under Linux

Detailed process of NTP server configuration under Linux

1. Environment Configuration

1.NTP Server

NTP server version: Red Hat Enterprise Linux release 8.0 (Ootpa)
NTP server IP: 192.168.8.11/24
NTP server hostname:node1

2. Business Server

NTP server version: Red Hat Enterprise Linux release 8.0 (Ootpa)
NTP server IP: 192.168.8.12/24
NTP server hostname:node2

2. NTP server configuration

1. Check the chrony service status

[root@node1 ~]# systemctl status chronyd
● chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:chronyd(8)
           man:chrony.conf(5)
[root@node1 ~]# 

2. Start the chrony service

[root@node1 ~]# systemctl enable --now chronyd
Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.

3. Turn off firewall and selinux

[root@node1 ~]# systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@node1 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@node1 ~]# setenforce 0
setenforce: SELinux is disabled
[root@node1 ~]# getenforce 
Disabled
[root@node1 ~]# 

4. Configure NTP service file

[root@node1 ~]# vim /etc/chrony.conf 
[root@node1 ~]# cat /etc/chrony.conf |grep -Ei '(allow|local)'
# Allow the system clock to be stepped in the first three updates
# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 192.168.8.0/24
local stratum 10
[root@node1 ~]# 

5. Restart the service

[root@node1 ~]# systemctl restart chronyd
[root@node1 ~]# 

3. Business Server Configuration

1. Enable chrony service

[root@node2 ~]# systemctl enable --now chronyd
Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.
[root@node2 ~]# 

2. Configure chrony service file

[root@node2 ~]# vim /etc/chrony.conf 
[root@node2 ~]# cat /etc/chrony.conf |grep pool
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
pool 192.168.8.11 iburst
[root@node2 ~]# 

3. Restart the service

[root@node2 ~]# systemctl restart chronyd
[root@node2 ~]# 

4. Test the business server time status

1. Check the time synchronization status

[root@node2 ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample               
===============================================================================
^? 192.168.8.12 0 7 0 - +0ns[ +0ns] +/- 0ns
[root@node2 ~]# 

2. Immediate time synchronization

[root@node2 ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 192.168.8.11 10 6 17 2 +249ns[ +141us] +/- 100us
[root@node2 ~]# chronyc sources -v
210 Number of sources = 1

  .-- Source mode '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 192.168.8.11 10 6 17 8 +249ns[ +141us] +/- 1103us
[root@node2 ~]#

This is the end of this article about the detailed process of NTP server configuration under Linux. For more relevant Linux NTP server configuration content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to use NTP to keep accurate time in Linux
  • Detailed explanation of Linux NTP server time synchronization settings
  • How to configure ntp server in linux
  • Installation and configuration of Linux time synchronization ntp service

<<:  CSS description of the implementation code for displaying text at the end of the horizontal progress bar

>>:  Summary and examples of vue3 component communication methods

Recommend

Detailed explanation of the use of find_in_set() function in MySQL

First, let’s take an example: There is a type fie...

View the dependent libraries of so or executable programs under linux

View the dependent libraries of so or executable ...

Detailed explanation of CocosCreator Huarongdao digital puzzle

Table of contents Preface text 1. Panel 2. Huaron...

How to quickly import data into MySQL

Preface: In daily study and work, we often encoun...

Solve the MySQL 5.7.9 version sql_mode=only_full_group_by problem

MySQL 5.7.9 version sql_mode=only_full_group_by i...

js to achieve 3D carousel effect

This article shares the specific code for impleme...

SVN installation and basic operation (graphic tutorial)

Table of contents 1. What is SVN 2. Svn server an...

CentOS7 deployment Flask (Apache, mod_wsgi, Python36, venv)

1. Install Apache # yum install -y httpd httpd-de...

Code analysis of user variables in mysql query statements

In the previous article, we introduced the MySQL ...

Tutorial on using Multitail command on Linux

MultiTail is a software used to monitor multiple ...

How to use CURRENT_TIMESTAMP in MySQL

Table of contents Use of CURRENT_TIMESTAMP timest...

Detailed steps to install MySQL on CentOS 7

In CentOS7, when we install MySQL, MariaDB will b...

Delegating Privileges in Linux Using Sudo

Introduction to sudo authority delegation su swit...

The core process of nodejs processing tcp connection

A few days ago, I exchanged some knowledge about ...