NTP Server¶
The NTP (Network Time Protocol) server provides accurate time synchronization for network clients. It supports both standalone operation with a local reference clock and hybrid mode where it synchronizes with upstream servers while serving time to downstream clients.
Note
The NTP server is mutually exclusive with the NTP client in system configuration context.
Standalone Mode¶
Configure a standalone NTP server using only a local reference clock:
admin@example:/> configure
admin@example:/config/> edit ntp
admin@example:/config/ntp/> leave
When setting up NTP via the CLI the system automatically configures a local reference clock. The default stratum is 16 (unsynchronized), which is suitable for isolated networks. For production use, configure a specific stratum level:
admin@example:/config/> edit ntp
admin@example:/config/ntp/> set refclock-master master-stratum 10
admin@example:/config/ntp/> leave
GPS Reference Clock¶
A GPS/GNSS receiver can be used as an NTP reference clock source, providing stratum 1 time derived from the GPS satellite constellation. This requires a GPS hardware component to be configured first, see Hardware — GPS/GNSS Receivers.
Basic setup¶
Add a GPS receiver as a reference clock source:
admin@example:/config/> edit ntp
admin@example:/config/ntp/> edit refclock-master source gps0
admin@example:/config/ntp/refclock-master/source/gps0/> set poll 2
admin@example:/config/ntp/refclock-master/source/gps0/> set precision 0.1
admin@example:/config/ntp/refclock-master/source/gps0/> end
admin@example:/config/ntp/> leave
Tunable parameters:
| Parameter | Default | Description |
|---|---|---|
poll |
2 |
Polling interval in log2 seconds (2 = 4s) |
precision |
0.1 |
Assumed precision in seconds (0.1 = 100ms) |
refid |
"GPS" |
Reference identifier (e.g., GPS, GNSS, GLO) |
prefer |
false |
Prefer this source over other reference clocks |
pps |
false |
Enable PPS for microsecond-level accuracy |
offset |
0.0 |
Constant offset correction in seconds |
delay |
0.0 |
Assumed maximum delay from the receiver |
PPS (Pulse Per Second)¶
When the GPS receiver provides a PPS signal, enable the pps option for
microsecond-level accuracy. With PPS, the GPS time provides the initial
lock and the PPS edges discipline the clock:
admin@example:/config/ntp/> edit refclock-master source gps0
admin@example:/config/ntp/refclock-master/source/gps0/> set pps true
admin@example:/config/ntp/refclock-master/source/gps0/> set precision 0.000001
admin@example:/config/ntp/refclock-master/source/gps0/> end
admin@example:/config/ntp/> leave
Monitoring¶
The show ntp command shows the GPS receiver as the reference clock source:
admin@example:/> show ntp
Mode : Server (GPS reference clock: gps0)
Port : 123
Stratum : 1
Ref time (UTC) : Sun Feb 08 19:44:36 2026
Use show ntp source to see GPS reference clock details:
admin@example:/> show ntp source
Reference Clock : gps0 (u-blox)
Status : selected
Fix Mode : 3D
Satellites : 9/17 (used/visible)
Server Mode¶
Synchronize from upstream NTP servers while serving time to clients:
admin@example:/config/> edit ntp
admin@example:/config/ntp/> edit unicast-configuration 0.pool.ntp.org type uc-server
admin@example:/config/ntp/…/0.pool.ntp.org/type/uc-server/> set iburst true
admin@example:/config/ntp/…/0.pool.ntp.org/type/uc-server/> end
admin@example:/config/ntp/> edit unicast-configuration 1.pool.ntp.org type uc-server
admin@example:/config/ntp/…/1.pool.ntp.org/type/uc-server/> set iburst true
admin@example:/config/ntp/…/1.pool.ntp.org/type/uc-server/> end
admin@example:/config/ntp/> leave
The unicast-configuration uses a composite key with both address and type.
Both hostnames and IP addresses are supported. The iburst option enables
fast initial synchronization.
Peer Mode¶
In peer mode, two NTP servers synchronize with each other bidirectionally. Each server acts as both client and server to the other:
First peer:
admin@peer1:/config/> edit ntp
admin@peer1:/config/ntp/> edit unicast-configuration 192.168.1.2 type uc-peer
admin@peer1:/config/ntp/…/192.168.1.2/type/uc-peer/> end
admin@peer1:/config/ntp/> set refclock-master master-stratum 8
admin@peer1:/config/ntp/> leave
Second peer:
admin@peer2:/config/> edit ntp
admin@peer2:/config/ntp/> edit unicast-configuration 192.168.1.1 type uc-peer
admin@peer2:/config/ntp/…/192.168.1.1/type/uc-peer/> end
admin@peer2:/config/ntp/> set refclock-master master-stratum 8
admin@peer2:/config/ntp/> leave
This configuration provides mutual synchronization between peers. If one peer fails, the other continues to serve time to clients.
Note
The iburst and burst options are not supported in peer mode.
Peer Selection in Symmetric Mode¶
When both peers have the same stratum (as in the example above where both are stratum 8), NTP's clock selection algorithm uses the Reference ID as the tie-breaker. The Reference ID is typically derived from the peer's IP address when using a local reference clock.
This means the peer with the numerically lower IP address will be selected as the sync source by the other peer. In the example above:
- peer1 (192.168.1.1) has a lower Reference ID
- peer2 (192.168.1.2) will select peer1 as sync source
This behavior is deterministic and ensures stable clock selection. If you need a specific peer to be selected, configure it with a lower stratum level than the other peer.
Timing Configuration¶
Poll Intervals¶
Control how often the NTP server polls upstream sources:
admin@example:/config/ntp/> edit unicast-configuration 0.pool.ntp.org type uc-server
admin@example:/config/ntp/…/0.pool.ntp.org/type/uc-server/> set minpoll 4
admin@example:/config/ntp/…/0.pool.ntp.org/type/uc-server/> set maxpoll 10
admin@example:/config/ntp/…/0.pool.ntp.org/type/uc-server/> end
Poll intervals are specified as powers of 2:
- minpoll 4 = poll every 2^4 = 16 seconds (minimum polling rate)
- maxpoll 10 = poll every 2^10 = 1024 seconds (maximum polling rate)
- Defaults: minpoll 6 (64 seconds), maxpoll 10 (1024 seconds)
Use shorter intervals (minpoll 2-4) for faster convergence in test environments or peer configurations. Use defaults for production servers.
Fast Initial Synchronization¶
The makestep directive is automatically configured with safe defaults (1.0
seconds threshold, 3 updates limit) when creating an NTP server. This is
critical for embedded systems without RTC that boot with epoch time.
To customize the values:
admin@example:/config/ntp/> edit makestep
admin@example:/config/ntp/makestep/> set threshold 2.0
admin@example:/config/ntp/makestep/> set limit 1
admin@example:/config/ntp/makestep/> end
- threshold - If clock offset exceeds this (in seconds), step immediately instead of slewing slowly
- limit - Number of updates during which stepping is allowed. After this, only gradual slewing is used for security
With these defaults, a device booting at epoch time (1970-01-01) will sync to correct time within seconds instead of hours.
Monitoring¶
For a quick overview:
To view the sources being used by the NTP client, run:
admin@example:/> show ntp
Mode : Client
Stratum : 3
Ref time (UTC) : Sat Jan 24 23:41:42 2026
ADDRESS MODE STATE STRATUM POLL
147.78.228.41 server outlier 2 64s
192.168.0.1 server unusable 0 128s
176.126.86.247 server selected 2 64s
Check NTP source status:
admin@example:/> show ntp source
MS Name/IP address Stratum Poll Reach LastRx Last sample
^+ 147.78.228.41 2 6 007 15 -431us +/- 33.573ms
^* 176.126.86.247 2 6 007 14 -389us +/- 4.307ms
For detailed information about a specific source:
admin@example:/> show ntp source 176.126.86.247
Address : 176.126.86.247
Mode : Server (client mode) [^]
State : Selected sync source [*]
Configured : Yes
Stratum : 2
Poll interval : 7 (2^7 seconds = 128s)
Reachability : 377 (octal) = 11111111b
Last RX : 75s ago
Offset : +2.0us (+0.002000ms)
Delay : 4.270ms (0.004270s)
Dispersion : 205.0us (0.205000ms)
NTP Stratum Levels¶
NTP uses a hierarchical system called stratum to indicate distance from authoritative time sources:
- Stratum 0: Reference clocks (atomic clocks)
- Stratum 1: Servers directly connected to stratum 0 (e.g., GPS receivers)
- Stratum 2-15: Servers that sync from lower stratum (each hop adds one)
- Stratum 16: Unsynchronized (invalid)
The default stratum (16) is not suitable for distributing time in isolated
networks, so when setting up an NTP server remember to adjust this value.
Use, e.g., 10, this is a safe, low-priority value that ensures clients will
prefer upstream-synchronized servers (stratum 1-9) while still having a
fallback time source in isolated networks.