NTP(网络时间协议是在数据网络潜伏时间可变的计算机系统之间通过分组交换进行时钟同步的一个网络协议,位于OSI模型的应用层)
时间同步
前提是可以连接互联网
yum install ntpdate
NTP常用服务器:
- 中国国家授时中心:
ntp.ntsc.ac.cn - NTP服务器(上海):
ntp.api.bz - NTP官网推荐的地址池:
pool.ntp.org - 中国区地址池:
cn.pool.ntp.org
# date
Thu Dec 19 15:51:04 CST 2019
# ntpdate -u ntp.api.bz
19 Dec 15:53:44 ntpdate[25083]: step time server 114.118.7.163 offset 146.353887 sec
# date
Thu Dec 19 15:53:51 CST 2019
# ntpdate -u ntp.ntsc.ac.cn
19 Dec 16:14:16 ntpdate[25221]: adjust time server 114.118.7.161 offset 0.000608 sec
时区配置:
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
cp: overwrite ‘/etc/localtime’? y
NTP服务器
# yum install ntp
# systemctl start ntpd
# systemctl status ntpd
# systemctl enable ntpd
# systemctl restart ntpd
# systemctl stop ntpd
与局域网内NTP服务器同步
# yum install ntpdate
# ntpdate -u 192.168.1.20
注意NTP服务器上要在防火墙中放行UDP 123号端口
firewall-cmd --permanent --add-port=123/udp
firewall-cmd --reload
同步方案
(1)NTP服务器与互联网进行时间同步
(2)局域网内其他机器与NTP服务器进行时间同步




