在rhel5(centos5)上用ntpd搭建时间服务器
rhel5(或者是centos5)下安装、配置时间服务器简直是再简单不过了
yum install ntp
That’s all!
是不是非常简单呢?
呵呵
装上以后
还需要对ntp做简单的配置
vim /etc/ntp.conf
只需要按照文件里的提示按照
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
这样的格式加上你允许对时的网段,一般是内网
多个网段可以多加几行
编辑完/etc/ntp.conf后
再vim /etc/sysconfig/ntpd
将
SYNC_HWCLOCK=no
改成
SYNC_HWCLOCK=yes
这样的话,当时间服务器每次从internet上同步时间成功,会自动写到bios ,这样bios的时间也得到同步了
然后再启动ntp
service ntpd start
这样的话,一会儿在客户端就能用ntpdate xxx.xxx.xxx.xxx(xxx.xxx.xxx.xxx是这台时间服务器的ip)来更新时间了
如果客户端同步时间时出错:
no server suitable for synchronization found
那么用ntpdate -d xxx.xxx.xxx.xxx来执行看看
如果这会儿有报错误:
Server dropped: Strata too high
并显示“stratum 16”的话
这表明时间服务器本身还没有跟自己的server或是自己同步完时间
所以需要等一会儿再试
那么怎样知道时间服务器跟远程时间服务器或是本身同步的完成状况呢?
watch ntpq -p
当LOCAL 这一行的reach的值
当其从0到17,连续几次后
客户端同步时间终于成功了!
原创文章,转载请注明: 转载自嘻嘻哈哈的部落格(blog)
本文链接地址: 在rhel5(centos5)上用ntpd搭建时间服务器




近期评论