当前位置: 首页 > news >正文

Ntpdate系统时间同步

1.时间手动设置
设置软件【操作系统】时间:date
设置硬件【主板BIOS】时间:clock
 
2.时间自动同步
生产环境一般使用ntpd好点,ntpd在实际同步时间时是一点点的校准过来时间的,最终把时间慢慢的校正对。而ntpdate不会考虑其他程序是否会阵痛,直接调整时间。
 
(1).ntpdate
强制同步时间服务器
# ntpdate 192.168.0.1
每天12点同步时间
# vim /etc/crontab
0 12 * * * * /usr/sbin/ntpdate 192.168.0.1
 
(2).ntpd
ntpd同步系统时间,修改配置文件,添加时间服务器
# vim /etc/ntp.conf
 
ntp服务默认只会同步系统时间。如果想要让ntp同时同步硬件时间,可以设置/etc/sysconfig/ntpd 文件。在/etc/sysconfig/ntpd文件中,添加 SYNC_HWCLOCK=yes 这样,就可以让硬件时间与系统时间一起同步。
 
 
3.centos7利用ntpdate搭建本地时间服务器。
时间服务器服务器端:192.168.1.10
客户端同步测试:192.168.1.13
 
(1).服务端配置192.168.1.10安装配置ntpdate
192.168.1.10
# yum install ntp ntpdate -y
# vim /etc/ntp.conf
1 # For more information about this file, see the man pages
2 # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
3
4 driftfile /var/lib/ntp/drift
5
6 # Permit time synchronization with our time source, but do not
7 # permit the source to query or modify the service on this system.
8 #restrict default nomodify notrap nopeer noquery
9
10 # Permit all access over the loopback interface. This could
11 # be tightened as well, but to do so would effect some of
12 # the administrative functions.
13 #restrict 127.0.0.1
14 #restrict ::1
15 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
16
 
# systemctl restart ntpd
 
(2).客户端192.168.1.13测试
# ntpdate 192.168.1.10
 
 
 
http://www.vanclimg.com/news/236.html

相关文章:

  • oracle 自增id
  • 接地气的软件开发流程.240618
  • 接地气的代码版本管理流程.240617
  • sersync同步
  • deepseek本地部署硬件资源对比表.250303
  • 【API接口】最新可用手机号归属地查询接口
  • NFS安装配置
  • Git代码分支管理模型TBD++ Flow.240520
  • deepseek-chat和deepseek-reasoner的区别.250305
  • grain和crops的区别
  • 【macOS】Homebrew更换国内镜像源(2025.7更新)
  • 第二十三天
  • SqlSugar的无实体(匿名)插入、更新、删除、查询以及多库和跨库查询 - microsoft
  • Cursor:IT专业人员必备神器,从开发到运维的全能助手.250423
  • 工作要开心:与其挣扎,不如选择自洽.250411
  • CSP-S模拟赛28 比赛总结
  • 校招季人效提升50%:Moka校招系统AI筛选与雇主品牌工具
  • 【2025-07-26】连岳摘抄
  • 迎战DARPA网络挑战赛:Trail of Bits的自动化安全系统征程
  • 企业如何利用MyEMS开源能源管理系统实现节能减排
  • GPUStack v0.7重磅发布:macOS与Windows安装包、昇腾MindIE多机推理、模型使用计量与寒武纪MLU支持
  • IDEA导出数据库对应的实体配置
  • 2025最佳代码托管平台推荐
  • 搜索
  • 服务器docker
  • 一种绕定轴旋转的参照系上的惯性力推导方法
  • 划分点(Vertex)和边(Edge)的属性汇总
  • 基本算法
  • JimuReport 积木报表 v2.1.1 版本发布,免费开源的报表和大屏设计
  • 一期6.文本摘要(md版)