1、經常使用的NTP服務器IPvim
210.72.145.44 (國家授時中心服務器IP地址)
202.112.10.36 # 1.cn.pool.ntp.org
59.124.196.83 # 0.asia.pool.ntp.org
s2m.time.edu.cn 北京大學
s2c.time.edu.cn 北京郵電大學服務器
2、搭建NTP服務器
NTP服務端配置步驟以下
一、安裝ntp
yum -y install ntp
二、開機啓動
chkconfig ntpd on
chkconfig --list ntpd
三、先手工同步下時間
ntpdate -u 210.112.145.44
四、配置ntpd主配置文件ntp.conf
vim /etc/ntp.conf 增長以下內容ide
# 容許內網其餘機器同步時間 restrict 192.168.239.0 mask 255.255.255.0 nomodify notrap # 中國這邊最活躍的時間服務器 : http://www.pool.ntp.org/zone/cn server 210.72.145.44 perfer # 中國國家受時中心 server 202.112.10.36 # 1.cn.pool.ntp.org server 59.124.196.83 # 0.asia.pool.ntp.org # allow update time by the upper server # 容許上層時間服務器主動修改本機時間 restrict 210.72.145.44 nomodify notrap noquery restrict 202.112.10.36 nomodify notrap noquery restrict 59.124.196.83 nomodify notrap noquery # 外部時間服務器不可用時,以本地時間做爲時間服務 server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10
五、開啓ntp服務,並查看商品
/etc/init.d/ntpd start
netstat -atunlp | grep ntp
六、查看時間同步狀態 ntpstat (表示本地時間服務器已經和外網的NTP服務同步上了)
[root@localhost ~]# ntpstat
synchronised to NTP server (202.112.10.36) at stratum 6
time correct to within 1171 ms
polling server every 64 srest
3、NTP客戶端配置步驟
只須要創建一條計劃任務就OK
crontab -e 加入以下兩條內容。 (每分鐘同步一次)code
#client ntp sync to ntp server 192.168.239.133server