yum install ntp
配置檔案
/etc/ntp.conf 主配置檔案
/usr/share/zoneinfo 所有時區的格式檔案
/etc/sysconfig/clock 指定要使用/usr/share/zoneinfo裡那個格式檔案
/etc/localtime 本地時間的配置檔案,複制/usr/share/zoneifo裡時區檔案就行。
指令:
/bin/date 用來修改時間
/sbin/hwclock Bios 硬體時鐘修改
/usr/sbin/ntpd
/usr/sbin/ntpdate 用戶端時間校正
/etc/ntp.conf
簡單配置:
允許同步的用戶端IP段
restrict 192.168.10.0 mask 255.255.255.0 nomodify
将原來主機登出,添加中國授時中心主機,做同步
server cn.ntp.org.cn
啟動:
service ntpd start
chkconfig ntpd on
檢視UDP端口123
# netstat -tlunp | grep ntp
檢視連接配接:
[root@centos ~]# ntpstat
synchronised to NTP server (115.28.122.198) at stratum 3
time correct to within 4015 ms
polling server every 64 s
[root@centos ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*time6.aliyun.co 10.137.38.86 2 u 57 64 17 61.212 21.790 4.001
客戶機同步:
ntpdate [-dv] [NTP IP/hostname]
# ntpdate 192.168.2.34