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
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
enabled | bool | false | true | false | Run the embedded NTP client. When false the rest of the block is ignored. |
interval | badoption.Duration | 30m | <duration> | Time between NTP queries. Accepts strings like "5m", "30m", "1h". |
write_to_system | bool | false | true | false | After 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
| Key | Type | Description |
|---|---|---|
server | string | NTP server host name or IP. |
server_port | uint16 | NTP 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.comifserveris left empty, but writing it explicitly is recommended. write_to_systemtypically 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)
