# 示例客户端配置 根据您和您的客户使用的Equinix Precision Time服务类型,需要各种 PTP 和 NTP 客户端配置设置。 ## 用于Linux的PTP客户端 Linux系统有多种PTP客户端实现: * **ptp4l** * **ptpd** * **sfptpd** (需要支持的Solarflare网卡) * **域时间II (灰质软件)** * **Timebeat** ## 适用于Linux的NTP客户端 Linux系统有多种NTP客户端实现: * **ntpd** * **慢性** * **ntpdate** 以下示例演示如何使用Precision Time服务配置这些客户端。 ## Equinix PTP 服务配置 | 配置参数 | Equinix 提供的配置 | 工具提示 | | ---------------- | ------------------ | ------------------------------------------------------------------------------ | | 域 | 30 | PTP域是PTP在其中运行的网络或网络的一部分。在此网络中,所有时钟都同步。 | | 日志公布间隔 | 1 | 控制PTP通告来自PTP时间服务器的数据包速率的对数值。默认值为1 (每2秒1个数据包)。 | | 日志延迟请求间隔 | -4 | 控制PTP DelayReq数据包速率的对数值。默认值为-4 (每秒16个数据包)。 | | 日志同步间隔 | -4 | 控制PTP同步数据包速率的对数值。默认值为-4 (每秒16个数据包)。 | | 优先级1 | 128 | 更低的值表示更高的优先级。 | | 优先级2 | 128 | 更低的值表示更高的优先级。 | | 时钟类 | 13 | 表示提供UTC时间戳的时间尺度的值(默认设置)。 | | 时钟精度 | 23 | 表示来源与UTC时间的准确度的值。Equinix时间源与UTC的精确度高达1µs (默认设置)。 | 配置样本 这些部分包含NTP和PTP客户端的示例配置代码。这些值适用于默认的Precision Time Service设置。 ## 配置样本 - chronyd ``` server 192.168.1.21 iburst prefer server 192.168.1.22 iburst prefer driftfile /path/to/chrony/drift  makestep 1 3  rtcsync logdir /path/to/log/directory pidfile /path/to/chrony.pid log measurements statistics tracking ``` ## 配置样本 - ntpd 网络时间协议守护进程(ntpd)是用于NTP客户端设备的样本配置。 ``` driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1  restrict ::1 server 192.168.1.21 iburst true server 192.168.1.22 iburst true includefile /etc/ntp/crypto/pw keys /etc/ntp/keys disable monitor ``` ## 配置样本 - ptpd 类似地,Precision TIme协议守护进程 (ptpd) 维护系统时间以使用 PTP 与时间服务器同步。 ``` ptpengine:preset=slaveonly ptpengine:domain=30 ptpengine:sync_outlier_filter_enable=y ptpengine:delay_outlier_filter_enable=y ptpengine:sync_stat_filter_enable=y ptpengine:delay_stat_filter_enable=y ptpengine:log_announce_interval=1 ptpengine:log_sync_interval=-4 ptpengine:log_delayreq_interval=-4 ptpengine:calibration_delay=20 ptpengine:hardware_timestamping=y clock:allow_step_backwards=y clock:allow_step_backwards_hw=y global:log_status=y global:status_file=/path/to/ptp.status global:log_file=/path/to/ptp.log global:log_statistics=y global:statistics_log_interval=0 global:statistics_timestamp_format=both global:statistics_update_interval=1 global:statistics_file=/path/to/ptp.statistics global:lock_file=/path/to/ptp.pid ``` ## 配置样本 - ptp4l ptp4l工具是Linux的PTP的实现。 ``` [global] twoStepFlag             1 slaveOnly               0 priority1               128 priority2               128 domainNumber            30 logAnnounceInterval     1 logSyncInterval         -4 logMinDelayReqInterval  -4 tx_timestamp_timeout    100 logging_level   6 ``` ## 样品配置 - Arista 7050 边界时钟模式配置 此Arista 7050工具是用于边界时钟的IEEE 1588 PTP的实现。如果在客户端网络中使用Arista 7050作为边界时钟模式,则可以使用此示例配置代码。 ``` << Enabling Global PTP configurations on the switch >> ptp mode boundary ptp domain 30 ptp source ip 172.16.100.9 << Slave Port Specific Configuration>> interface Ethernet47 description ECX::EQIX-EPT-SV5-CX-PRI-03 switchport mode trunk ptp enable ptp sync-message interval -4 ptp announce interval 0 ptp delay-req interval -4 ptp vlan 111 ``` ## 示例配置 – Arista 7150 边界时钟模式 这是一个类似的工具,适用于Arista 7150。如果在客户端网络中使用Arista 7150作为边界时钟模式,则可以使用此示例配置代码。 ``` << Slave Port Specific Configuration>> interface Port-Channel13     switchport trunk allowed vlan 13    switchport mode trunk    ptp enable    ptp sync-message interval -4    ptp announce interval 1    ptp delay-req interval -4    ptp vlan 13   interface Ethernet44     description reserved_PTP    switchport trunk allowed vlan 13    switchport mode trunk    channel-group 13 mode active    ptp enable    ptp vlan 13 << Enabling Global PTP configurations on the switch >> ptp domain 30  ptp source ip 10.100.1.209 ptp priority1 129 ptp mode boundary ``` ## 配置示例 - 使用Network Edge的NTP over Anycast解决方案 有关通过Anycast配置Network Edge设备(包括路由器,防火墙和NTP)的详细信息,请参阅[Anycast使用案例](https://docs.equinix.com/zh-Hans/precision-time/ept-use-cases.md)。