ntpq -pn报错localhost: timed out, nothing received的解决办法

 

一. 正常时候:

 

 

二. 故障时候:

故意去掉/etc/ntp.conf的

restrict ::1 行

 

ntpq -pn开始变得卡住。ntpq -4p有结果,ntpq -6p无结果。

 

 

三 . 综上:

/etc/ntp.conf必须要有行

restrict 127.0.0.1
restrict ::1

 

示例:

 

driftfile /var/lib/ntp/drift
pidfile /var/run/ntpd.pid
restrict default nomodify notrap nopeer noquery

restrict -6 deault nomodify notrap nopeer noquery

restrict 127.0.0.1 
restrict ::1


server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst



includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys



disable monitor

 

posted @ 2025-03-26 21:43  兮瓜公籽  阅读(96)  评论(0)    收藏  举报