[Solved]-Archer C7 time bug (NTP fails in dumb AP)

Got 2 Archer C7's here on lede-17.01.0-r3205-59508e3-ar71xx-generic-archer-c7-v2-squashfs-factory. In theory they should be 100% the same. Except that one is an AP like this: https://wiki.openwrt.org/doc/recipes/dumbap

The AP has time problems. I don't have much details but after a power outage yesterday, its time is 5 days and 4,5 hours behind, and it happened before.
NTP is running like this: /usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p 0.europe.pool.ntp.org -p 1.europe.pool.ntp.org -p 2.europe.pool.ntp.org -p 3.europe.pool.ntp.org

Have you overclocked or changed bootloader?

Not overclocked.
No changed bootloader.

More info: The time speed appears to be fine because after it is synced with the browser (via LuCI) it will run according to the real time. So when a power outage or power off happens and possibly also when rebooting, the time is off.

As most routers do not have any real-time clock, the router resets its date & time to the newest file date/time stamp in /etc directory during the reboot process. Usually that is the build time of the firmware or the time when settings were last modified.

Then a NTP client queries to correct time from internet. But your "dumb AP" with "no routing, no DHCP, no other functions" may prevent NTP client from working.

If you have not, try setting the AP's LAN default gateway to your primary routers IP.

+1

And set also the DNS server address. (DHCP clients get the correct data from the DHCP server in the main router, but this slave router itself needs the correct routing info, too. you define NTP servers with text addresses, so DNS needs to work.)

...or preferably he could enable ntp(d) on his main router and point it directly to that IP. Gateway is still needed however :wink:

Can you please be explicit on this. There is very little documented in the OpenWrt wiki on the time server config at these links and I do not understand how to configure this.
https://wiki.openwrt.org/doc/uci/system
https://wiki.openwrt.org/doc/howto/ntp.client (Different beast I think)

Been curious about how to use the enable_server parameter.

/etc/config/system

Server

config system
        option hostname 'lede'
        option timezone 'XXX'
        option zonename 'XXX'

config timeserver 'ntp'
        option enabled '1'
        option enable_server '1'
        list server 'ntp.pubserv.1.org'
        list server 'ntp.pubserv.2.org'
        list server 'ntp.pubserv.3.org'
        list server 'ntp.pubserv.4.org'

Client

config system
        option hostname 'lede'
        option timezone 'XXX'
        option zonename 'XXX

config timeserver 'ntp'
        list server '192.168.100.1'
        option enabled '1'
        option enable_server '0'

Yes that was the problem. It had a static address, but while setting it up a week ago I didn't realize I should have entered gateway and DNS too. Thanks.
Solved.

Thanks

I read your comment as this all could be configured on the server (ie the client IP would be somewhere in the server's system "config timeserver" section (all in one place)

So are you saying this is more technically correct, but I should get the same effective results with the AP's gateway and DNS set to the primary devices gateway. Just trying to learn.

One could also set the AP's LAN interface protocol to DHCP Client*, delegating gateway configuration to it. It would acquire it's configuration (IPs, routes, etc.) from the main router - AP's IP can then be controlled by using IP reservation by MAC.

IPv6, which I'm not very familiar with, seems to be the preferred protocol on internal network so sometimes I find it easier just to use DHCP Client and let it configure everything.

EDIT: *Indeed, as @RangerZ pointed out, setting LAN to DHCP could render your AP unreachable and unmanageable if it can't obtain it's address from the main router after a reboot or power failure. To be used if you know what you are getting yourself into :grin:

1 Like

I consider setting an AP to DHCP kind of reckless. It makes administration difficult as the device IP may change and inaccessible when not connected to the the main router.

But I guess when the access point is connected in a new network it might be in a different network(addressrange) as well, which can make it unreachable by static ip address too. I use a static ip address because I know I will never take it outside of my network setup. But even in case of DHCP, the ip to mac bind list that I use in the router will give it the same ip address as currently assigned as static.