Linux服务器时间同步

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服务器进行时间同步

上一篇 CentOS下定时任务设置
下一篇 disconf-web部署
目录
文章列表
1 CentOS 7下安装及配置VsFTP(详细)
CentOS 7下安装及配置VsFTP(详细)
2
The selected directory is not a valid home for Go SDK
The selected directory is not a valid home for Go SDK
3
Flutter Decoration背景设定(边框、圆角、阴影、形状、渐变、背景图像等)
Flutter Decoration背景设定(边框、圆角、阴影、形状、渐变、背景图像等)
4
Jenkins构建GitHub项目
Jenkins构建GitHub项目
5
Android Jetpack架构组件(五)CameraX视频录制
Android Jetpack架构组件(五)CameraX视频录制
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。