linux ntp chrony,centos7 搭建ntp/chrony时钟服务器

NTP

服务器 : 192.168.137.3

客户机: 192.168.137.6

服务器端

centos7下首先确认服务器的防火墙、selinux关闭状态

第一步:为服务器和客户机安装ntp ntpdate --默认已安装

yum install ntp ntpdate -y

第二步 查找时间同步服务器

第三步 编辑 /etc/ntp.conf

server s1b.time.edu.cn #清华大学

server 210.72.145.44 #国家授时中心服务器IP地址

server s1e.time.edu.cn #清华大学

server s2a.time.edu.cn #清华大学

server s2b.time.edu.cn #清华大学

server 127.127.1.0 iburst local clock #当外部时间不可用时,使用本地时间。

restrict 192.168.137.1 mask 255.255.255.0 nomodify #允许更新的IP地址段

第四步 启动ntp服务

systemctl start ntpd

systemctl enable ntpd.service 设置开机启动服务

第五步 验证服务

ntpq -p

客户端

第六步 远程客户端时间同步测试

date -R

ntpdate 10.0.1.25

第七步 客户端设置计划任务,每天晚上1点同步时间

crontab -e

*/10 * * * * root /usr/sbin/ntpdate 10.0.1.25; /sbin/hwclock -w格式 00 01 * 五个字符表示 分 时 日 月 年

chrony

RHEL从7.0开始改用chrony同步时间

yum install chrony

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值