標籤:
1、確認已經ntp程式包: # yum install ntp 2、配置時間源 # vi /etc/ntp.conf server pool.ntp.org #可選擇其他優先伺服器server 2.cn.pool.ntp.orgserver 1.asia.pool.ntp.orgserver 2.asia.pool.ntp.org # 允許上層時間伺服器主動修改本機時間restrict 2.cn.pool.ntp.org nomodify notrap noqueryrestrict 1.asia.pool.ntp.org nomodify notrap noqueryrestrict 2.asia.pool.ntp.org nomodify notrap noqueryserver 127.0.0.1 # local clockfudge 127.0.0.1 stratum 10 3、配置是否為其他PC提供時間服務 # vi /etc/ntp.conf restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 4、配置開機時自動已耗用時間服務 # chkconfig ntpd on 5、啟動或停止時間服務 # service ntpd start # service ntpd stop # service ntpd restart 6、驗證ntp服務已經運行 # pgrep ntpd 7、首次同步處理# ntpdate -u time.lib.tsinghua.edu.cn 8、確認同步成功# ntpq -p 9、同時建議修改一下 /etc/sysconfig/ntpd 檔案 # vi /etc/sysconfig/ntpd SYNC_HWCLOCK=yes # 改成 yes 吧!這樣主機 BIOS 的時間也會跟著一起改變的! 當然,如果要提供時間服務,還必須相應的設定iptable防火牆的配置。CentOS的時間服務使用udp 123連接埠。
更多詳情請諮詢 鼎峰胡佳雄
TEL.18824258907
QQ.2881064155
CentOS 7 中使用NTP進行時間同步