How to configure Chrony time server in GL.iNet router and redirect LAN clients’ sync requests?

Hello,

GL.iNet firmware has introduced Chrony (chronyd) as the system time-synchronization service, including support for NTS (Network Time Security).

Availability depends on the router model and firmware version.

For example, Flint 2 uses sysntpd on v4.8.3 and requires v4.8.4 or later for this guide.

This guide explains how to allow LAN clients to synchronize time with the router and redirect their IPv4 and IPv6 NTP requests to the router’s Chrony service.

Before continuing, check whether your firmware includes Chrony:
ls /etc/init.d/chronyd
And please back up your current router configuration: How to Export/Import Backup Configuration Files via LuCI

If your firmware uses sysntpd, refer to the previous NTP guide.

Tutorial:

  1. SSH to router

  2. Check whether the router system time is correct

    date
    # If the time is incorrect, you can trigger it manually:
    /etc/init.d/chronyd restart
    
  3. Edit the Chrony configuration to enable the time server, please modify [Router LAN IP] according to your LAN IP

    # Allow clients on the LAN interface to access the router’s NTP service. On supported firmware, the configuration below generates access rules for the interface’s IPv4 and IPv6 subnets:
    
    uci set chrony.allow_lan='lan_ntp'
    uci set chrony.allow_lan.interface='lan'
    uci commit chrony
    
    #This applies to the main LAN only. Guest networks and additional VLANs require their own access configuration.
    
  4. Restart Chrony to apply the above new configuration

    /etc/init.d/chronyd restart
    
  5. Check the port 123 status

    netstat -uln | grep 123
    #If you intend to serve IPv6 clients, also verify that Chrony is listening on IPv6 UDP port 123, usually displayed as :::123.
    

    Bruce_2026-11-02_18-25-42

  6. Configure the firewall to redirect time requests from LAN clients to the router's time server.
    There are two kinds of firewall implementations: some use iptables, some use nft (fw4).

    # Check which firewall implementation your firmware uses
    command -v fw4
    command -v fw3
    

    Check whether fw4 or fw3 is printing any return output based on the content. If only fw3 printed, that uses iptables; if both fw4 and fw3 printed, that uses nftables.

    • For fw3 / iptables:
    cat >> /etc/firewall.user <<'EOF'
    # Redirect LAN clients' IPv4 NTP requests to this router
    iptables -t nat -A PREROUTING -i br-lan -p udp --dport 123 -j REDIRECT --to-ports 123
    # Redirect LAN clients' IPv6 NTP requests to this router
    ip6tables -t nat -A PREROUTING -i br-lan -p udp --dport 123 -j REDIRECT --to-ports 123
    EOF
    /etc/init.d/firewall restart
    
    

    When restarting the firewall you may see print such as "invalid"; as long as they don't mention "error," that's normal.

    Check if the rule is written to the firewall:

    iptables -t nat -L PREROUTING -n -v --line-numbers
    ip6tables -t nat -L PREROUTING -n -v --line-numbers
    

    Do not repeatedly append or manually execute these rules. Repeated execution without clearing the existing rules can create duplicates.

    • For fw4 / ntfables
    uci set firewall.redirect_lan_ntp='redirect'
    uci set firewall.redirect_lan_ntp.name='Redirect-LAN-NTP'
    uci set firewall.redirect_lan_ntp.src='lan'
    uci set firewall.redirect_lan_ntp.family='any'
    uci set firewall.redirect_lan_ntp.proto='udp'
    uci set firewall.redirect_lan_ntp.src_dport='123'
    uci set firewall.redirect_lan_ntp.dest_port='123'
    uci set firewall.redirect_lan_ntp.target='DNAT'
    uci set firewall.redirect_lan_ntp.reflection='0'
    uci commit firewall
    /etc/init.d/firewall restart
    
    

    When restarting the firewall you may see print such as "invalid"; as long as they don't mention "error," that's normal.

    Check if the rule is written to the firewall:

    nft list chain inet fw4 dstnat_lan
    

  7. Verify the redirection
    Run these tests from a computer connected to the router’s LAN or main Wi-Fi. Disconnect any client-side VPN first.

    # IPv4
    w32tm /stripchart /computer:192.0.2.123 /dataonly /samples:3
    
    # IPv6
    w32tm /stripchart /computer:2001:db8::123 /dataonly /samples:3
    

    • Optional: Capture packets using the tcpdump to verify that the LAN client's time requests are being redirected by the router to own host, where time synchronization is provided by Chrony.
    #opkg manager:
    opkg update && opkg install tcpdump
    tcpdump -i any port 123 -n
    
    #apk manager:
    apk update && apk add tcpdump
    tcpdump -i any port 123 -n
    

    (The router LAN subnet in this example is 192.168.8.0/24, test PC IP is 192.168.8.239)


    Windows time Sync service:

  8. Remove the NTP redirection

    • For fw3:

    Remove the two NTP redirect lines added to /etc/firewall.user, then restart the firewall:

    /etc/init.d/firewall restart
    
    • For fw4
      Delete the redirect and reload the firewall:
    uci -q delete firewall.redirect_lan_ntp
    uci commit firewall
    /etc/init.d/firewall reload
    
    
    • Optional: Disable LAN access to Chrony

    If you also want to stop using the router as a LAN NTP server, remove the access section added by this guide:

    uci -q delete chrony.allow_lan
    uci commit chrony
    /etc/init.d/chronyd restart
    
    

    Do not uninstall Chrony: it remains the router’s normal time-synchronization service.

-end


Addition: Configure custom NTP servers

Chrony’s persistent configuration is stored in /etc/config/chrony.

Keep the first Cloudflare pool entry disabled:
Some firmware versions have a kmwan time-sync handler that checks the first Chrony pool entry before time synchronization is marked as valid.
If its hostname is not time.cloudflare.com, the handler may restore the default time sources.

As a temporary workaround:

  1. Keep the original first pool entry with hostname='time.cloudflare.com'.
  2. Disable that entry using disabled='1'.
  3. Configure your preferred time sources separately.

See our staff explanation and workaround for background.

The following commands assume that the original default pool entry is still present. Replace the three example hostnames with your actual NTP servers before running them:

# Preserve the original first pool, but disable it
uci set chrony.@pool[0].hostname='time.cloudflare.com'
uci set chrony.@pool[0].disabled='1'

# Remove the other default time sources
uci -q delete chrony.time_nl
uci -q delete chrony.netnod
uci -q delete chrony.ptb
uci -q delete chrony.dfm
uci -q delete chrony.cifelli

# Custom NTP server 1
uci set chrony.custom_ntp_1='server'
uci set chrony.custom_ntp_1.hostname='ntp1.example.net'
uci set chrony.custom_ntp_1.iburst='yes'
uci set chrony.custom_ntp_1.nts='yes'

# Custom NTP server 2
uci set chrony.custom_ntp_2='server'
uci set chrony.custom_ntp_2.hostname='ntp2.example.net'
uci set chrony.custom_ntp_2.iburst='yes'
uci set chrony.custom_ntp_2.nts='yes'

# Custom NTP server 3 (time.nl) as a sample
uci set chrony.time_nl='server'
uci set chrony.time_nl.hostname='ntppool1.time.nl'
uci set chrony.time_nl.iburst='yes'
uci set chrony.time_nl.nts='yes'

uci commit chrony
/etc/init.d/chronyd restart

To use NTS, choose endpoints that explicitly support it and set nts='yes' for those endpoints.
Do not enable NTS for ordinary NTP servers or pool.ntp.org pools.

Verify the custom configuration:

chronyc sources -v

Once synchronized, one of the intended sources should be marked ^*.

-end

Thanks for the tutorial, these are very helpful for setting up new features and local time serving is important when running an internal CCTV system with no internet access.

Setup went smoothly but I ran into a problem verifying, it was because I was trying to verify from a computer that was connected to a VPN and the router (unsurprisingly) cannot intercept VPN traffic. Leaving this comment here in case it helps someone in the future when they search and find this result.

Glad to hear that works in your scenario!

And this will help other users check whether the clients are being run a VPN software.

Many thanks!

Hi, thanks for tutorial. Have several question:

Flint 2 v4.8.3. Chrony was absent - installed manually. Does it depend on model which version supports chrony by default?

Having duplicates

iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 891 packets, 241K bytes)
 pkts bytes target     prot opt in     out     source               destination
   50  3800 DNAT       udp  --  br-lan any     anywhere             anywhere             udp dpt:ntp to:192.168.x.1:123
    0     0 DNAT       udp  --  br-guest any     anywhere             anywhere             udp dpt:ntp to:192.168.y.1:123
    0     0 DNAT       udp  --  br-lan any     anywhere             anywhere             udp dpt:ntp to:192.168.x.1:123
    0     0 DNAT       udp  --  br-guest any     anywhere             anywhere             udp dpt:ntp to:192.168.y.1:123
cat /etc/firewall.user
iptables -t nat -A PREROUTING -i br-lan -p udp --dport 123 -j DNAT --to-destination 192.168.x.1:123
iptables -t nat -A PREROUTING -i br-guest -p udp --dport 123 -j DNAT --to-destination 192.168.y.1:123

Can it be related to my configuration for guest network also?

cat /etc/chrony/chrony.conf
# Load UCI configuration
confdir /var/etc/chrony.d

# Load NTP servers from DHCP if enabled in UCI
sourcedir /var/run/chrony-dhcp

# Log clock errors above 0.5 seconds
logchange 0.5

# Don't log client accesses
noclientlog

# Mark the system clock as synchronized
rtcsync

# Record the clock's drift
driftfile /var/run/chrony/drift

Save NTS keys and cookies
ntsdumpdir /var/run/chrony
# allow 192.168.x.1
allow 192.168.x.0/24
# allow 192.168.y.1
allow 192.168.y.0/24

Thanks

Truly sorry, the Flint2/MT6000 v4.8.3 does not yet support chronyd, but sysntpd.

Please first upgrade your Flint2 to the latest firmware v4.8.4, and configure it with this guide.

If you have to stay on v4.8.3, please refer to this guide:

Some of us don’t have a Windows PC or Powershell.

Is there a bash or zsh command that will do w32tm /stripchart /computer:123.123.123.123 /dataonly /samples:3

?

Since the time synchronization services of open source systems may be different, it may depend on what service is used in your system.

For example:

ntpdate -q 123.123.123.123
chronyd -Q 'server 123.123.123.123 iburst'

Unless you live in northern Europe, you’ll probably want to use time sources more nearby than those provided in the default configuration. Find those chimers geographically in https://www.ntppool.org/. For worldwide distribution, I would suggest GLI provide the default configuration as pool pool.ntp.org or maybe get your own vendor zone.

For example, since I like to use both the general US pool and my ISP’s more local server, I said

chronyc add pool us.pool.ntp.org iburst burst xleave
chronyc add server ntp.hunterfiber.com iburst burst xleave
chronyc delete nts.netnod.se
chronyc delete ...

I deleted the others I saw in chronyc sources

My question: After I chronyd restart I am back to the servers listed in /var/etc/chronyd/10-uci.conf. I tried editing that file and on restart it was replaced with the factory contents. How can I make my NTP source configuration persistent?

You need to manually modify the /etc/config/chrony configuration file to make the chrony settings persistent.

Alternatively, you can configure it using the uci command:

uci -q delete chrony.@pool[0]
uci -q delete chrony.time_nl
uci -q delete chrony.netnod
uci -q delete chrony.ptb
uci -q delete chrony.dfm
uci -q delete chrony.cifelli

uci add chrony pool
uci set chrony.@pool[-1].maxpoll='12'
uci set chrony.@pool[-1].iburst='yes'
uci set chrony.@pool[-1].nts='yes'
uci set chrony.@pool[-1].hostname='us.pool.ntp.org'

uci set chrony.@dhcp_ntp_server[0]='dhcp_ntp_server'
uci set chrony.@dhcp_ntp_server[0].iburst='yes'
uci set chrony.@dhcp_ntp_server[0].disabled='no'

uci set chrony.@allow[0]='allow'
uci set chrony.@allow[0].interface='lan'

uci set chrony.@makestep[0]='makestep'
uci set chrony.@makestep[0].threshold='1.0'
uci set chrony.@makestep[0].limit='3'

uci set chrony.@nts[0]='nts'
uci set chrony.@nts[0].rtccheck='yes'
uci set chrony.@nts[0].systemcerts='yes'

uci set chrony.hunterfiber='server'
uci set chrony.hunterfiber.hostname='ntp.hunterfiber.com'
uci set chrony.hunterfiber.iburst='yes'
uci set chrony.hunterfiber.nts='yes'

uci commit chrony

/etc/init.d/chronyd restart 

You can verify if the NTS service is running and check the availability of the time servers by the command chronyc sources -v.

Since ntp.hunterfiber.com is unavailable in my location, I have added ntppool1.time.nl back to maintain NTS service availability.

uci set chrony.time_nl='server'
uci set chrony.time_nl.hostname='ntppool1.time.nl'
uci set chrony.time_nl.iburst='yes'
uci set chrony.time_nl.nts='yes'

uci commit chrony

/etc/init.d/chronyd restart 

I was playing with this (uci command are definitely more reliable and consistent) and it's worth noting that unless you're a global traveler, you can set the sources to a single source as instructed in theNTP.POOL usage instructionsand leave it be. The DNS used by this service is built to resolve the names to the NTP service nearest you. You can also specify the continental or country sub-zones. Another special note: if you want to ensure the most availability, you can also use the "2" subdomain (i.e., 2.asia.pool.ntp.org) to include IPv6 addresses.

@will.qiu helped me sort out an oddity in this process. TLDR; you have to keep the time.cloudflare.com entry in the set or the kmwan startup will replace all your customizations with the defaults.
The details are here.

Hi, I am trying this out with my newly received Flint 4 and I am getting an error while testing in my Powershell with w32tm /stripchart /computer:www.google.com /dataonly /samples:3

I think it is because I enabled ipv6. Does it not work with ipv6 enabled? How do i undo all this? I dont want my ntp requests from devices not work if they happen to use ipv6.

The w32tm /stripchart /computer:123.123.123.123 /dataonly /samples:3 works fine. And confirmed in tcpdump.

The redirect in this guide targets IPv4 UDP port 123 only. Enabling IPv6 does not disable it, but an NTP request sent over IPv6 will bypass the IPv4 redirect and continue to its original destination. First test with the literal IPv4 address to remove DNS/IPv6 from the test:

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

If that works while www.google.com fails, IPv6 or name resolution is the relevant difference—not a failure of the IPv4 redirect. To undo the configuration:

  1. In LuCI, open Network → Firewall → Port Forwards, delete Redirect-LAN-NTP, then save and apply.
  2. Remove the allow <your-LAN-subnet> line that you added to /etc/chrony/chrony.conf.
  3. Restart Chrony:
    /etc/init.d/chronyd restart
    

You should not uninstall Chrony because it is the router’s normal time-synchronization service. After removing the redirect, each device will contact its configured NTP server normally over either IPv4 or IPv6.

This reply was generated by AI. Please verify its accuracy.

GL.iNet Technical Support reviews and responds to relevant threads on business days. Please allow time for a staff response.

Will this be in the GUI with the DHCP option 42 set sometime in the future?

Do you actually have clients that support this? :wink:

DHCP option in Ethernet (WAN) configuration, or in the DHCP server?