1. Introduction to NTP server
1.1 Introduction to NTP service
NTP is Network Time Protocol, which is a protocol used to synchronize the time of various computers in the network
Although the server will automatically calculate the time internally through the crystal oscillator, when the system is running for a long time, there will always be a slight deviation between the server's internal time and the actual time. Long-term accumulation will cause this deviation to become larger and larger.
In the intranet architecture, some businesses have strict time requirements, which requires the time in our intranet devices to be consistent, and this can be achieved using NTP services.
1.2 Time management commands
View command:
说明 命令
查看当前时间 date -R
查看时区 ls /usr/share/zoneinfo/
查看其他时区的当前时间 zdump Hongkong
Common time commands
data 查看时间命令
timedatectl 管理系统时间
timedatectl status 显示当前系统时间信息
timedatectl list-timezones 查看可用时区
timedatectl set-timezone "Asia/Shanghai" 修改时区
timedatectl set-local-rtc 1|0 设定是否使用utc时间,1表示使用local时间,0表示使用utc时间
timedatectl set-time “xxx” 设定当前时间为xxx
2. Construction of NTP server
Build an NTP time server to synchronize time between the client and the clock synchronization server
Server (192.168.169.132) operation:
Change the following three pieces of information in the editing content:
#pool 2.rhel.pool.ntp.org iburst
allow 192.168.169.128
local stratum 10
Client (192.168.169.128) operation:
chronyc sources显示的四个符号
* 目前正在使用的上层NTP
+ 已连接,可提供时间更新的候补
- 远程服务器被认为是不合格的NTP server
× 远程服务器不可用