分页: 1 / 1
时间服务器如何设置与授时中心服务器自动定时同步?
发表于 : 2011-11-10 13:39
由 szfhx
如下设置,不知时间服务器是否与授时中心服务器自动同步?什么时候同步一次?
还是要其他方面再设置一下?
我是在ubuntu server 10.04中如下设置NTP时间服务器:
sudo apt-get install ntp
vim /etc/ntp.conf
#中国国家授时中心服务器地址 prefer表示优先(默认)
server 210.72.145.44 prefer
server 218.21.130.42
restrict 192.168.2.0 mask 255.255.255.0 nomodify
restrict 127.0.0.1
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust
保存重启ntp服务
/etc/init.d/ntp restart
Re: 时间服务器是否与授时中心服务器自动同步?
发表于 : 2011-11-11 9:59
由 大宝
天朝授时中心老差劲了,连接经常出问题
还是用 cn.pool.ntp.org 好
Re: 时间服务器是否与授时中心服务器自动同步?
发表于 : 2011-11-11 13:00
由 szfhx
大宝 写了:天朝授时中心老差劲了,连接经常出问题
还是用 cn.pool.ntp.org 好
那ubuntu 时间服务器如何设置与授时中心服务器自动定时同步?
Re: 时间服务器是否与授时中心服务器自动同步?
发表于 : 2011-11-11 19:35
由 大宝
szfhx 写了:那ubuntu 时间服务器如何设置与授时中心服务器自动定时同步?
1、安装 NTP 是肯定的,LZ 已经写了,鄙人就不重复了
2、若要每一小时自动同步一次,则在“/etc/cron.hourly”目录中新建一个脚本《ntp.sh》
(其它的文件夹“cron.daily”是每天执行一次,“cron.weekly”每周执行一次,类推)
代码: 全选
sudo gedit /etc/cron.hourly/ntp.sh
填入以下内容
代码: 全选
#! /bin/bash
ntpdate -s cn.pool.ntp.org
hwclock --systohc
3、修改《ntp.sh》权限
代码: 全选
sudo chmod 755 /etc/cron.hourly/ntp.sh
sudo chmod +x /etc/cron.hourly/ntp.sh

Re: 时间服务器如何设置与授时中心服务器自动定时同步?
发表于 : 2011-11-11 20:09
由 大宝
再增补一点备用的 ntp 服务器地址:
pool.ntp.org
asia.pool.ntp.org
tw.pool.ntp.org
hk.pool.ntp.org
Re: 时间服务器如何设置与授时中心服务器自动定时同步?
发表于 : 2011-11-11 20:34
由 dreamcast_sh
mark
Re: 时间服务器如何设置与授时中心服务器自动定时同步?
发表于 : 2011-11-11 20:44
由 大宝
仔细想了一下,这方法不太好
查询了一下相关资料,据说系统会自动调整同步时间
又找了一下 ntp 服务器
所以还是调整一下,特别是桌面版照此执行
1、编辑《ntp.conf》
代码: 全选
sudo gedit /etc/ntp.conf
在文末添加
代码: 全选
# NTP Server
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
server pool.ntp.org
2、重启 ntp 服务
代码: 全选
sudo /etc/init.d/ntp restart
3、检查运行情况
代码: 全选
ntpq --numeric --peers
或者
说明:
桌面版用户,还可以在“系统”>“系统管理”>“时间和日期”中添加服务器,并设置为自动同步
Re: 时间服务器如何设置与授时中心服务器自动定时同步?
发表于 : 2011-11-25 13:07
由 seabee
ntpq --numeric --peers
提示:
localhost: timed out, nothing received
***Request timed out
请问这个是什么回事?
/etc/ntp.conf 没有更改过。