PTP 精确时间服务介绍

发布时间: 更新时间: 总字数:483 阅读时间:1m 作者: 分享 复制网址

PTP 精确时间服务介绍

介绍

网络时钟同步包括以下两个概念:

  • 时间同步(相位同步,Phase synchronization) 指信号之间的频率和相位都保持一致,即信号之间的相位差恒为零
  • 频率同步(时钟同步,Frequency synchronization) 指信号之间在频率或相位上保持某种严格的特定关系,信号在其对应的有效瞬间以同一平均速率出现,以保证通信网络中的所有设备都以相同的速率运行,即信号之间保持恒定的相位差

PTP(Precision Time Protocol,精确时间协议)是一种时间同步的协议,其本身只是用于设备之间的高精度时间同步,但也可被借用于设备之间的频率同步。

安装

关闭 NTP

$ sudo timedatectl set-ntp false
$ timedatectl  status
               Local time: Sun 2023-01-29 00:03:11 PST
           Universal time: Sun 2023-01-29 08:03:11 UTC
                 RTC time: Sun 2023-01-29 08:03:11
                Time zone: America/Los_Angeles (PST, -0800)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

PTP 安装

apt install ptpd

启动 master节点

$ ptpd -M -i ens32 # -C 前台启动,打印日志到 console
$ systemctl status ptpd.service

# 启动时日志
$ tail -f /var/log/syslog
...
Jan 22 00:06:11 ubuntu ptpd2[74655]: PTPDv2 version 2.3.1 starting
Jan 22 00:06:11 ubuntu ptpd2[74655]: Starting ptpd2 daemon with parameters:      ptpd -M -i ens32
Jan 22 00:06:11 ubuntu ptpd2[74655]: Checking configuration
Jan 22 00:06:11 ubuntu ptpd2[74655]: Configuration OK
Jan 22 00:06:11 ubuntu ptpd2[74655]: Successfully acquired lock on /var/run/ptpd2.lock
Jan 22 00:06:11 ubuntu ptpd2[74656]:   Info:    Now running as a daemon
Jan 22 00:06:11 ubuntu ptpd2[74656]: Successfully acquired lock on /var/run/ptpd2.lock
Jan 22 00:06:11 ubuntu ptpd2[74656]: PTPDv2 started successfully on ens32 using "masteronly" preset (PID 74656)
Jan 22 00:06:11 ubuntu ptpd2[74656]: TimingService.PTP0: PTP service init

启动 slave 节点

ptpd -g -i eth0

扩展

北斗时源

参考

  1. http://www.h3c.com/cn/d_201008/686476_30003_0.htm
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数