How to configure the GL.iNet router as an NTP server and redirect all LAN clients NTP request?

Hello,

This tutorial will guide you to set the router to NTP (network time synchronization) server and overwrite it to the LAN client's NTP service (Including the LAN port and WiFi clients) .

There is no need to change the NTP server configuration on all clients. As long as the client is connected to the router LAN port or main WiFi, when it needs to sync time, it will be responded by the router's NTP server and provide the time sync service.

  1. SSH to router

  2. Check whether the router system time is correct:

date

# If the time is not sync, you can trigger it manually:
/etc/init.d/sysntpd restart
  1. Enable NTP server of router:
uci set system.ntp.enable_server='1'
uci commit system
/etc/init.d/sysntpd restart
  1. Using the help of firewall rules, all NTP requests from listening to LAN clients are redirected to the NTP server of the router itself:
iptables -t nat -A PREROUTING -i br-lan -p udp --dport 123 -j DNAT --to-destination [Router LAN IP]:123

# Please use your router's actual LAN IP. 123 is a fixed NTP service port.
# For example, the router LAN IP of the NTP server is 192.168.8.1. 
iptables -t nat -A PREROUTING -i br-lan -p udp --dport 123 -j DNAT --to-destination 192.168.8.1:123
  1. Check whether the firewall rule is added and whether the port is starting to listen:
iptables -t nat -L PREROUTING -v
netstat -uln | grep 123

Bruce_2025-09-30_19-18-56

Bruce_2025-09-30_19-27-22

  1. Add the above firewall rule to /etc/rc.local, ensure the rule always takes effect after router restart:
sed -i '/^exit 0$/i iptables -t nat -A PREROUTING -i br-lan -p udp --dport 123 -j DNAT --to-destination 192.168.8.1:123' /etc/rc.local
  1. Verify whether to obtain the time information of the NTP server of the router in Windows PowerShell (Arbitrary public IP/domain)
w32tm /stripchart /computer:www.google.com /dataonly /samples:3

w32tm /stripchart /computer:123.123.123.123 /dataonly /samples:3

-end

4 Likes

Thanks! Works on my X3000. It would be nice if this was added to the firmware as on option in the gui.

1 Like

By doing this, is the iptables rule visible in Luci Network Firewall Rules?

Just checked, it doesn't appear in the firewall overview in Luci as far as I can tell.

This feature may appeal to a smaller audience.
We will continue to collect user requirements and reassess its potential at a later stage.

Thanks!

Hello! FWIW, I would like to express my interest in this feature being made easier to access and configure from the GUI.

In the meantime, thank you for the guide! Seems to be working well on my network so far.

1 Like

I would also love to see this feature added to the GUI.

We buy at least 4 routers a year, and this feature would simplify our setup process a lot.

Hello,

Thank you for your feedback.

Since the limited number of users currently utilizing this feature, we do not have immediate plans to add it to the GL GUI.

We will continue to monitor the demand for this feature. Once it exceeds a certain volume, we will initiate an evaluation.

Thank you!

I’ll add my vote for this feature. While the above guide works (thanks!), a GUI feature would be helpful.

Thanks for the suggestions.