> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/knowledge-base/zh/system-administration/configuring-ptp.md).

# 在 VergeOS 中配置 PTP

在 VergeOS 时间同步中配置精确时间协议（PTP）以替代 NTP，包括每一项 PTP 设置、其默认值，以及如何恢复为 NTP。

## 概述

{% hint style="info" %}
**要点**

* PTP 模式取代 NTP 进行系统时间同步。开启 PTP 模式时，NTP 不会运行。
* PTP 需要连接到支持 PTP 的交换机和 PTP grandmaster 时钟的物理网络。
* 硬件时间戳可提供最高精度。默认已开启。
* “ **时间设置** ”页面显示每个节点的同步状态。当某个节点不同步超过两分钟时，VergeOS 会发出警报。
* 要撤销更改，请将 **模式** 改回 **NTP**.
  {% endhint %}

本文说明如何将 VergeOS 的时间同步从 NTP 切换到精确时间协议（PTP），以及如何设置各个 PTP 选项。仅当你的工作负载需要比 NTP 更精确的时间时才使用 PTP，例如广播、金融交易、电信或工业自动化场景。

{% hint style="danger" %}
除非你的 NIC、交换机和 grandmaster 支持 PTP，否则不要启用 PTP。错误的 PTP 配置会导致系统中每个节点的时间不正确。
{% endhint %}

## 前提条件

* VergeOS 26.2 或更高版本。
* 具有系统管理员权限的用户。
* 连接到支持 PTP 的交换机或定时设备的物理网络。
* 节点可以访问的 PTP grandmaster 时钟，以及其 PTP 配置文件：域、传输和延迟机制。
* 支持硬件时间戳的 NIC，以获得最高精度。

## 步骤

{% hint style="warning" %}
当你将 **模式** 设置为 **PTP**时，NTP 会停止。如果节点无法访问 PTP master，它们就没有时间源。
{% endhint %}

1. 导航到 **系统 > 时间设置**.
2. 单击 **编辑设置** 在左侧菜单中。
3. 在 **模式** 列表中，选择 **PTP**。PTP 字段会显示在 **时间设置** 面板和 **高级 PTP 设置** 面板中。
4. 将基本设置设置为与 PTP 网络匹配。请参见 [基本设置](#basic-settings).
5. 如果你的 PTP 配置文件需要非默认值，请在 **高级 PTP 设置** 面板中进行设置。请参见 [高级设置](#advanced-settings).
6. 单击 **提交**.

“ **时间设置** 页面会打开并显示新的模式。

## 验证配置

1. 导航到 **系统 > 时间设置**.
2. 确保同步状态面板显示每个节点都已同步。如果某个节点不同步超过两分钟，VergeOS 会发出警报。
3. 在你的 grandmaster 或 PTP 交换机上，确保每个节点都在正确的域中显示为 PTP 客户端。
4. 确保依赖精确时间的应用程序正常运行。

如果同步无法稳定，请恢复为 NTP。然后检查你的 PTP 网络和设置。

## 恢复为 NTP

1. 导航到 **系统 > 时间设置**.
2. 单击 **编辑设置**.
3. 在 **模式** 列表中，选择 **NTP**.
4. 单击 **提交**.

“ **时间设置** 页面显示 **模式：NTP**。 **NTP 同步状态** 面板将每个节点显示为 **已同步**.

## 来宾时间

VergeOS 会将 kvmclock 参数传递给来宾。支持 PTP 的来宾可以与主机时钟精确同步。

## PTP 设置参考

### 基本设置

这些设置位于 **时间设置** 面板中。

| 字段           | 默认值   | 值              | 描述                                                                                                                            |
| ------------ | ----- | -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **PTP 接口网络** | 无     | 物理网络           | 承载 PTP 流量的物理网络。PTP 模式下必需。请选择连接到支持 PTP 的交换机或定时设备的网络。                                                                           |
| **PTP 传输**   | UDPv4 | UDPv4、UDPv6、L2 | PTP 消息的传输方式。请使用你的 PTP 配置文件所使用的传输方式。802.1AS（gPTP）使用 L2。                                                                        |
| **PTP 域**    | 0     | 0-127          | PTP 域编号。请使用你的 grandmaster 的域。                                                                                                 |
| **PTP 延迟机制** | E2E   | E2E、P2P、自动     | 路径延迟的测量方式：端到端（E2E）或点对点（P2P）。请使用你的 PTP 网络所采用的机制。                                                                               |
| **使用硬件时间戳**  | 开启    | 开启、关闭          | 使用硬件时间戳时，ptp4l 会控制 NIC 硬件时钟，phc2sys 会将该时间复制到系统时钟。使用软件时间戳时，ptp4l 会直接控制系统时钟，但精度较低。如果你的 NIC 不支持硬件时间戳，请将其关闭。VergeOS 不会自动回退到软件时间戳。 |

### 高级设置

这些设置位于 **高级 PTP 设置** 面板。默认值适用于大多数 PTP 网络。仅当你的 PTP 配置文件或 grandmaster 需要时才更改某个值。

| 字段                    | 默认值      | 值      | 描述                                                                              |
| --------------------- | -------- | ------ | ------------------------------------------------------------------------------- |
| **时钟优先级 1**           | 128      | 0-255  | 最佳主时钟算法（BMCA）中时钟选择的优先级。数值越小，优先级越高。                                              |
| **时钟优先级 2**           | 128      | 0-255  | 当时钟优先级 1 相同时的 BMCA 决胜值。                                                         |
| **双步时钟**              | 开启       | 开启、关闭  | 开启：时间戳通过 Follow\_Up 消息发送。关闭：时间戳包含在 Sync 消息中（单步）。                                |
| **同步日志间隔**            | 0        | -6 到 1 | Sync 消息速率，以 log2 秒表示：0 = 1 秒，-1 = 0.5 秒，-3 = 0.125 秒。                           |
| **Announce 日志间隔**     | 1        | -3 到 3 | Announce 消息速率，以 log2 秒表示：0 = 1 秒，1 = 2 秒，2 = 4 秒。                               |
| **最小延迟请求日志间隔**        | 0        | -4 到 1 | 最小延迟请求速率，以 log2 秒表示。与 E2E 延迟机制一起使用。                                             |
| **最小 P-Delay 请求日志间隔** | 0        | -4 到 1 | 最小同级延迟请求速率，以 log2 秒表示。与 P2P 延迟机制一起使用。                                           |
| **单播传输**              | 关闭       | 开启、关闭  | 使用单播而不是多播。仅当你的 PTP 对等设备支持单播时才开启。                                                |
| **DSCP 事件消息（端口 319）** | 0        | 0-63   | 用于 QoS 的 PTP 事件消息 DSCP 值。                                                       |
| **DSCP 通用消息（端口 320）** | 0        | 0-63   | 用于 QoS 的 PTP 通用消息 DSCP 值。                                                       |
| **始终为主（禁用 BMCA）**     | 关闭       | 开启、关闭  | 该端口始终充当主时钟，不使用 BMCA。仅当 VergeOS 是 PTP 网络的时间源时才开启。如果另一个 grandmaster 使用相同的域，请不要开启。 |
| **禁止 Announce 消息**    | 关闭       | 开启、关闭  | 停止发送和接收 Announce 消息。                                                            |
| **禁止延迟请求消息**          | 关闭       | 开启、关闭  | 停止发送延迟请求消息。                                                                     |
| **包含跟随信息**            | 关闭       | 开启、关闭  | 将跟随信息 TLV 添加到 Follow\_Up 消息中。某些配置文件，例如 802.1AS，需要它。                             |
| **传输特定字段**            | 0        | 0-255  | PTP 的 transportSpecific 字段。对于 802.1AS（gPTP），此值通常为 1。                            |
| **最大邻居传播延迟（ns）**      | 20000000 | 纳秒     | 允许到邻居的最大传播延迟。这是一个上限，而不是预期延迟。                                                    |
| **同步接收超时**            | 0        | 0-255  | 超时前的同步间隔数量。0 会禁用超时。                                                             |
| **Announce 接收超时**     | 3        | 1-255  | 超时前的 Announce 间隔数量。                                                             |

## 其他资源

* [时间设置](https://app.gitbook.com/s/pODKGSQETqL1gSqyxIq3/system-administration/time-settings)
* [系统设置](https://docs.verge.io/run-the-platform/zh/xi-tong-guan-li/settings-overview.md)
* [VergeOS 26.2 发行说明](https://docs.verge.io/release-notes/zh/2026/26-2-release-notes.md)

{% hint style="info" %}
**需要帮助？**

如果你对本流程有任何问题或遇到任何故障，请联系 VergeOS 支持团队。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.verge.io/knowledge-base/zh/system-administration/configuring-ptp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
