Skip to content

Commit f28e7f5

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 f28e7f5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • Documentation/applications/system/ntpc

Documentation/applications/system/ntpc/index.rst

Lines changed: 16 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
@@ -37,13 +39,18 @@ This example requires the following NuttX configuration options:
3739
- CONFIG_SYSTEM_NTPC: Enable this example
3840

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

4247
Usage
4348
-----
4449

4550
1. Configure your NuttX build with networking support
4651
2. Ensure network connectivity is established (e.g., via NSH network commands)
52+
If DHCP provides NTP servers through option 42, ``ntpc`` can use that
53+
server list automatically.
4754
3. Build and flash the image to your target board
4855
4. Run the commands:
4956
- ``ntpcstart``, ``ntpcstop``, ``ntpcstatus``
@@ -95,6 +102,15 @@ give the proper time and date.
95102
nsh> date
96103
Fri, Sep 05 18:49:37 2025
97104

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

0 commit comments

Comments
 (0)