ROS(MikroTik RouterOS)Ntp自动更新设置校准/同步系统时间不准

 
更多

介NTP 是网络时间协议(Network Time Protocol),它用来同步网络设备【如计算机、手机】的时间的协议。为我们提供准确时间。因为我们的手表、手机、电脑等设备,经常会跑着跑着时间就出现了误差,或快或慢的少几秒,时间长了甚至误差过分钟。对于ROS来讲当你的ROS服务器主板电池没电或断电时间错误时,可能会比较需要这个脚本,用来从网络上校准系统时间。
操作菜单:system- ntp client
国内常用的3个ntp server:
time.cloud.tencent.com
ntp.aliyun.com
ntp.ntsc.ac.cn

介NTP 是网络时间协议(Network Time Protocol),它用来同步网络设备【如计算机、手机】的时间的协议。为我们提供准确时间。因为我们的手表、手机、电脑等设备,经常会跑着跑着时间就出现了误差,或快或慢的少几秒,时间长了甚至误差过分钟。对于ROS来讲当你的ROS服务器主板电池没电或断电时间错误时,可能会比较需要这个脚本,用来从网络上校准系统时间。
操作菜单:system- ntp client
国内常用的3个ntp server:
time.cloud.tencent.com
ntp.aliyun.com
ntp.ntsc.ac.cn


启用并设置 Ntp server

设置时区

自动配置脚本

#启用并配置server:
/system ntp client set enabled=yes
/system ntp client servers
add address=time.cloud.tencent.com
add address=ntp.aliyun.com
add address=ntp.ntsc.ac.cn
#设置时区
/system clock set time-zone-autodetect=no time-zone-name=Asia/Shanghai
/system clock manual set time-zone=+08:00

v6.x:
sntpclient

v6.x脚本:

/system clock set time-zone-name=Asia/Shanghai
:global ntpipnewp ([:resolve ntp.aliyun.com]) 
/system ntp client set primary-ntp=$ntpipnewp
:global ntpipnews ([:resolve time1.cloud.tencent.com]) 
/system ntp client set secondary-ntp=$ntpipnews

每月通过域名更新一次ntp server。

/sys scheduler remove ntp-server-update
/system scheduler
add interval=4w2d name=ntp-server-update on-event="/system clock set time-zone-name=Asia/Shanghai\r\
    \n/system ntp client set enabled=yes primary-ntp=120.25.115.20 secondary-ntp=203.107.6.88\r\
    \n:global ntpipnewp ([:resolve ntp.aliyun.com]) \r\
    \n/system ntp client set primary-ntp=\$ntpipnewp\r\
    \n:global ntpipnews ([:resolve time1.cloud.tencent.com]) \r\
    \n/system ntp client set secondary-ntp=\$ntpipnews\r\
    \n" start-date=jan/01/1990 \
    start-time=03:00:00
打赏

本文固定链接: https://www.cxy163.net/archives/2542 | 绝缘体-小明哥的技术博客

该日志由 绝缘体.. 于 2013年12月30日 发表在 未分类 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: ROS(MikroTik RouterOS)Ntp自动更新设置校准/同步系统时间不准 | 绝缘体-小明哥的技术博客
关键字: , , , ,

ROS(MikroTik RouterOS)Ntp自动更新设置校准/同步系统时间不准:等您坐沙发呢!

发表评论


快捷键:Ctrl+Enter