class="hide-preCode-box">

WARNING 下面内容可能有误(2023.5.1)

3、查看NTP(网络时间同步)状态,并关闭

timedatectl  status
sudo timedatectl set-ntp false
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

4、安装PTP,并使用

a.安装

sudo apt-get install ptpd
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

b.主时钟

sudo ptpd -M -i eno1
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

c.从时钟

sudo ptpd -g -i eno1
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

步骤b和c加入-C参数的话,会在前台运行,并打印输出,如在主时钟端:

2023-04-08 10:41:08.764781 ptpd2[4983].startup (info)      (___) Configuration OK
2023-04-08 10:41:08.766235 ptpd2[4983].startup (info)      (___) Successfully acquired lock on /var/run/ptpd2.lock
2023-04-08 10:41:08.766369 ptpd2[4983].startup (notice)    (___) PTPDv2 started successfully on eno1 using "masteronly" preset (PID 4983)
2023-04-08 10:41:08.766381 ptpd2[4983].startup (info)      (___) TimingService.PTP0: PTP service init
2023-04-08 10:41:08.871397 ptpd2[4983].eno1 (notice)    (lstn_init) Now in state: PTP_LISTENING
2023-04-08 10:41:18.766441 ptpd2[4983].eno1 (notice)    (lstn_init) TimingService.PTP0: elected best TimingService
2023-04-08 10:41:18.766534 ptpd2[4983].eno1 (info)      (lstn_init) TimingService.PTP0: acquired clock control
2023-04-08 10:41:20.872507 ptpd2[4983].eno1 (notice)    (mst) Now in state: PTP_MASTER, Best master: f430b9fffea87c76(unknown)/1 (self)
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

5、测试结束后,切换回NTP,出现Warning

Warning: The system is configured to read the RTC time in the local time zone.
         This mode cannot be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

原因:参考博客
解决办法:

timedatectl set-local-rtc 0
 class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

参考1
参考2
参考3

>>
注:本文转载自blog.csdn.net的fluchc的文章"https://blog.csdn.net/weixin_44160023/article/details/130025392"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接

评论记录:

未查询到任何数据!