[英]Set up an NTP server to allow local machines to be synchronised for Linux
我正在嘗試設置一台機器作為ntp服務器,其他本地機器將與其同步。 無論ntp服務器機器是否連接到互聯網,都需要這樣做,即:時間是否正確並且機器彼此同步並不重要。
我的配置文件如下:
NTP服務器/etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
NTP客戶端/etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
server 192.168.1.146 iburst
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
我在服務器上更改時間然后使用sudo /etc/init.d/ntp start
運行ntp服務器並嘗試測試客戶端是否可以使用sudo ntpdate 192.168.1.146
接收ntp更新
這是有效的,但只有在連接到Internet時(即使主設備的時間由我的命令設置而不是從外部ntp服務器設置)。
我的配置文件中有什么錯誤嗎? 我失蹤的任何一步?
當您斷開與Internet的連接並且您沒有在DNS緩存中解析NTP域時您站無法解析NTP域名。 這是第一件要檢查的事情。 如果您丟棄所有流量並進行調整,那么您應該允許這種傳輸通過防火牆進入您的工作站。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.