Join Wintertainment 2021 to share your stories, have fun, earn community badges, and more!

Time Synchronization via NTP

Last modified on December 07, 2021

Introduced in SwaggerHub On-Premise 1.19.2.

Network Time Protocol (NTP) is a common method to synchronize computer time with public time servers on the Internet. SwaggerHub On-Premise can automatically synchronize its system time by connecting to up to three NTP servers. You can use public NTP servers from pool.ntp.org, or a private NTP server in your network.

Considerations

  • NTP uses UDP port 123. Make sure this port is open in your firewall.

  • NTP servers must be directly reachable from your SwaggerHub On-Premise instance. Proxy settings are not used for NTP.

  • NTP authentication is not supported at this time.

  • You need to disable time synchronization with the host in the virtual machine settings so that it does not conflict with NTP. Refer to your hypervisor documentation for more information.

  • If you use single sign-on via SAML, make sure the identity provider’s time is also synchronized using NTP. A time mismatch between the identity provider's server and SwaggerHub On-Premise may cause issues with single sign-on.

Configure NTP servers

To enable NTP and configure NTP servers:

  1. Open the Admin Center.

  2. Select Settings on the left.

  3. Under Basic Settings, select the Set NTP check box.

  4. Select the Time Zone for your SwaggerHub On-Premise instance.

  5. In the NTP Hosts field, enter up to three NTP servers separated by spaces (not commas). For example:

    0.pool.ntp.org 1.pool.ntp.org

    You can specify either domain names or IP addresses. We recommend using multiple NTP servers for increased accuracy and reliability. When using public NTP servers, choose those that are geographically close to the physical location of your SwaggerHub On-Premise VM.

    SwaggerHub On-Premise: NTP settings
  6. Click Test NTP Hosts to verify that the specified NTP hostnames or IP addresses are valid. If an error occurs, see the Troubleshooting section below for tips.

  7. Click Save NTP.

NTP settings are applied immediately, there is no need to restart the SwaggerHub VM.



When NTP is working properly, you should see the Synced status below the Current System Time. If you see Not Synced instead, it means there is a problem with NTP configuration or network connectivity. See the Troubleshooting section below for helpful tips.

Time is synced

Correct a large time difference

NTP automatically corrects small time skews. However, if the time is too far off (for example, if the VM was paused for a while) you may need to synchronize the time manually as a one-time action.

To correct the time, connect to your SwaggerHub On-Premise instance over SSH and use the timedatectl command, like so:

timedatectl set-timezone "Europe/Berlin"
timedatectl set-time "2019-01-11 09:24:32"

See the timedatectl man page for more information about this command.

Troubleshooting

If the time status is Not Synced or if you get the "The Host string is invalid" error when testing NTP hosts, check the following:

  • Double-check that the domain names or IP addresses of the NTP servers are correct. For example, ping them.

  • Make sure your firewall allows UDP traffic from your SwaggerHub VM to the specified NTP servers on port 123. Note that NTP requires a direct connection without a proxy.

  • Make sure the NTP servers in the list are separated with spaces rather than commas.

    Correct:

    0.pool.ntp.org 1.pool.ntp.org

    Incorrect:

    0.pool.ntp.org, 1.pool.ntp.org

See Also

Configuring SwaggerHub On-Premise

Highlight search results