IBM Cloud Docs
カスタム Network Time Protocol (NTP) サーバーの指定

カスタム Network Time Protocol (NTP) サーバーの指定

時間を保持することは、すべてのシステムの不可欠な部分です。 Red Hat Network Time Protocol(NTP)サーバー へのアクセスを許可することも、カスタム Network Time Protocol (NTP) サーバーへのアクセスを構成することもできます。

Red Hat CoreOS ホスト用のカスタム NTP サーバーのみを指定できます。

未接続ホストのカスタム NTP サーバーの指定

ロケーションに接続する前にカスタム NTP サーバーを使用するようにホストを構成するには、ホスト・スクリプトを編集して、カスタム NTP サーバー情報を組み込みます。 この例では、 chrony NTP サーバーを使用します。

  1. 以下の例のような chrony.conf ファイルを作成します。

    pool time.adn.networklayer.com iburst
    
    server time.adn.networklayer.com iburst minpoll 3 maxpoll 4
    
    # Record the rate at which the system clock gains/losses time.
    driftfile /var/lib/chrony/drift
    
    # Allow the system clock to be stepped in the first three updates
    # if its offset is larger than 1 second.
    makestep 1.0 3
    
    # Enable kernel synchronization of the real-time clock (RTC).
    rtcsync
    
    # Specify file containing keys for NTP authentication.
    keyfile /etc/chrony.keys
    
    # Get TAI-UTC offset and leap seconds from the system tz database.
    leapsectz right/UTC
    
    # Specify directory for log files.
    logdir /var/log/chrony
    
  2. コンテンツを base64に変換します。

    cat chrony.conf | base64
    
  3. 自分のロケーションの添付スクリプトをダウンロードします。 RHCOS ホストの場合、接続スクリプトは点火 (.ign) スクリプトです。

    ibmcloud sat host attach --location LOCATION --operating-system RHCOS
    
  4. スクリプトを編集して、 storage.files 配列にエントリーを追加します。ここで、 BASE64_ENCODED_CHRONY_FILE_DATA はステップ 2 の base 64 ストリングです。

    {
      "overwrite": true,
      "path": "/etc/chrony.conf",
      "contents": {
        "source":"data:text/plain;base64,BASE64_ENCODED_CHRONY_FILE_DATA"
        },
        "mode": 420
     }
    
  5. スクリプトを保存します。

  6. スクリプトを検証します。

    cat IGNITION_FILE_PATH | jq -r
    

スクリプトが検証されたら、ロケーションに ホストを接続 できます。

接続されたホストのカスタム NTP の指定

ホストがロケーションに接続された後で、ホスト用にカスタム NTP サーバーを構成することができます。

  1. 以下の例のような chrony.conf ファイルを作成します。

    pool time.adn.networklayer.com iburst
    
    server time.adn.networklayer.com iburst minpoll 3 maxpoll 4
    
    # Record the rate at which the system clock gains/losses time.
    driftfile /var/lib/chrony/drift
    
    # Allow the system clock to be stepped in the first three updates
    # if its offset is larger than 1 second.
    makestep 1.0 3
    
    # Enable kernel synchronization of the real-time clock (RTC).
    rtcsync
    
    # Specify file containing keys for NTP authentication.
    keyfile /etc/chrony.keys
    
    # Get TAI-UTC offset and leap seconds from the system tz database.
    leapsectz right/UTC
    
    # Specify directory for log files.
    logdir /var/log/chrony
    
  2. ホスト・システムにログインします。

  3. そのホストの chrony.conf ファイルを更新します。ここで、 CHRONY_FILE_DATA はステップ 1 で作成したファイルの名前です。 このファイルを base64に変換しないでください。

    cat >"/etc/chrony.conf" <<EOF
    CHRONY_FILE_DATA
    EOF
    systemctl restart chronyd
    

chrony.conf ファイルを更新した後、ホストはカスタム NTP サーバーを使用します。