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.14.2 (af6e64c)

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 detour plus the shared dial-field set AbstractDialerOptions (option/outbound.go:80-112). 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.

Example ​

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

Notes ​

  • server is documented upstream as required; if it is left empty the underlying NTP client falls back to time.apple.com. 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.14.2 (af6e64c)

Core Tutorial by Argsment