copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2024-01-03 |
satellite, hybrid, multicloud, ntp, custom ntp, network time protocol |
satellite |
{{site.data.keyword.attribute-definition-list}}
{: #config-custom-ntp}
Keeping time is an integral part of any system. You can choose to allow access to the Red Hat network time protocol (NTP) servers or you can configure access to a custom Network Time Protocol (NTP) server. {: shortdesc}
You can specify a custom NTP server for Red Hat CoreOS hosts only. {: note}
{: #custom-ntp-config}
To configure your hosts to use a custom NTP server before you attach them to a location, edit the host script to include your custom NTP server information. This example uses a chrony
NTP server.
-
Create a
chrony.conf
file similar to the following example.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
{: codeblock}
-
Convert the content to base64.
cat chrony.conf | base64
{: pre}
-
Download the attach script for your location. For RHCOS hosts, the attach script is an ignition (.ign) script.
ibmcloud sat host attach --location LOCATION --operating-system RHCOS
{: pre}
-
Edit the script and add an entry to the
storage.files
array, whereBASE64_ENCODED_CHRONY_FILE_DATA
is the base 64 string from step 2.{ "overwrite": true, "path": "/etc/chrony.conf", "contents": { "source":"data:text/plain;base64,BASE64_ENCODED_CHRONY_FILE_DATA" }, "mode": 420 }
{: codeblock}
-
Save the script.
-
Validate the script.
cat IGNITION_FILE_PATH | jq -r
{: pre}
After your script is validated, you can attach the hosts to your location.
{: #custom-ntp-attached-host}
You can configure a custom NTP server for your hosts after they are attached to the location. {: shortdesc}
-
Create a
chrony.conf
file similar to the following example.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
{: codeblock}
-
Log in to the host system.
-
Update the
chrony.conf
file for that host, whereCHRONY_FILE_DATA
is the name of the file you created in step 1. Do not convert this file into base64.cat >"/etc/chrony.conf" <<EOF CHRONY_FILE_DATA EOF systemctl restart chronyd
{: pre}
After you update the chrony.conf
file, your host uses your custom NTP server.