Loading

All articles

Configure and Troubleshoot NTP on OpenWrt Seismic Data Loggers

Terminal with UCI commands configuring NTP time sync on an OpenWrt seismic data logger

Min

UPDATED ON

Configure and Troubleshoot NTP on OpenWrt Seismic Data Loggers

Terminal with UCI commands configuring NTP time sync on an OpenWrt seismic data logger

Engineering summary

Seven UCI commands to set pool.ntp.org servers on an OpenWrt data logger, a manual ntpd -q sync procedure, and fixes for the 'ntpd: bad address' DNS failure.

In short: To configure NTP on OpenWrt seismic data loggers, SSH in as root, add servers with uci add_list system.ntp.server='0.lede.pool.ntp.org' (repeat for 1 to 3), run uci commit system, restart with /etc/init.d/sysntpd restart, confirm with date, and enable at boot with /etc/init.d/sysntpd enable. For a one-off sync, stop sysntpd and run ntpd -q -p 0.lede.pool.ntp.org. If ntpd reports 'bad address', fix DNS or sync by IP.


1. SSH into Your OpenWrt Device

Open a terminal and SSH into your OpenWrt device:

ssh root@<your_openwrt_device_ip>

2. Verify NTP Configuration

Check the current NTP configuration:

uci show | grep ntp

3. Add NTP Servers to UCI Configuration

Add the NTP servers to the UCI system configuration:

uci add_list system.ntp.server='0.lede.pool.ntp.org'
uci add_list system.ntp.server='1.lede.pool.ntp.org'
uci add_list system.ntp.server='2.lede.pool.ntp.org'
uci add_list system.ntp.server='3.lede.pool.ntp.org'

4. Commit the Changes

Apply the changes to the configuration:

uci commit system

5. Restart the NTP Service

Restart the NTP service to apply the new configuration:

/etc/init.d/sysntpd restart

6. Verify Time Synchronization

Check the current date and time settings to ensure synchronization is working:

date

7. Ensure NTP Service Starts on Boot

Enable the NTP service to start on boot:

/etc/init.d/sysntpd enable

By following these steps, your OpenWrt device will be configured to use the specified NTP servers, and the system time will be synchronized correctly.


Manually Sync Time with an NTP Server

1. SSH into Your OpenWrt Device

Open a terminal and SSH into your OpenWrt device:

ssh root@<your_openwrt_device_ip>

2. Stop the NTP Service

Stop the NTP service to avoid conflicts:

/etc/init.d/sysntpd stop

3. Manually Sync Time with an NTP Server

Use the ntpd command to manually sync the time with an NTP server:

ntpd -q -p 0.lede.pool.ntp.org

The -q option tells ntpd to set the time and quit, and the -p option specifies the NTP server.

4. Start the NTP Service Again

Start the NTP service to resume automatic synchronization:

/etc/init.d/sysntpd start

5. Verify Time Synchronization

Check the current date and time to ensure it has been updated correctly:

date

By following these steps, you can manually sync the time on your OpenWrt device with a specific NTP server.


Troubleshooting “ntpd: bad address ‘0.lede.pool.ntp.org'”

1. Check DNS Configuration

Ensure your OpenWrt device can resolve domain names correctly:

ping google.com

If this fails, you might need to configure your DNS settings manually in the /etc/config/network file:

uci set network.wan.dns='8.8.8.8 8.8.4.4'
uci commit network
/etc/init.d/network restart

2. Verify NTP Package Installation

Ensure that the ntpd package is installed:

opkg update
opkg install ntpd

3. Manually Sync Time Using ntpd with IP Address

If DNS issues persist, use the IP address of the NTP server instead of the hostname:

ntpd -q -p 162.159.200.123

4. Ensure NTP Servers Are Correctly Configured in UCI

Check and reconfigure the NTP servers if necessary:

uci show system.ntp
uci delete system.ntp.server
uci add_list system.ntp.server='0.lede.pool.ntp.org'
uci add_list system.ntp.server='1.lede.pool.ntp.org'
uci add_list system.ntp.server='2.lede.pool.ntp.org'
uci add_list system.ntp.server='3.lede.pool.ntp.org'
uci commit system

5. Restart the NTP Service

Restart the NTP service to apply the changes:

/etc/init.d/sysntpd restart

By following these steps, you should be able to resolve the “ntpd: bad address ‘0.lede.pool.ntp.org'” error and ensure your OpenWrt device can correctly sync time with the NTP servers.


By following these organized steps, you should be able to configure, manually sync, and troubleshoot NTP settings on your OpenWrt device effectively.

For questions, reach us at support@quakelogic.net. Our working hours are 8 AM to 5 PM Pacific Time (M-F).

Key Takeaways

  • Add servers with uci add_list system.ntp.server='0.lede.pool.ntp.org' through 3.lede.pool.ntp.org, then uci commit system.
  • Restart with /etc/init.d/sysntpd restart and enable at boot with /etc/init.d/sysntpd enable.
  • Manual sync: stop sysntpd, run ntpd -q -p <server> (set time and quit), then start sysntpd again.
  • 'ntpd: bad address' usually means DNS failure; test with ping google.com and set DNS via uci set network.wan.dns.
  • If DNS stays broken, sync against an IP address such as ntpd -q -p 162.159.200.123.

Frequently Asked Questions

How do I configure NTP servers on OpenWrt using UCI?

SSH into the device as root, check the current settings with uci show | grep ntp, then add servers with uci add_list system.ntp.server='0.lede.pool.ntp.org' and repeat for 1, 2 and 3.lede.pool.ntp.org. Save with uci commit system, restart the daemon with /etc/init.d/sysntpd restart, verify with date, and make it persistent across reboots with /etc/init.d/sysntpd enable. The logger will then keep time from the configured pool.

How do I manually sync time on OpenWrt with ntpd?

Stop the running service first to avoid conflicts with /etc/init.d/sysntpd stop, then run ntpd -q -p 0.lede.pool.ntp.org. The -q flag tells ntpd to set the clock once and quit, and -p names the server. Confirm the new time with date, then restart automatic synchronization with /etc/init.d/sysntpd start. This is useful after a long power outage when the clock is far off.

What causes the 'ntpd: bad address 0.lede.pool.ntp.org' error on OpenWrt?

The error means the device cannot resolve the NTP server hostname, almost always a DNS problem. Test with ping google.com; if that fails, set DNS manually with uci set network.wan.dns='8.8.8.8 8.8.4.4', uci commit network and /etc/init.d/network restart. Also confirm the package is installed (opkg update, opkg install ntpd) and that the server list in uci show system.ntp is correct. As a workaround, sync by IP: ntpd -q -p 162.159.200.123.

How do I check that NTP is working on an OpenWrt device?

Run date and confirm the reported time and date match a trusted clock; a wrong year or epoch time means synchronization has not happened. Inspect the configured servers with uci show system.ntp, and make sure the service is enabled at boot with /etc/init.d/sysntpd enable. If the time is stale, restart the daemon with /etc/init.d/sysntpd restart or force an immediate update with ntpd -q -p <server>.

Why does accurate NTP time matter on a seismic data logger?

Seismic analysis depends on comparing arrival times across stations: locating an event, measuring phase arrivals and aligning channels all assume every logger stamps samples with the same reference time. A logger with a drifting or unset clock produces records that cannot be correlated with the rest of the network. Keeping NTP configured, persistent across reboots and resolvable through DNS ensures a Linux-based logger stays within acceptable timing error.

Need help with a project? QuakeLogic designs and supplies seismic monitoring, earthquake early warning, structural health monitoring, infrasound, and shake table systems. Browse QuakeLogic products or contact our engineering team with your site, structure, or test requirements.


Discover more from QuakeLogic

Subscribe to get the latest posts sent to your email.

Reviewed by

QuakeLogic

Published by QuakeLogic engineers and seismic monitoring specialists. QuakeLogic designs earthquake early warning, structural health monitoring, infrasound, vibration monitoring, and shake table testing systems for infrastructure, research, public safety, and industrial engineering teams.

Topic cluster

Related engineering knowledge areas

Definitions and references

Terms, standards, and source cues

  • seismic hazard: related to Earthquake Engineering in this QuakeLogic knowledge cluster.
  • ground motion: related to Earthquake Engineering in this QuakeLogic knowledge cluster.
  • SHM: related to Structural Health Monitoring in this QuakeLogic knowledge cluster.
  • damage detection: related to Structural Health Monitoring in this QuakeLogic knowledge cluster.
  • earthquake early warning: related to Earthquake Early Warning in this QuakeLogic knowledge cluster.
  • seismic switch: related to Earthquake Early Warning in this QuakeLogic knowledge cluster.
  • seismometers: related to Seismic Sensors in this QuakeLogic knowledge cluster.
  • accelerometers: related to Seismic Sensors in this QuakeLogic knowledge cluster.

Standards mentioned

  • ASCE 7 seismic design/site-classification references

Need project support?

Talk with QuakeLogic about monitoring, testing, or warning systems.

Get engineering guidance for seismic monitoring, structural health monitoring, infrasound, vibration, earthquake early warning, and shake table applications.

Contact QuakeLogic

Author

SUBSCRIBE TO OUR NEWSLETTER

By subscribing to the newsletter, you agree to receive marketing emails from Quakelogic.

2008 Opportunity Dr. Suite 130,
Roseville, CA 95678, USA

Discover more from QuakeLogic

Subscribe now to keep reading and get access to the full archive.

Continue reading