Skip to content

NTP

sing-box ships an embedded NTP client. The ntp block enables it, sets how often to query the upstream server, and optionally writes the result back to the system clock. The server and its dialer come from the embedded ServerOptions and DialerOptions blocks, so all the normal outbound knobs (binding interface, routing mark, detour, etc.) are available.

Direct options

FieldTypeDefaultAllowed valuesDescription
enabledboolfalsetrue | falseRun the embedded NTP client. When false the rest of the block is ignored.
intervalbadoption.Duration30m<duration>Time between NTP queries. Accepts strings like "5m", "30m", "1h".
write_to_systemboolfalsetrue | falseAfter each successful sync, push the time to the operating-system clock. Requires elevated privileges.

Source: option/ntp.go:5-11 · pinned at v1.13.11 (553cfa1)

Inherited from ServerOptions

KeyTypeDescription
serverstringNTP server host name or IP.
server_portuint16NTP server port (123 unless your provider is unusual).

Inherited from DialerOptions

DialerOptions is the full outbound-dial knob set (option/outbound.go:67). Common fields used with NTP: bind_interface, routing_mark, reuse_addr, tcp_fast_open, detour. The complete option set is documented on the Outbounds page in Phase 3.

Example

json
{
  "ntp": {
    "enabled": true,
    "server": "time.cloudflare.com",
    "server_port": 123,
    "interval": "30m",
    "write_to_system": false,
    "detour": "direct"
  }
}

Notes

  • The default factory uses time.cloudflare.com if server is left empty, but writing it explicitly is recommended.
  • write_to_system typically needs root on Linux / Administrator on Windows. If the OS clock cannot be updated, sing-box still uses the synced time internally for TLS clock-skew tolerance.

Source: option/ntp.go:5-11 · v1.13.11 (553cfa1)

Core Tutorial by Argsment