Location>code7788 >text

NTP time synchronization

Popularity:375 ℃/2024-07-28 19:16:15

NTP time synchronization

catalogs
  • NTP time synchronization
    • I. Overview
    • II. Software packages
    • NTP server configuration
      • 1. Modify the configuration file
      • 2. Restarting services
      • 3. Firewall settings
    • NTP client configuration
      • 1. Modify the configuration file
      • 2. Validation time
      • 4. Restarting services
      • 5. Verify that the time is synchronized

I. Overview

Network Time Protocol

It is a protocol used to synchronize the time of individual computers on a network. 210.72.145.39, National Authorization Center server IP address
Stratum (layered design), with the total number of Stratum layers limited to 15 (inclusive)
Server port: 323 Client port: 123

II. Software packages

]# yum -y install chrony
]# rpm -ql chrony
]# rpm -qc chrony
/etc/
/etc/
/etc//chrony
/etc/sysconfig/chronyd

NTP server configuration

1. Modify the configuration file

]# cat /etc/
server  iburst
allow 192.168.0.0/16
deny  192.168.4.1
local stratum 10

2. Restarting services

]# systemctl restart chronyd
]# systemctl enabled chronyd

3. Firewall settings

You can disable the firewall in advance, and change the configuration file from enabled to disabled
]# systemctl disable firewalld --now

If you do not want to kill
]# firewall-cmd --set-default-zone=trusted

NTP client configuration

1. Modify the configuration file

Main configuration file /etc/
]# cat /etc/
3 server 192.168.3.30 iburst //Set up data synchronization with the server at the specified IP address.
                                   The //iburst parameter sets the time to synchronize as soon as possible after restarting the service.

2. Validation time

The client changes the time incorrectly
]# date -s "hour:minute" //adjust time
]# date //view time

4. Restarting services

]# systemctl restart chronyd

5. Verify that the time is synchronized

]# date
]# chronyc sources -V