Linux下ntp时间同步服务器

配置实例:
(1)设定时间服务器:
#touch /etc/ntp.conf 生成配置文件ntp.conf
===================== ntp.conf ===============
server 202.197.89.0
fudge 202.197.89.0 stratum 10
driftfile /etc/ntp.drift
broadcast 202.197.89.255
#touch /etc/ntp.drift 生成ntp.drift文件
#ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid 启动时间daemon
(2)客户端的配置
#touch /etc/ntp.conf
================ /etc/ntp.conf ==============
server the_time_server
driftfile /etc/ntp.drift
#touch /etc/ntp.drift
#ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid start the Network Time Protocol daemon
(3)将某计算机作为Internet标准时间服务器的客户端,以便得到准确的时间,同时又将其作为局域网内的标准时间源、时间服务器,向网络提供标准时间
#touch /etc/ntp.conf
================= /etc/ntp.conf ==============
server time.nist.gov
server ntp.ise.canberra.edu.au
server 202.197.89.0
fudge 202.197.89.0 stratum 10
driftfile /etc/ntp.drift
broadcast 202.197.89.255
#touch /etc/ntp.drift

 

保存退出后。启动NTP服务
service ntpd start
如果想每次系统启动,NTP服务自动启动,请输入下面命令: chkconfig -level 35 ntpd on 注意:
1.NTP服务的端口是123,使用的是udp协议,所以NTP服务器的防火墙必须对外开放udp 123这个端口。
2.Ntpd启动的时候通常需要一段时间进行时间同步,所以在ntpd刚刚启动的时候还不能正常提供时钟服务,最长大概有5分钟吧,如果超过了这个时间请检查一下您的配置文件。

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值