28.2. Configuring time synchronization over NTP with NTS by using the timesync RHEL system role


By using the Network Time Security (NTS) mechanism, clients establish a TLS-encrypted connection to the server and authenticate Network Time Protocol (NTP) packets. By using the timesync RHEL system role, you can automate the configuration of RHEL NTP clients with NTS.

Note that you cannot mix NTS servers with non-NTS servers. In mixed configurations, NTS servers are trusted and clients do not fall back to unauthenticated NTP sources because they can be exploited in man-in-the-middle (MITM) attacks. For further details, see the authselectmode parameter description in the chrony.conf(5) man page on your system.

警告

The timesync RHEL system role replaces the configuration of the specified given or detected provider service on the managed host. Consequently, all settings are lost if they are not specified in the playbook.

Prerequisites

Procedure

  1. Create a playbook file, for example, ~/playbook.yml, with the following content:

    ---
    - name: Managing time synchronization
      hosts: managed-node-01.example.com
      tasks:
        - name: Configuring NTP with NTS-enabled servers
          ansible.builtin.include_role:
            name: redhat.rhel_system_roles.timesync
          vars:
            timesync_ntp_servers:
            - hostname: ptbtime1.ptb.de
              nts: yes
              iburst: yes

    The settings specified in the example playbook include the following:

    iburst: yes
    Enables fast initial synchronization.

    For details about all variables used in the playbook, see the /usr/share/ansible/roles/rhel-system-roles.timesync/README.md file on the control node.

  2. Validate the playbook syntax:

    $ ansible-playbook --syntax-check ~/playbook.yml

    Note that this command only validates the syntax and does not protect against a wrong but valid configuration.

  3. Run the playbook:

    $ ansible-playbook ~/playbook.yml

Verification

  • If the managed node runs the chronyd service:

    1. Display the details about the time sources:

      # ansible managed-node-01.example.com -m command -a 'chronyc sources'
      MS Name/IP address         Stratum Poll Reach LastRx Last sample
      ===============================================================================
      ^* ptbtime1.ptb.de               1   6    17    55    -13us[  -54us] +/-   12ms
      ^- ptbtime2.ptb.de               1   6    17    56   -257us[ -297us] +/-   12ms
    2. For sources with NTS enabled, display information that is specific to authentication of NTP sources:

      # ansible managed-node-01.example.com -m command -a 'chronyc -N authdata'
      Name/IP address             Mode KeyID Type KLen Last Atmp  NAK Cook CLen
      =========================================================================
      ptbtime1.ptb.de              NTS     1   15  256  229    0    0    8  100
      ptbtime2.ptb.de              NTS     1   15  256  230    0    0    8  100

      Verify that the reported number of cookies in the Cook column is larger than 0.

  • If the managed node runs the ntpd service, enter:

    # ansible managed-node-01.example.com -m command -a 'ntpq -p'
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    *ptbtime1.ptb.de .PTB.            1 8    2   64   77   23.585  967.902   0.684
    -ptbtime2.ptb.de .PTB.            1 8   30   64   78   24.653  993.937   0.765
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る