——NTP协议
NTPv3:RFC1305
NTPv4:RFC5905
——时区
(1)timedatectl set-timezone
- China Standard Time (CST), UTC +8
timedatectl set-timezone 'Asia/Shanghai'
timedatectl set-timezone CST
- Coordinated Universal Time (UTC), UTC +0
timedatectl set-timezone UTC
(2)docker时区
a.docker cp /etc/localtime ${CONTAINER_NAME}:/etc
b.docker run -v /etc/localtime:/etc/localtime --restart=always --device /dev/uio0 -i --privileged --name=${CONTAINER_NAME} --network=host centos:7 /usr/sbin/init & > /dev/null 2>&1
——配置
#drifffile /var/lib/ntp/drift
#statsdir /var/log/ntp
#logfile /var/log/ntp/ntp.log
#
#restrict 127.0.0.1
#restrict -6::1
#
#server 127.127.1.0 perfer version 3
#fudge 127.127.1.0 stratum 10
#
#includefile /etc/ntp/crypto/pw
#keys /etc/ntp/keys
#disable monitor
——常用命令
Windows下:net start/stop w32time
注:在windows下配置NTP都会涉及注册表的修改,各种参数的设置参考windows官方文档
linux下:
#ntpq -np
#ntpstat
#systemctl start/status/restart/stop ntpd.service