ntp服务器时间同步

ntp时间同步

首先查看是否安装了ntp

rpm -q ntp

如果安装会显示ntpdate-4.2.6p5-1.el6.x86_64
未安装则安装ntp

yum -y install ntp

或者

rpm -ivh --nodeps ntpdate-4.2.6p5-25.e17.centos.2.x86_64.rpm autogen-libopts-5.18-5.e17.x86_64.rpm ntp-4.2.6p5-25.e17.centos.2.x86_64.rpm

安装完成执行vi /etc/ntp.conf

配置文件格式如下,注释掉四行server,并在下面添加一行server。

# grep ^[^#] /etc/ntp.conf  
driftfile /var/lib/ntp/drift
restrict default 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
server 114.2.131.26 IP为ntp服务器ip地址
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor

重启

systemctl restart ntpd.service

第一次手动更新时间

ntpdate -u 114.2.131.26(ntp服务器ip)

配置开机自启动

chkconfig ntpd on

查看ntp主节点是否正确

watch ntpq -p

第一列即为ntp服务器的ip。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值