Technical Tip: Configuring NTP with SHA1/SHA256 authentication on FortiGate
| Description | This article describes how to configure NTP authentication on FortiGate using SHA1 and SHA256 key types in addition to the legacy MD5 option. It covers the configuration for both the global NTP settings and per-server NTP authentication, explains version-specific availability and provides troubleshooting steps. |
| Scope | FortiGate. |
| Solution | NTP authentication ensures that a FortiGate only synchronizes its clock with known and trusted NTP servers, preventing time manipulation by rogue or spoofed sources. Without authentication, an attacker could inject false time data, potentially undermining certificate validation, log correlation, and time-based security mechanisms.
FortiOS supports NTP authentication at two levels:
Important: SHA1 and SHA256 authentication require NTPv4. If set ntpv3 enable is configured on the NTP server entry, only MD5 authentication is supported. SHA1 and SHA256 will not function with NTPv3.
Step 1: Configure the upstream NTP server with SHA1 authentication. The following CLI commands configure the FortiGate to synchronize with a custom NTP server using SHA1 authentication:
The key and key-id values must match the configuration on the NTP server. The key-id is a numeric identifier that allows both sides to reference the correct shared key.
Step 2 (optional): Configure SHA256 authentication (FortiOS v7.4.4 and later). On FortiOS v7.4.4 and later, SHA256 is available as an additional option:
Step 3 (optional): Configure global NTP authentication for server-mode. If the FortiGate acts as an NTP server for other devices in the network (server-mode), the global authentication settings are configured under the top-level NTP configuration:
Downstream NTP clients connecting to the FortiGate must be configured with the same key, key-id, and key-type.
Verification: After configuring NTP authentication, verify the synchronization status using the following diagnostic command:
Expected output when authentication is working correctly:
Key indicators:
If the server shows reachable(0x00) or server-version=3, authentication is likely failing. Refer to the troubleshooting section below.
Troubleshooting: If NTP authentication is not working as expected, check the following:
When authentication is enabled, the NTP packets will contain a MAC address field at the end of the packet. If authentication fails, the NTP server will respond but the FortiGate will discard the response, resulting in reachable (0x00).
Behavioral notes across FortiOS versions.
Important: When upgrading from a version below 6.2.0 to 6.2.0 or later, existing NTP authentication configurations using MD5 will continue to work without modification. The default key-type remains MD5 if not explicitly set. No manual migration is required.
Related articles: |
