NTP時(shí)間同步

NTPD服務(wù)器
Network Time Protocol

作用:為網(wǎng)絡(luò)中的主機(jī)授時(shí),同步的時(shí)間在2min-10min,需要看主板上面的硬件的性能

一、時(shí)間服務(wù)器的重性
ntp 123/udp

二、配置時(shí)間服務(wù)器

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時(shí)間,自己跟自己同步
fudge 127.127.1.0 stratum 10 //定義級(jí)別,范圍0-16,越小越精準(zhǔn)

注釋:時(shí)間服務(wù)器要讀取本地的bios時(shí)間,所以會(huì)延遲5min左右才能同步成功

systemctl restart ntpd

systemctl enable ntpd

查看server的同步的狀態(tài):

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 //手動(dòng)時(shí)間同步 -b加速初始化同步

crontab -e

01 * * * * ntpdate 172.16.110.1

方法二:

vim /etc/ntp.conf //自動(dòng)同步

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 //系統(tǒng)時(shí)鐘

Mon Jan 20 14:44:25 CST 2014

hwclock //主板硬件時(shí)鐘

Mon 20 Jan 2014 02:44:36 PM CST -0.145485 seconds

hwclock --systohc //將系統(tǒng)時(shí)間同步到硬件上

hwclock --hctosys //將硬件時(shí)間同步到系統(tǒng)上

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容