Cumulus Linux 上的 Chrony

在运行 Cumulus Linux 4.3.0 的基于 ARM 的平台上,您可以使用 Chrony 作为时间提供程序。

要使用 Chrony,您需要

  • 编辑 /etc/apt/sources.list 文件以允许上游存储库。
  • 使用 apt 命令行实用程序从源更新本地索引。
  • 使用 apt 命令行实用程序删除和 purge NTP。
  • 安装 Chrony。
  • 编辑系统配置以建立 Chrony 作为管理服务。
  • 向 Chrony 配置添加低延迟时间源。

NVIDIA 已使用 Netq 4.2.0 (4.2.0-cl4u38~1652820696.25f4ac06) 和 chrony_3.4-4+deb10u2_armel.deb 验证了以下步骤。

  1. 编辑 /etc/apt/sources.list 文件以允许上游存储库

    root@cumulus:mgmt:/home/cumulus# sudo vi /etc/apt/sources.list
    # Cumulus Linux package repository
    deb      http://apt.cumulusnetworks.com/repo CumulusLinux-4-latest cumulus upstream netq
    deb-src  http://apt.cumulusnetworks.com/repo CumulusLinux-4-latest cumulus upstream netq
       
    # NetQ package repository
    #
    deb  http://apps3.cumulusnetworks.com/repos/deb/ CumulusLinux-4 netq-latest
       
    # Debian 10 Buster main package repositories
    # Uncomment these if you want to install upstream Debian packages
    # that are not mirrored in the Cumulus Linux repositories.
    # Packages installed this way may cause problems, and are not
    # officially supported by Cumulus Networks, Inc.
    deb     http://deb.debian.org/debian buster main
    deb     http://deb.debian.org/debian buster-updates main
    deb     http://security.debian.org buster/updates main
    deb     http://deb.debian.org/debian buster-backports main
       
    # Debian 10 Buster main package source repositories
    # Only need to uncomment these if you want to install
    # upstream Debian source packages
    #deb-src http://deb.debian.org/debian buster main
    #deb-src http://deb.debian.org/debian buster-updates main
    #deb-src http://security.debian.org buster/updates main
    #deb-src http://deb.debian.org/debian buster-backports main
    
  2. 从源更新本地索引

    root@cumulus:mgmt:/home/cumulus# sudo -E apt-get update
    
  3. 从系统中删除和 purge NTP

    root@cumulus:mgmt:/home/cumulus# sudo -E apt-get -y purge --auto-remove ntp
    
  4. 安装 Chrony

    root@cumulus:mgmt:/home/cumulus# sudo -E apt-get -y install chrony
    
  5. 将 Chrony 添加为管理 VRF 服务到 /etc/vrf/systemd.conf 文件中的系统启动配置

    root@cumulus:mgmt:/home/cumulus# sudo vi /etc/vrf/systemd.conf
    # Systemd-based services that are expected to be run in a VRF context.
    #
    # If changes are made to this file run systemctl daemon-reload
    # to re-generate systemd files.
       
    chef-client
    collectd
    dhcpd
    dhcrelay
    docker
    hsflowd
    netq-agent
    netq-notifier
    netqd
    nslcd
    ntp
    puppet
    salt-minion
    snmpd
    snmptrapd
    ssh
    zabbix-agent
    chrony <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    
    root@cumulus:mgmt:/home/cumulus# systemctl stop chronyd
    root@cumulus:mgmt:/home/cumulus# systemctl disable chronyd
    root@cumulus:mgmt:/home/cumulus# systemctl enable chrony@mgmt
    root@cumulus:mgmt:/home/cumulus# systemctl restart chrony@mgmt
    root@cumulus:mgmt:/home/cumulus# systemctl daemon-reload
    
  6. 为了获得最佳性能,请在 /etc/chrony/chrony.conf 配置文件中添加低延迟时间源。使用 chronyc sources -v 语法来验证配置。

    root@cumulus:mgmt:/home/cumulus# chronyc sources -v
    210 Number of sources = 1
       
      .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
     / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
    | /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
    ||                                                 .- xxxx [ yyyy ] +/- zzzz
    ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
    ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
    ||                                \     |          |  zzzz = estimated error.
    ||                                 |    |           \
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* master_source.local.>     2   6    77     6  -1102us[ -108ms] +/- 2754us
    

有关 Chrony 的信息,请参阅 Chrony 项目页面