Skip to content

Commit 57ed11e

Browse files
committed
Documentation/ntpc: document DHCP NTP server support
Document that ntpc can use NTP servers learned from DHCP option 42 when DHCP client support is enabled. Signed-off-by: Jerry Ma <shichunma@bestechnic.com>
1 parent 5c9de46 commit 57ed11e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • Documentation/applications/system/ntpc

Documentation/applications/system/ntpc/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ The ntpc example:
1515

1616
- Connects to NTP servers (default: pool.ntp.org)
1717

18+
- Supports NTP server configuration learned from DHCP option 42
19+
1820
- Starts the NTP client in the background for continuous synchronization
1921

2022
- Provides commands to check status and stop the NTP client
@@ -38,12 +40,16 @@ This example requires the following NuttX configuration options:
3840

3941
Additional configuration options:
4042
- CONFIG_NETUTILS_NTPCLIENT_SERVER: NTP server hostname (default: "pool.ntp.org")
43+
- CONFIG_NETUTILS_DHCPC: Enable DHCP client support when NTP servers should be
44+
learned dynamically from DHCP option 42
4145

4246
Usage
4347
-----
4448

4549
1. Configure your NuttX build with networking support
4650
2. Ensure network connectivity is established (e.g., via NSH network commands)
51+
If DHCP provides NTP servers through option 42, ``ntpc`` can use that
52+
server list automatically.
4753
3. Build and flash the image to your target board
4854
4. Run the commands:
4955
- ``ntpcstart``, ``ntpcstop``, ``ntpcstatus``
@@ -95,6 +101,15 @@ give the proper time and date.
95101
nsh> date
96102
Fri, Sep 05 18:49:37 2025
97103

104+
DHCP-provided NTP servers
105+
-------------------------
106+
107+
When ``CONFIG_NETUTILS_DHCPC`` is enabled, the DHCP client can pass NTP
108+
server IPv4 addresses learned from DHCP option 42 to ``ntpc``.
109+
110+
This allows ``ntpc`` to run without a fixed server hostname in the
111+
configuration and to follow NTP server updates delivered by DHCP.
112+
98113
Notes
99114
-----
100115

0 commit comments

Comments
 (0)