H3C S5130-EI NTP 典 型 配 置 举 例 Copyright 2014 杭 州 华 三 通 信 技 术 有 限 公 司 版 权 所 有, 保 留 一 切 权 利 非 经 本 公 司 书 面 许 可, 任 何 单 位 和 个 人 不 得 擅 自 摘 抄 复 制 本 文 档 内 容 的 部 分 或 全 部, 并 不 得 以 任 何 形 式 传 播 本 文 档 中 的 信 息 可 能 变 动, 恕 不 另 行 通 知
目 录 1 简 介 1-1 2 配 置 前 提 1-1 3 NTP 服 务 器 / 客 户 端 模 式 典 型 配 置 举 例 3-1 3.1 组 网 需 求 3-1 3.2 使 用 版 本 3-1 3.3 配 置 步 骤 3-2 3.3.1 Device A 的 配 置 3-2 3.3.2 Device B 的 配 置 3-2 3.3.3 Device C 的 配 置 3-2 3.4 验 证 配 置 3-2 3.5 配 置 文 件 3-3 4 NTP 广 播 模 式 典 型 配 置 举 例 4-3 4.1 组 网 需 求 4-3 4.2 使 用 版 本 4-4 4.3 配 置 步 骤 4-4 4.3.1 Device C 的 配 置 4-4 4.3.2 Device A 的 配 置 4-4 4.4 验 证 配 置 4-5 4.5 配 置 文 件 4-5 5 NTP 组 播 模 式 典 型 配 置 举 例 5-6 5.1 组 网 需 求 5-6 5.2 使 用 版 本 5-7 5.3 配 置 步 骤 5-7 5.3.1 Device C 的 配 置 5-7 5.3.2 Device D 的 配 置 5-7 5.3.3 Device B 的 配 置 5-8 5.3.4 Device A 的 配 置 5-8 5.4 验 证 配 置 5-8 5.5 配 置 文 件 5-9 6 带 身 份 验 证 的 NTP 客 户 端 / 服 务 器 模 式 典 型 配 置 举 例 6-10 6.1 组 网 需 求 6-10 6.2 使 用 版 本 6-10 6.3 配 置 步 骤 6-11 i
6.3.1 Device A 的 配 置 6-11 6.3.2 Device B 的 配 置 6-11 6.3.3 Device C 的 配 置 6-11 6.4 验 证 配 置 6-12 6.5 配 置 文 件 6-12 7 SNTP 典 型 配 置 举 例 7-13 7.1 组 网 需 求 7-13 7.2 使 用 版 本 7-14 7.3 配 置 步 骤 7-14 7.3.1 Device A 的 配 置 7-14 7.3.2 Device B 的 配 置 7-14 7.3.3 Device C 的 配 置 7-14 7.4 验 证 配 置 7-15 7.5 配 置 文 件 7-15 8 IPv6 NTP 服 务 器 / 客 户 端 模 式 典 型 配 置 举 例 8-16 8.1 组 网 需 求 8-16 8.2 使 用 版 本 8-16 8.3 配 置 步 骤 8-16 8.3.1 Device A 的 配 置 8-16 8.3.2 Device B 的 配 置 8-16 8.3.3 Device C 的 配 置 8-17 8.4 验 证 配 置 8-17 8.5 配 置 文 件 8-18 9 IPv6 NTP 组 播 模 式 典 型 配 置 举 例 9-18 9.1 组 网 需 求 9-18 9.2 使 用 版 本 9-19 9.3 配 置 步 骤 9-19 9.3.1 Device C 的 配 置 9-19 9.3.2 Device D 的 配 置 9-19 9.3.3 Device B 的 配 置 9-20 9.3.4 Device A 的 配 置 9-20 9.4 验 证 配 置 9-20 9.5 配 置 文 件 9-21 10 带 身 份 验 证 的 NTP 广 播 模 式 典 型 配 置 举 例 10-22 10.1 组 网 需 求 10-22 10.2 使 用 版 本 10-23 ii
10.3 配 置 步 骤 10-23 10.3.1 Device C 的 配 置 10-23 10.3.2 Device A 的 配 置 10-23 10.4 验 证 配 置 10-24 10.5 配 置 文 件 10-24 11 相 关 资 料 11-25 iii
1 简 介 本 章 介 绍 了 与 NTP 有 关 的 各 种 典 型 配 置 举 例 2 配 置 前 提 本 文 档 不 严 格 与 具 体 软 硬 件 版 本 对 应, 如 果 使 用 过 程 中 与 产 品 实 际 情 况 有 差 异, 请 参 考 相 关 产 品 手 册, 或 以 设 备 实 际 情 况 为 准 本 文 档 中 的 配 置 均 是 在 实 验 室 环 境 下 进 行 的 配 置 和 验 证, 配 置 前 设 备 的 所 有 参 数 均 采 用 出 厂 时 的 缺 省 配 置 如 果 您 已 经 对 设 备 进 行 了 配 置, 为 了 保 证 配 置 效 果, 请 确 认 现 有 配 置 和 以 下 举 例 中 的 配 置 不 冲 突 本 文 档 假 设 您 已 了 解 NTP 特 性 3 NTP 服 务 器 / 客 户 端 模 式 典 型 配 置 举 例 3.1 组 网 需 求 如 图 1-1 所 示, 网 络 中 有 一 台 时 间 服 务 器 Device A, 为 网 络 中 的 其 它 设 备 提 供 精 确 的 时 间 服 务, 为 保 证 网 络 中 的 所 有 设 备 能 保 持 一 致 统 一 的 时 钟, 现 要 求 配 置 NTP 服 务 器 / 客 户 端 模 式, 使 所 有 设 备 能 从 时 间 服 务 器 Device A 上 获 得 时 钟 同 步 图 1 配 置 NTP 服 务 器 / 客 户 端 模 式 组 网 图 3.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 3-1
3.3 配 置 步 骤 3.3.1 Device A 的 配 置 配 置 接 口 Vlan-interface2 的 IP 地 址 <DeviceA> system-view [DeviceA] interface Vlan-interface 2 [DeviceA-Vlan-interface2] ip address 1.0.1.11 24 [DeviceA-Vlan-interface2] quit 开 启 NTP 功 能 [DeviceA] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceA] ntp-service refclock-master 2 3.3.2 Device B 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceB> system-view [DeviceB] 设 置 NTP Server 为 Device B 的 时 间 服 务 器 [DeviceB] ntp-service unicast-server 1.0.1.11 3.3.3 Device C 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceC> system-view [DeviceC] 设 置 NTP Server 为 Device C 的 时 间 服 务 器 [DeviceC] ntp-service unicast-server 1.0.1.11 3.4 验 证 配 置 以 上 配 置 完 成 后,Device B 和 Device C 向 Device A 进 行 时 间 同 步 以 Device B 为 例, 查 看 NTP 的 运 行 状 态 [DeviceB] display ntp-service status Clock status: synchronized Clock stratum: 3 System peer: 1.0.1.11 Local mode: client Reference clock ID: 1.0.1.11 Leap indicator: 00 Clock jitter: 0.003479 s Stability: 0.000 pps 3-2
Clock precision: 2^-15 Root delay: 1.95313 ms Root dispersion: 28.38135 ms Reference time: d5ed8cd5.577006ea Wed, Sep 25 2013 16:24:53.341 此 时 Device B 已 经 与 Device A 同 步, 层 数 比 Device A 的 层 数 大 1, 为 3 查 看 Device B 的 NTP 会 话 信 息, 可 以 看 到 Device B 与 Device A 建 立 了 连 接 [DeviceB] display ntp-service sessions source reference stra reach poll now offset delay disper ******************************************************************************** [12345]1.0.1.11 127.127.1.0 2 255 64 38-10.22 1.9531 3.3416 Notes: 1 source(master), 2 source(peer), 3 selected, 4 candidate, 5 configured. Total sessions: 1 3.5 配 置 文 件 Device A 上 的 配 置 ip address 1.0.1.11 255.255.255.0 ntp-service refclock-master 2 Device B 上 的 配 置 ip address 1.0.1.12 255.255.255.0 ntp-service unicast-server 1.0.1.11 Device C 上 的 配 置 ip address 1.0.1.13 255.255.255.0 ntp-service unicast-server 1.0.1.11 4 NTP 广 播 模 式 典 型 配 置 举 例 4.1 组 网 需 求 如 图 1-5 所 示, 网 络 中 设 备 较 多, 所 有 设 备 都 位 于 同 一 个 网 段 (3.0.1.0/24) 中, 为 了 便 于 管 理, 现 要 求 通 过 配 置 NTP 广 播 模 式, 使 网 络 中 的 设 备 拥 有 一 致, 统 一 的 时 间 4-3
图 2 NTP 广 播 模 式 配 置 组 网 图 4.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 4.3 配 置 步 骤 4.3.1 Device C 的 配 置 开 启 NTP 功 能 <DeviceC> system-view [DeviceC] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceC] ntp-service refclock-master 2 配 置 接 口 Vlan-interface2 的 IP 地 址 [DeviceC] interface Vlan-interface 2 [DeviceC-Vlan-interface2] ip address 3.0.1.31 24 配 置 Device C 为 广 播 服 务 器, 从 Vlan-interface2 向 网 络 中 发 送 NTP 广 播 报 文 [DeviceC-Vlan-interface2] ntp-service broadcast-server 4.3.2 Device A 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceA> system-view [DeviceA] 配 置 接 口 Vlan-interface2 的 IP 地 址 [DeviceA] interface Vlan-interface 2 [DeviceA-Vlan-interface2] ip address 3.0.1.33 24 4-4
设 置 为 广 播 客 户 端, 从 Vlan-interface2 监 听 广 播 消 息 [DeviceA-Vlan-interface2] ntp-service broadcast-client Device B Device D 和 Device E 的 配 置 与 Device A 相 同, 此 处 不 再 赘 述 4.4 验 证 配 置 以 Device A 为 例, 查 看 NTP 的 运 行 状 态 [DeviceA-Vlan-interface2] display ntp-service status Clock status: synchronized Clock stratum: 3 System peer: 3.0.1.31 Local mode: bclient Reference clock ID: 3.0.1.31 Leap indicator: 00 Clock jitter: 0.000061 s Stability: 0.000 pps Clock precision: 2^-14 Root delay: 0.00000 ms Root dispersion: 7951.43127 ms Reference time: d5ee8d88.2faabed0 Thu, Sep 26 2013 10:40:08.186 此 时 Device A 已 经 与 Device C 同 步, 层 数 比 Device C 的 层 数 大 1, 为 3 查 看 Device A 的 NTP 会 话 信 息, 可 以 看 到 Device A 与 Device C 建 立 了 连 接 [DeviceA-Vlan-interface2] display ntp-service sessions source reference stra reach poll now offset delay disper ******************************************************************************** [1234]3.0.1.31 127.127.1.0 2 254 64 82-2.190 0.0000 7937.5 Notes: 1 source(master), 2 source(peer), 3 selected, 4 candidate, 5 configured. Total sessions: 1 4.5 配 置 文 件 设 备 Device C ip address 3.0.1.31 255.255.255.0 ntp-service broadcast-server ntp-service refclock-master 2 设 备 Device A 4-5
ip address 3.0.1.33 255.255.255.0 ntp-service broadcast-client ntp-service broadcast-client 设 备 Device B ip address 3.0.1.30 255.255.255.0 ntp-service broadcast-client ntp-service broadcast-client 设 备 Device D ip address 3.0.1.32 255.255.255.0 ntp-service broadcast-client ntp-service broadcast-client 设 备 Device E ip address 3.0.1.34 255.255.255.0 ntp-service broadcast-client ntp-service broadcast-client 5 NTP 组 播 模 式 典 型 配 置 举 例 5.1 组 网 需 求 如 图 1-6 所 示, 网 络 中 有 一 台 时 间 服 务 器 Device C, 网 络 中 设 备 较 多, 而 且 这 些 设 备 分 布 在 不 同 网 段 中, 为 了 便 于 管 理, 现 要 求 配 置 NTP 组 播 模 式, 使 网 络 中 的 设 备 拥 有 统 一, 一 致 的 时 间 5-6
图 3 配 置 NTP 组 播 模 式 组 网 图 Vlan-int2 3.0.1.31/24 Device C (NTP Server) Device A Vlan-int3 1.0.1.11/24 Vlan-int3 1.0.1.10/24 GE1/0/1 Device B Vlan-int2 3.0.1.30/24 Vlan-int2 3.0.1.32/24 Device D 5.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 5.3 配 置 步 骤 5.3.1 Device C 的 配 置 开 启 NTP 功 能 <DeviceC> system-view [DeviceC] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceC] ntp-service refclock-master 2 配 置 接 口 Vlan-interface2 的 IP 地 址 [DeviceC] interface Vlan-interface 2 [DeviceC-Vlan-interface2] ip address 3.0.1.31 24 设 置 Device C 为 组 播 服 务 器, 从 VLAN 接 口 2 发 送 组 播 报 文 [DeviceC-Vlan-interface2] ntp-service multicast-server 5.3.2 Device D 的 配 置 开 启 NTP 功 能 <DeviceD> system-view [DeviceD] 配 置 接 口 Vlan-interface2 的 IP 地 址 [DeviceD] interface Vlan-interface 2 [DeviceD-Vlan-interface2] ip address 3.0.1.32 24 设 置 Device D 为 组 播 客 户 端, 从 VLAN 接 口 2 监 听 组 播 报 文 [DeviceD-Vlan-interface2] ntp-service multicast-client 5-7
5.3.3 Device B 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceB> system-view [DeviceB] 设 置 Device B 为 组 播 客 户 端, 从 VLAN 接 口 2 监 听 组 播 报 文 [DeviceB] interface Vlan-interface 2 [DeviceB-Vlan-interface2] ntp-service multicast-client [DeviceB-Vlan-interface2] quit 由 于 Device A 与 Device C 不 在 同 一 网 段, 所 以 Device B 上 需 要 配 置 组 播 功 能, 否 则 Device A 收 不 到 Device C 发 出 的 组 播 报 文 配 置 组 播 功 能 [DeviceB] multicast routing [DeviceB] interface vlan-interface 2 [DeviceB-Vlan-interface2] pim dm [DeviceB-Vlan-interface2] quit [DeviceB] vlan 3 [DeviceB-vlan3] port GigabitEthernet 1/0/1 [DeviceB-vlan3] quit [DeviceB] interface vlan-interface 3 [DeviceB-Vlan-interface3] ip address 1.0.1.10 24 [DeviceB-Vlan-interface3] igmp enable [DeviceB-Vlan-interface3] igmp static-group 224.0.1.1 [DeviceB-Vlan-interface3] quit [DeviceB] igmp-snooping [DeviceB-igmp-snooping] quit [DeviceB] interface GigabitEthernet 1/0/1 [DeviceB-GigabitEthernet1/0/1] igmp-snooping static-group 224.0.1.1 vlan 3 5.3.4 Device A 的 配 置 开 启 NTP 功 能 <DeviceA> system-view [DeviceA] 配 置 接 口 Vlan-interface3 的 IP 地 址 [DeviceA] interface Vlan-interface 3 [DeviceA-Vlan-interface3] ip address 1.0.1.11 24 设 置 Device A 为 组 播 客 户 端, 从 VLAN 接 口 3 监 听 组 播 报 文 [DeviceA-Vlan-interface3] ntp-service multicast-client 5.4 验 证 配 置 以 Device A 为 例, 查 看 NTP 的 运 行 状 态 [DeviceA-Vlan-interface3] display ntp-service status 5-8
Clock status: synchronized Clock stratum: 3 System peer: 3.0.1.31 Local mode: bclient Reference clock ID: 3.0.1.31 Leap indicator: 00 Clock jitter: 0.000061 s Stability: 0.000 pps Clock precision: 2^-14 Root delay: 1.69373 ms Root dispersion: 1950.18005 ms Reference time: d5ee9b15.2f3a684d Thu, Sep 26 2013 11:37:57.184 此 时 Device A 已 经 与 Device C 同 步, 层 数 比 Device C 的 层 数 大 1, 为 3 5.5 配 置 文 件 设 备 Device A interface Vlan-interface3 ip address 1.0.1.11 255.255.255.0 ntp-service multicast-client 设 备 Device B multicast routing igmp-snooping ip address 3.0.1.30 255.255.255.0 pim dm ntp-service multicast-client interface Vlan-interface3 ip address 1.0.1.10 255.255.255.0 igmp enable igmp static-group 224.0.1.1 interface GigabitEthernet1/0/1 port access vlan 3 igmp-snooping static-group 224.0.1.1 vlan 3 设 备 Device C 5-9
ntp-service refclock-master 2 ip address 3.0.1.31 255.255.255.0 ntp-service multicast-server 设 备 Device D ip address 3.0.1.32 255.255.255.0 ntp-service multicast-client 6 带 身 份 验 证 的 NTP 客 户 端 / 服 务 器 模 式 典 型 配 置 举 例 6.1 组 网 需 求 网 络 中 有 一 台 时 间 服 务 器 Device A, 为 网 络 中 的 其 它 设 备 提 供 精 确 的 时 间 服 务, 为 保 证 网 络 中 的 所 有 设 备 能 保 持 一 致 统 一 的 时 钟, 现 要 求 : 配 置 NTP 服 务 器 / 客 户 端 模 式, 使 所 有 设 备 能 从 时 间 服 务 器 Device A 上 获 得 时 钟 同 步 设 备 在 获 得 时 钟 同 步 前, 需 要 通 过 Device A 的 NTP 验 证 图 4 带 身 份 验 证 的 NTP 客 户 端 / 服 务 器 模 式 典 型 配 置 举 例 组 网 图 6.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 6-10
6.3 配 置 步 骤 6.3.1 Device A 的 配 置 配 置 接 口 Vlan-interface2 的 IP 地 址 <DeviceA> system-view [DeviceA] interface Vlan-interface 2 [DeviceA-Vlan-interface2] ip address 1.0.1.11 24 开 启 NTP 服 务 [DeviceA] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceA] ntp-service refclock-master 2 在 Device A 上 启 动 NTP 验 证 功 能 [DeviceA] ntp-service authentication enable 创 建 编 号 为 42 的 NTP 验 证 密 钥, 密 钥 值 为 anicekey, 以 明 文 形 式 输 入 [DeviceA] ntp-service authentication-keyid 42 authentication-mode md5 simple anicekey 配 置 编 号 为 42 的 密 钥 为 可 信 密 钥 [DeviceA] ntp-service reliable authentication-keyid 42 6.3.2 Device B 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 NTP 服 务 <DeviceB> system-view [DeviceB] 在 Device B 上 启 动 NTP 验 证 功 能 [DeviceB] ntp-service authentication enable 创 建 编 号 为 42 的 NTP 验 证 密 钥, 密 钥 值 为 anicekey, 以 明 文 形 式 输 入 [DeviceB] ntp-service authentication-keyid 42 authentication-mode md5 simple anicekey 配 置 编 号 为 42 的 密 钥 为 可 信 密 钥 [DeviceB] ntp-service reliable authentication-keyid 42 设 置 Device A 为 Device B 的 NTP 服 务 器, 并 将 该 服 务 器 与 编 号 为 42 的 密 钥 关 联 [DeviceB] ntp-service unicast-server 1.0.1.11 authentication-keyid 42 以 上 配 置 将 使 得 Device B 与 Device A 进 行 时 间 同 步 6.3.3 Device C 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 NTP 服 务 <DeviceC> system-view [DeviceC] 在 Device C 上 启 动 NTP 验 证 功 能 6-11
[DeviceC] ntp-service authentication enable 创 建 编 号 为 42 的 NTP 验 证 密 钥, 密 钥 值 为 anicekey, 以 明 文 形 式 输 入 [DeviceC] ntp-service authentication-keyid 42 authentication-mode md5 simple anicekey 配 置 编 号 为 42 的 密 钥 为 可 信 密 钥 [DeviceC] ntp-service reliable authentication-keyid 42 设 置 Device A 为 Device C 的 NTP 服 务 器, 并 将 该 服 务 器 与 编 号 为 42 的 密 钥 关 联 [DeviceC] ntp-service unicast-server 1.0.1.11 authentication-keyid 42 以 上 配 置 将 使 得 Device C 与 Device A 进 行 时 间 同 步 6.4 验 证 配 置 完 成 上 述 配 置 后,Device B DeviceC 可 以 与 Device A 的 时 间 同 步 同 步 后 查 看 Device B 的 状 态 可 以 看 出,Device B 已 经 与 Device A 同 步, 层 数 比 Device A 的 层 数 大 1, 为 3 [DeviceB] display ntp-service status Clock status: synchronized Clock stratum: 3 System peer: 1.0.1.11 Local mode: client Reference clock ID: 1.0.1.11 Leap indicator: 00 Clock jitter: 0.005096 s Stability: 0.000 pps Clock precision: 2^-10 Root delay: 0.00655 ms Root dispersion: 1.15869 ms Reference time: d0c62687.ab1bba7d Mon, Sep 30 2013 16:06:26.764 查 看 Device B 的 NTP 服 务 的 所 有 IPv4 会 话 信 息, 可 以 看 到 Device B 与 Device A 建 立 了 会 话 [DeviceB] display ntp-service sessions source reference stra reach poll now offset delay disper ******************************************************************************** [1245]1.0.1.11 127.127.1.0 2 1 64 519-0.0 0.0065 0.0 Notes: 1 source(master),2 source(peer),3 selected,4 candidate,5 configured. Total sessions : 1 6.5 配 置 文 件 设 备 Device A ip address 1.0.1.11 255.255.255.0 ntp-service authentication enable ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$4j3skcgqwbk3un41b9u0jxzjx9i7iunosqi ntp-service reliable authentication-keyid 42 6-12
ntp-service refclock-master 2 设 备 Device B ip address 1.0.1.12 255.255.255.0 ntp-service authentication enable ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$22eic8l796cpudzqiaaz2slzifrgzftvyn8x ntp-service reliable authentication-keyid 42 ntp-service unicast-server 1.0.1.11 authentication-keyid 42 设 备 Device C ip address 1.0.1.13 255.255.255.0 ntp-service authentication enable ntp-service authentication-keyid 42 authentication-mode md5 cipher $c$3$xjzvmj1tjbwyyaxppxxf7jieozag8cehibm8 ntp-service reliable authentication-keyid 42 ntp-service unicast-server 1.0.1.11 authentication-keyid 42 7 SNTP 典 型 配 置 举 例 7.1 组 网 需 求 如 图 1-10 所 示, 网 络 中 有 一 台 时 间 服 务 器 Device A, 为 网 络 中 的 其 它 网 络 设 备 提 供 精 确 的 时 间 服 务, 为 保 证 网 络 中 的 所 有 设 备 能 保 持 一 致 统 一 的 时 钟, 现 要 求 配 置 所 有 网 络 设 备 为 SNTP 客 户 端, 使 所 有 设 备 能 从 时 间 服 务 器 Device A 上 获 得 时 钟 同 步 7-13
图 5 SNTP 典 型 配 置 举 例 组 网 图 7.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 7.3 配 置 步 骤 7.3.1 Device A 的 配 置 配 置 接 口 Vlan-interface2 的 IP 地 址 <DeviceA> system-view [DeviceA] interface Vlan-interface 2 [DeviceA-Vlan-interface2] ip address 1.0.1.11 24 开 启 NTP 功 能 [DeviceA] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceA] ntp-service refclock-master 2 7.3.2 Device B 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 SNTP 功 能 <DeviceB> system-view [DeviceB] sntp enable 设 置 Device A 为 Device B 的 时 间 服 务 器 [DeviceB] sntp unicast-server 1.0.1.11 7.3.3 Device C 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 7-14
开 启 SNTP 功 能 <DeviceC> system-view [DeviceC] sntp enable 设 置 Device A 为 Device C 的 时 间 服 务 器 [DeviceC] sntp unicast-server 1.0.1.11 7.4 验 证 配 置 以 上 配 置 完 成 后,Device B 和 Device C 向 Device A 进 行 时 间 同 步 以 Device B 为 例, 查 看 Device B 的 NTP 会 话 信 息, 可 以 看 到 Device B 与 Device A 建 立 了 连 接 [DeviceB] display sntp sessions SNTP server Stratum Version Last receive time 1.0.1.11 2 4 Thu, Sep 26 2013 17:25:09.121 (Synced) 7.5 配 置 文 件 Device A 上 的 配 置 ip address 1.0.1.11 255.255.255.0 ntp-service refclock-master 2 Device B 上 的 配 置 ip address 1.0.1.12 255.255.255.0 sntp enable sntp unicast-server 1.0.1.11 Device C 上 的 配 置 ip address 1.0.1.13 255.255.255.0 sntp enable sntp unicast-server 1.0.1.11 7-15
8 IPv6 NTP 服 务 器 / 客 户 端 模 式 典 型 配 置 举 例 8.1 组 网 需 求 如 图 1 所 示,IPv6 网 络 中 有 一 台 时 间 服 务 器 Device A, 为 网 络 中 的 其 它 设 备 提 供 精 确 的 时 间 服 务, 为 保 证 网 络 中 所 有 设 备 的 时 间 保 持 一 致, 现 要 求 配 置 IPv6 NTP 服 务 器 / 客 户 端 模 式, 使 所 有 设 备 能 从 时 间 服 务 器 Device A 上 获 得 时 钟 同 步 图 6 配 置 IPv6 NTP 服 务 器 / 客 户 端 模 式 组 网 图 8.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 8.3 配 置 步 骤 8.3.1 Device A 的 配 置 配 置 接 口 Vlan-interface2 的 IP 地 址 <DeviceA> system-view [DeviceA] interface vlan-interface 2 [DeviceA-Vlan-interface2] ipv6 address 3000::34 64 [DeviceA-Vlan-interface2] quit 开 启 NTP 功 能 [DeviceA] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceA] ntp-service refclock-master 2 8.3.2 Device B 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 8-16
开 启 NTP 功 能 <DeviceB> system-view [DeviceB] 设 置 NTP Server 为 Device B 的 时 间 服 务 器 [DeviceB] ntp-service ipv6 unicast-server 3000::34 8.3.3 Device C 的 配 置 配 置 接 口 的 IP 地 址, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceC> system-view [DeviceC] 设 置 NTP Server 为 Device C 的 时 间 服 务 器 [DeviceC] ntp-service ipv6 unicast-server 3000::34 8.4 验 证 配 置 以 上 配 置 完 成 后,Device B 和 Device C 向 Device A 进 行 时 间 同 步 以 Device B 为 例, 查 看 NTP 的 运 行 状 态 [DeviceB] display ntp-service status Clock status: synchronized Clock stratum: 3 System peer: 3000::34 Local mode: client Reference clock ID: 95.197.17.40 Leap indicator: 00 Clock jitter: 0.003479 s Stability: 0.000 pps Clock precision: 2^-15 Root delay: 1.95313 ms Root dispersion: 28.38135 ms Reference time: d5ed8cd5.577006ea Wed, Sep 25 2013 16:24:53.341 此 时 Device B 已 经 与 Device A 同 步, 层 数 比 Device A 的 层 数 大 1, 为 3 查 看 Device B 的 NTP 会 话 信 息, 可 以 看 到 Device B 与 Device A 建 立 了 连 接 [DeviceB] display ntp-service ipv6 sessions Notes: 1 source(master), 2 source(peer), 3 selected, 4 candidate, 5 configured. Source: [12345] 3000::34 Reference: 127.127.1.0 Clock stratum: 2 Reachabilities: 3 Poll interval: 64 Last receive time: 62 Offset: 0.1272 Roundtrip delay: 1.8158 Dispersion: 188.47 Total sessions: 1 8-17
8.5 配 置 文 件 设 备 Device A ipv6 address 3000::34/64 ntp-service refclock-master 2 设 备 Device B ipv6 address 3000::35/64 ntp-service ipv6 unicast-server 3000::34 设 备 Device C ipv6 address 3000::36/64 ntp-service ipv6 unicast-server 3000::34 9 IPv6 NTP 组 播 模 式 典 型 配 置 举 例 9.1 组 网 需 求 如 图 1-6 所 示,IPv6 网 络 中 有 一 台 时 间 服 务 器 Device C, 网 络 中 设 备 较 多, 而 且 这 些 设 备 分 布 在 不 同 网 段 中, 为 了 便 于 管 理, 现 要 求 配 置 IPv6 NTP 组 播 模 式, 使 网 络 中 所 有 设 备 的 时 间 保 持 一 致 9-18
图 7 配 置 IPv6 NTP 组 播 模 式 组 网 图 Vlan-int2 3000::2/64 Device C (NTP Server) Device A Vlan-int3 2000::1/64 Vlan-int3 2000::2/64 GE1/0/1 Device B Vlan-int2 3000::1/64 Vlan-int2 3000::3/64 Device D 9.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 9.3 配 置 步 骤 9.3.1 Device C 的 配 置 配 置 路 由 协 议, 以 保 证 各 设 备 间 能 够 路 由 可 达, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceC> system-view [DeviceC] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceC] ntp-service refclock-master 2 配 置 接 口 Vlan-interface2 的 IP 地 址 [DeviceC] interface Vlan-interface 2 [DeviceC-Vlan-interface2] ipv6 address 3000::2 64 设 置 Device C 为 IPv6 组 播 服 务 器, 从 VLAN 接 口 2 向 组 播 地 址 FF24::1 发 送 NTP 组 播 报 文 [DeviceC-Vlan-interface2] ntp-service ipv6 multicast-server ff24::1 [DeviceC-Vlan-interface2] quit 9.3.2 Device D 的 配 置 配 置 路 由 协 议, 以 及 接 口 的 IP 地 址, 以 保 证 各 设 备 间 能 够 路 由 可 达, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceD> system-view [DeviceD] 设 置 Device D 为 组 播 客 户 端, 从 VLAN 接 口 2 监 听 组 播 报 文 [DeviceD-Vlan-interface2] ntp-service ipv6 multicast-client ff24::1 9-19
[DeviceD-Vlan-interface2] quit 9.3.3 Device B 的 配 置 配 置 路 由 协 议, 以 及 接 口 的 IP 地 址, 以 保 证 各 设 备 间 能 够 路 由 可 达, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceB> system-view [DeviceB] 设 置 Device B 为 组 播 客 户 端, 从 VLAN 接 口 2 监 听 组 播 报 文 [DeviceB-Vlan-interface2] ntp-service ipv6 multicast-client ff24::1 [DeviceB-Vlan-interface2] quit 由 于 Device A 与 Device C 不 在 同 一 网 段, 所 以 Device B 上 需 要 配 置 组 播 功 能, 否 则 Device A 收 不 到 Device C 发 出 的 组 播 报 文 配 置 组 播 功 能 [DeviceB] ipv6 multicast routing [DeviceB-mrib6] quit [DeviceB] interface vlan-interface 2 [DeviceB-Vlan-interface2] ipv6 pim dm [DeviceB-Vlan-interface2] quit [DeviceB] vlan 3 [DeviceB-vlan3] port GigabitEthernet 1/0/1 [DeviceB-vlan3] quit [DeviceB] interface vlan-interface 3 [DeviceB-Vlan-interface3] mld enable [DeviceB-Vlan-interface3] mld static-group ff24::1 [DeviceB-Vlan-interface3] quit [DeviceB] mld-snooping [DeviceB-mld-snooping] quit [DeviceB] interface GigabitEthernet 1/0/1 [DeviceB-GigabitEthernet1/0/1] mld-snooping static-group ff24::1 vlan 3 [DeviceB-mld-snooping] quit 9.3.4 Device A 的 配 置 配 置 路 由 协 议, 以 及 接 口 的 IP 地 址, 以 保 证 各 设 备 间 能 够 路 由 可 达, 配 置 步 骤 这 里 省 略 开 启 NTP 功 能 <DeviceA> system-view [DeviceA] 设 置 Device A 为 组 播 客 户 端, 从 VLAN 接 口 3 监 听 组 播 报 文 [DeviceA-Vlan-interface3] ntp-service ipv6 multicast-client ff24::1 [DeviceA-Vlan-interface3] quit 9.4 验 证 配 置 以 Device A 为 例, 查 看 NTP 的 运 行 状 态 9-20
[DeviceA] display ntp-service status Clock status: synchronized Clock stratum: 3 System peer: 3000::2 Local mode: bclient Reference clock ID: 165.84.121.65 Leap indicator: 00 Clock jitter: 0.000061 s Stability: 0.000 pps Clock precision: 2^-14 Root delay: 1.69373 ms Root dispersion: 1950.18005 ms Reference time: d5ee9b15.2f3a684d Thu, Sep 26 2013 11:37:57.184 此 时 Device A 已 经 与 Device C 同 步, 层 数 比 Device C 的 层 数 大 1, 为 3 9.5 配 置 文 件 设 备 Device A interface Vlan-interface3 ipv6 address 2000::1/64 ntp-service ipv6 multicast-client ff24::1 设 备 Device B ipv6 multicast routing mld-snooping ipv6 address 3000::1/64 ipv6 pim dm ntp-service ipv6 multicast-client ff24::1 interface Vlan-interface3 ipv6 address 2000::2/64 mld enable mld static-group ff24::1 interface GigabitEthernet1/0/1 port access vlan 3 mld-snooping static-group ff24::1 vlan 3 9-21
设 备 Device C ntp-service refclock-master 2 ipv6 address 3000::2/64 ntp-service ipv6 multicast-server ff24::1 设 备 Device D ipv6 address 3000::3/64 ntp-service ipv6 multicast-client ff24::1 10 带 身 份 验 证 的 NTP 广 播 模 式 典 型 配 置 举 例 10.1 组 网 需 求 如 图 3 所 示, 网 络 中 设 备 较 多, 所 有 设 备 都 位 于 同 一 个 网 段 (3.0.1.0/24) 中, 为 了 使 网 络 中 所 有 设 备 的 时 间 保 持 一 致, 现 要 求 : 配 置 NTP 广 播 模 式 NTP 广 播 客 户 端 与 NTP 广 播 服 务 器 进 行 时 间 同 步 前, 必 须 先 进 行 身 份 验 证, 以 保 证 时 钟 同 步 的 安 全 性, 防 止 攻 击 者 将 自 己 伪 装 成 为 一 个 时 钟 服 务 器 而 对 客 户 时 钟 发 起 攻 击 图 8 带 身 份 验 证 的 NTP 广 播 模 式 典 型 配 置 举 例 组 网 图 10-22
10.2 使 用 版 本 本 举 例 是 在 S5130EI_E-CMW710-R3106 版 本 上 进 行 配 置 和 验 证 的 10.3 配 置 步 骤 10.3.1 Device C 的 配 置 开 启 NTP 功 能 <DeviceC> system-view [DeviceC] 设 置 本 地 时 钟 作 为 参 考 时 钟, 层 数 为 2 [DeviceC] ntp-service refclock-master 2 配 置 NTP 验 证, 密 钥 编 号 为 88, 密 钥 为 123456 [DeviceC] ntp-service authentication enable [DeviceC] ntp-service authentication-keyid 88 authentication-mode md5 simple 123456 [DeviceC] ntp-service reliable authentication-keyid 88 设 置 Device C 为 NTP 广 播 服 务 器 并 指 定 密 钥 编 号 [DeviceC] interface vlan-interface 2 [DeviceC-Vlan-interface2] ip address 3.0.1.31 24 [DeviceC-Vlan-interface2] ntp-service broadcast-server authentication-keyid 88 [DeviceC-Vlan-interface2] quit 10.3.2 Device A 的 配 置 开 启 NTP 功 能 <DeviceA> system-view [DeviceA] 配 置 NTP 验 证, 密 钥 编 号 与 密 钥 与 Device C 完 全 相 同 [DeviceA] ntp-service authentication enable [DeviceA] ntp-service authentication-keyid 88 authentication-mode md5 simple 123456 [DeviceA] ntp-service reliable authentication-keyid 88 设 置 Device A 为 NTP 广 播 客 户 端 [DeviceA] interface vlan-interface 2 [DeviceA-Vlan-interface2] ntp-service broadcast-client [DeviceC-Vlan-interface2] ip address 3.0.1.33 24 [DeviceA-Vlan-interface2] quit 以 上 配 置 将 Device A 配 置 为 从 VLAN 接 口 2 监 听 广 播 报 文, 接 收 到 Device C 发 出 的 广 播 报 文 后 与 自 己 的 时 钟 进 行 同 步 除 IP 地 址 外,Device B Device D 和 Device E 与 DeviceA 的 其 他 配 置 完 全 相 同, 此 处 不 再 赘 述 10-23
10.4 验 证 配 置 以 Device A 为 例, 查 看 NTP 的 运 行 状 态 [DeviceA] display ntp-service status Clock status: synchronized Clock stratum: 3 System peer: 3.0.1.31 Local mode: bclient Reference clock ID: 3.0.1.31 Leap indicator: 00 Clock jitter: 0.000092 s Stability: 0.000 pps Clock precision: 2^-14 Root delay: 2.42615 ms Root dispersion: 1950.98877 ms Reference time: d5eed631.2f498d71 Thu, Sep 26 2013 15:50:09.184 此 时 Device A 已 经 与 Device C 同 步, 层 数 比 Device C 的 层 数 大 1, 为 3 10.5 配 置 文 件 设 备 Device A Device B Device D 和 Device E ip address 3.0.1.33 255.255.255.0 ntp-service broadcast-client ntp-service authentication enable ntp-service authentication-keyid 88 authentication-mode md5 cipher $c$3$pu6kvps80madhm2zm CCSR07HX4qEbJhHvQ== ntp-service reliable authentication-keyid 88 设 备 Device C ip address 3.0.1.31 255.255.255.0 ntp-service broadcast-server authentication-keyid 88 ntp-service authentication enable ntp-service authentication-keyid 88 authentication-mode md5 cipher $c$3$ijuddkiqcvo+goag53 63/fz4M3dQvHo2Fw== ntp-service reliable authentication-keyid 88 ntp-service refclock-master 3 10-24
11 相 关 资 料 H3C S5130-EI 系 列 以 太 网 交 换 机 网 络 管 理 和 监 控 配 置 指 导 -Release 3106 H3C S5130-EI 系 列 以 太 网 交 换 机 网 络 管 理 和 监 控 命 令 参 考 -Release 3106 11-25