Linux 下面 NTP服务器的配置

首先安装ntp服务器

# apt-get install ntp

然后

# vim /etc/ntp.conf


我的配置文件

driftfile /var/lib/ntp/ntp.drift
server 210.72.145.44 #这个是国家授时中心的IP地址,你可以添加多个时间服务器
server 127.0.0.1 #当与国家授时中心服务器同步不成功的时候与本机同步
restrict 0.0.0.0 mask 0.0.0.0 nomodify #让所有人都能使用你的NTP服务器,可以自己设置允许的IP段
restrict 127.0.0.1 #允许本机使用

就这样,重启一下ntp服务器

# /etc/init.d/ntp restart

刚重启过后用ntpdate同步时间会报错,类似于下面的

30 Sep 08:20:17 ntpdate[21920]: no server suitable for synchronization found

这时候不要着急,要等待大约3~5分钟就可以正常使用了

您可以RSS 2.0订阅。 留言,或者引用 Trackback

发表评论

XHTML:您可使用下列标签:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">