NTPD服務器
Network Time Protocol
作用:為網絡中的主機授時,同步的時間在2min-10min,需要看主板上面的硬件的性能
一、時間服務器的重性
ntp 123/udp
二、配置時間服務器
rpm -q ntp
ntp-4.2.4p8-3.el6.x86_64
NTP Server配置示例:
vim /etc/ntp.conf
restrict default nomodify //不允許客戶端登錄,也不允許客戶端修改
server 127.127.1.0 //使用本地的bios時間,自己跟自己同步
fudge 127.127.1.0 stratum 10 //定義級別,范圍0-16,越小越精準
注釋:時間服務器要讀取本地的bios時間,所以會延遲5min左右才能同步成功
systemctl restart ntpd
systemctl enable ntpd
查看server的同步的狀態:
ntpstat
unsynchronised
time server re-starting
polling server every 64 s
ntpstat
synchronised to local net at stratum 11
time correct to within 949 ms
polling server every 64 s
三、配置NTP客戶端
方法一:
ntpdate -b 172.16.110.1 //手動時間同步 -b加速初始化同步
crontab -e
01 * * * * ntpdate 172.16.110.1
方法二:
vim /etc/ntp.conf //自動同步
server 172.16.110.1
fudge 172.16.110.1 stratum 5
systemctl restart ntpd
systemctl enable ntpd
ntpq -p
remote refid st t when poll reach delay offset jitter
==========================================================================
172.16.110.1 LOCAL(0) 11 u 36 64 3 0.405 0.046 0.022
date //系統時鐘
Mon Jan 20 14:44:25 CST 2014
hwclock //主板硬件時鐘
Mon 20 Jan 2014 02:44:36 PM CST -0.145485 seconds