NTP是(Network Time Protocol) 网络时间协议。
就是用来做时间同步的。
服务端:
[root@srv-200 ~]# vim /etc/ntp.conf
restrict 172.16.0.0 mask 255.255.0.0 nomodify notrap //为哪个网段服务
server 127.127.1.0 //表示从哪个服务器获取时间
fudge 127.127.1.0 stratum 1
客户端:
server 127.127.1.0 //表示从哪个服务器获取时间
允许上层时间服务器主动修改本机时间
restrict 2.cn.pool.ntp.org nomodify notrap noquery
在没有启动时间同步服务是可以手动同步:
# ntpdate -d 172.16.12.10
查看ntp服务的状态
#watch ntpq -p
Every 2.0s: ntpq -p Sat Jul 7 00:41:45 2007
remote refid st t when poll reach delay offset jitter
===========================================================
1+93.60.199.75 193.62.22.98 2 u 52 64 377 8.578 10.203 289.032
*mozart.musicbox 192.5.41.41 2 u 54 64 377 19.301 -60.218 292.411
[root@srv-200 ~]# watch -n 1 ntpq -p //监视ntp服务器的状态,需要等到reach到达17,服务器才能使用,按ctrl-c退出