Internet Time Synchronization: NTP, NTS and Roughtime
How Cloudflare Time Services work, when to use NTP versus NTS or Roughtime, and how to point devices and clients at time.cloudflare.com.
This page summarizes Cloudflare’s documentation on Cloudflare Time Services: free public time over Network Time Protocol (NTP), cryptographically authenticated Network Time Security (NTS), and signed timestamps via Roughtime. It also covers firewall allowances for the Cloudflare One Client and practical setup on common operating systems.
NTP (time.cloudflare.com): what it does and when to use it
Section titled “NTP (time.cloudflare.com): what it does and when to use it”Network Time Protocol (NTP) is the usual way machines on the Internet keep clocks aligned. Cloudflare runs a free NTP service on its anycast network so clients can sync from a nearby endpoint.
Network Time Protocol (NTP) is an Internet protocol designed to synchronize time between computer systems communicating over unreliable and variable-latency network paths. Cloudflare offers its version of NTP for free so you can use our global anycast network to synchronize time from our closest server.
— Cloudflare, Network Time Protocol
NTP fits everyday OS and appliance clock sync: desktops, servers, and network gear where you need precise time and standard NTP client support. To use Cloudflare’s server, point your client at time.cloudflare.com (see the NTP user guide).
How NTP estimates the correct time
Section titled “How NTP estimates the correct time”A client sends a query; the server returns its clock time. The client estimates offset versus the remote clock and tries to compensate for network delay. Robust clients query multiple servers and run selection algorithms for the best estimate.
NTP works by having a client send a query packet out to an NTP server that then responds with its clock time. The client then computes an estimate of the difference between its clock and the remote clock and attempts to compensate for any network delay. The NTP client then queries multiple servers and implements algorithms to select the best estimate.
— Cloudflare, Network Time Protocol
Leap seconds and mixing NTP pools
Section titled “Leap seconds and mixing NTP pools”Cloudflare’s NTP does not leap-smear. Leap-second handling follows the NTP Leap Indicator and the kernel applies the correction at the appropriate time—the same behavior as servers in pool.ntp.org.
Cloudflare does not implement leap smearing: NTP includes a Leap Indicator field spec and the kernel will apply the leap second correction at the appropriate time. This is the behavior servers in pool.ntp.org share. Using servers that smear time along with servers that do not may lead to unpredictable and anomalous results.
— Cloudflare, Network Time Protocol
NTS: authenticated NTP for untrusted networks
Section titled “NTS: authenticated NTP for untrusted networks”Network Time Security (NTS) adds cryptography to classical client–server NTP so time is obtained in an authenticated manner—relevant when you cannot trust the path between client and NTP server.
Network Time Security (NTS) provides cryptographic security for the client-server mode of the Network Time Protocol (NTP). This allows users to obtain time in an authenticated manner.
— Cloudflare, Network Time Security
NTS key exchange and authenticated NTP packets
Section titled “NTS key exchange and authenticated NTP packets”NTS runs in two phases: a TLS-based key exchange (same PKI model as the web), then authenticated NTPv4 extension fields using that key material (see RFC 8915 in the NTS background).
The NTS protocol is divided into two phases:
NTS Key Exchange: Establishes the necessary key material between the NTP client and the server, using a Transport Layer Security (TLS) handshake (the same public key infrastructure as the web). Once the keys are exchanged, the TLS channel is closed and the protocol enters the second phase. NTS Extension Fields for NTPv4: Authenticates NTP time synchronization packets using previously established key material.
— Cloudflare, Network Time Security
Use NTS when your threat model includes bogus or manipulated NTP replies on the network path. Cloudflare documents aiming NTS-capable clients (for example Chrony, NTPsec, and ntpd-rs) at time.cloudflare.com in the NTS next steps.
Roughtime: signed time when precision below ~10 seconds is enough
Section titled “Roughtime: signed time when precision below ~10 seconds is enough”Roughtime is a simple, flexible, authenticated time protocol (developed by Google). Cloudflare hosts a public Roughtime service and documents clients and recipes.
Roughtime is a simple, flexible, and secure authenticated time protocol developed by Google.
— Cloudflare, Roughtime
Why authenticated time matters for TLS and certificates
Section titled “Why authenticated time matters for TLS and certificates”Classic NTP is often deployed without authentication, which leaves room for man-in-the-middle clock manipulation—for example shifting a victim backward so an expired TLS certificate or session ticket might still validate.
As a result, a man-in-the-middle attacker can easily influence a victim’s clock. By moving them back in time, the attacker can, for example, force a victim to accept an expired (and possibly compromised) TLS certificate or session ticket.
— Cloudflare, Roughtime
For many workloads, rough accuracy (on the order of tens of seconds) is enough to block those attacks. That trade-off motivates Roughtime versus fine-grained NTP sync.
For many applications, precise network time is not essential. It is sufficient to have accurate time to mitigate these kinds of attacks, such as within 10 seconds of real time. This observation is the primary motivation behind Roughtime.
— Cloudflare, Roughtime
| Goal | Typical choice | Cloudflare endpoint (from docs) |
|---|---|---|
| Precise OS clock sync | NTP (optionally NTS) | time.cloudflare.com (UDP 123 for NTP) |
| Authenticated NTP on the wire | NTS | time.cloudflare.com with an NTS-capable client |
| Signed timestamps; TLS skew checks; auditing | Roughtime | roughtime.cloudflare.com:2003 (UDP) |
Configure NTP on devices: time.cloudflare.com
Section titled “Configure NTP on devices: time.cloudflare.com”The NTP user guide states the core step: change device time settings to use time.cloudflare.com.
To use our NTP server, change the time configuration in your device to point to time.cloudflare.com.
— Cloudflare, User Guide
macOS and Windows Internet time
Section titled “macOS and Windows Internet time”On macOS: System Settings → General → Date & Time → enable automatic date and time → set the source to time.cloudflare.com.
On Windows: Control Panel → Clock and Region → Date and Time → Internet Time → change settings → set Server to time.cloudflare.com and click Update now.
Details and screenshots are in the macOS and Windows sections of the user guide.
Linux: pool.ntp.org, chrony, systemd-timesyncd, and ntpd
Section titled “Linux: pool.ntp.org, chrony, systemd-timesyncd, and ntpd”Several addresses in the Linux section are Cloudflare time servers used within pool.ntp.org; if you already sync from those pool members, you may already be on Cloudflare’s service.
To pin Cloudflare explicitly, configure your distribution’s NTP client—for example:
- chrony:
server time.cloudflare.com iburstin/etc/chrony/chrony.conf, then restartchronyd. - systemd-timesyncd:
NTP=time.cloudflare.comunder[Time]in/etc/systemd/timesyncd.conf, then restartsystemd-timesyncd. - ntpd:
server time.cloudflare.com iburstin/etc/ntp.conf, then restartntpd.
Exact paths and commands are in the chrony, systemd-timesyncd, and ntpd sections of the user guide.
Roughtime endpoints, keys, and client checks
Section titled “Roughtime endpoints, keys, and client checks”A minimal Roughtime exchange is UDP: the client requests a timestamp; the server returns a signed response. You need the server address and root public key (Get the Roughtime).
Current documented server (cluster material):
- Address:
roughtime.cloudflare.com:2003(IPv4 or IPv6) - Public key:
0GD7c3yP8xEc4Zl2zeuN2SlLvDVVocjsPSL8/Rl/7zg=
Quick connectivity test with Cloudflare’s Go client:
go install github.com/cloudflare/roughtime/cmd/getroughtime@latestgetroughtime -ping roughtime.cloudflare.com:2003 -pubkey 0GD7c3yP8xEc4Zl2zeuN2SlLvDVVocjsPSL8/Rl/7zg=Deprecated Roughtime server and rotation
Section titled “Deprecated Roughtime server and rotation”After a published deprecation date, the port and public key for that endpoint are retired. The cluster lists roughtime.cloudflare.com:2002 with deprecation 2024-06-30 (Server Deprecation). Use current servers from Get the Roughtime and Use Roughtime, not retired endpoints.
JSON server config, TLS time callbacks, and multiple servers
Section titled “JSON server config, TLS time callbacks, and multiple servers”The Use Roughtime guide describes a JSON servers list: each entry names the server, publicKeyType (currently ed25519), root publicKey, and UDP addresses. The root key signs a delegation to an online key pair that signs each response—similar in role to an X.509 certificate chain on the web.
Practical patterns from the recipes:
- TLS validation: load config with
roughtime.LoadConfig, callroughtime.Get, then setcrypto/tls’s time callback usingrt.Now()and the delta from localtime.Now()so certificate and session-ticket checks use Roughtime-backed time. - Skew alerts: compare offset; notify if skew exceeds a threshold (example uses 10 seconds on Ubuntu with
notify-send, suitable for cron). - Multiple sources:
roughtime.Doqueries a sequence of servers;roughtime.MedianDeltaWithRadiusThreshcan reject responses whose uncertainty radius exceeds 10 seconds. - Auditing:
roughtime.NewChainandchain.Verifycheck that chained nonces prove queries ran in order (Auditing Your Sources).
Implementations besides Go are noted on the recipes page (C++, Rust, Java).
Firewall rules: NTP for Cloudflare One Client logs
Section titled “Firewall rules: NTP for Cloudflare One Client logs”The Cloudflare One Client firewall page covers optional NTP (UDP 123) to time.cloudflare.com (Cloudflare Time Service). Sync is not strictly required for the client to operate, but without a firewall allow rule you may see errors in Cloudflare logs.
The Cloudflare One Client attempts to synchronize the exact time by NTP (UDP 123) to Cloudflare’s Time Service via time.cloudflare.com. This is not technically required to operate but will result in errors in our logs if not excluded properly.
— Cloudflare, Cloudflare One Client with firewall
Allow UDP 123 outbound to time.cloudflare.com on managed devices when you want clean telemetry and optional clock sync for the One Client deployment.
Terms of use and common mistakes
Section titled “Terms of use and common mistakes”Using Cloudflare Time Services accepts the Website and Online Services Terms of Use linked from Terms of use.
Common mistakes
- Mixing leap-smearing and non-smearing NTP sources on one host.
- Expecting unauthenticated NTP alone to resist active network attackers; use NTS or Roughtime where the docs describe authentication.
- Pinning an deprecated Roughtime port or public key after its deprecation date.
- Blocking UDP 123 on fleets running Cloudflare One Client, causing avoidable log noise.
- Using a stale Roughtime root key while the service remains in beta—refresh from DNS or current documentation.
How to check this on your site
Section titled “How to check this on your site”-
Confirm the device or VM uses
time.cloudflare.com: follow the checks in the NTP user guide for your OS (macOS Date & Time, Windows Internet Time, or Linux client status commands for chrony,systemd-timesyncd, orntpd). -
If you use NTS, verify your client is configured for
time.cloudflare.comper the Network Time Security next-steps guidance and that sync succeeds without authentication errors. -
For Roughtime, run
getroughtimeagainstroughtime.cloudflare.com:2003with the current public key from Get the Roughtime; confirm you are not still pointed at deprecated:2002(Server Deprecation). -
On networks with egress filters, confirm UDP 123 to
time.cloudflare.comis allowed where the Cloudflare One Client firewall documentation applies. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about so it can be corrected or explained.