[Solved] Luci ntp server for isolated wifi

Hi,

Relatively new user (a few months) to OpenWrt and so far I've done okay with setup however I'm hitting a snag with NTP Server and cannot figure out where I've gone wrong.

I have setup an IoT wifi for some tasmota devices to control lights. I want to setup timers on the Tasmota devices so I need to get correct time from NTP server so it works correctly.

Ideally to keep things as secure as possible I would like to keep this wifi in house and not let it access the internet so that is why I'm trying to setup an NTP Server from my OpenWrt router.

The only way I can the correct time on the Tasmota devices is if the network access to the internet.

I've read thru doc's and posts and tried to work it out but I'm stuck so wondering if someone can shed some light on where I've gone wrong.

Attached is image showing setup/config and it appears to me that ntpd is runnnng okay and should be listening on UDP port 123.

Thanks in advance

You need to know if the devices have hardcoded ntp to query or they will use the dhcp advertised.
If they have hardcoded, you can allow just that to access the wan, or try to hijack/intercept the packets and redirect them to the OpenWrt.
If they accept the dhcp advertised ntp, you can add option 42 in iot interface under dhcp options.
In any case, the firewall output rule you got there is not needed.

3 Likes

@trendy
This is and edited except from Tasmota documentation

The typical method Tasmota uses to set its time is to obtain the time from an Internet NTP server. It can also query an NTP server on its local network (e.g., a network router with an NTP service). Check the information about your router's features. If the router provides an NTP server, be sure to configure it properly. If the Tasmota device receives its IP address via DHCP from the router, Tasmota will request its time sync from the router's time server

I have a dhcp server set for this interface and have also set option 42 as per your post and removed firewall rule.

Under "DHCP and DNS" I have set static leases so I get the same ip addresses assigned to the Tasmota devices so I can easily identify which one to connect to.

Unfortunately even with option 42 I still doesn't get the correct time on Tasmota devices.

Anything else I can check.

Is the router itself getting correct time? maybe Tasmota is contacting your router and getting the wrong time from it?

1 Like

Info here has led me to find a work around as follows:

Once I set DHCP Option 42 it seems to me that everything on the router was configured correctly yet the Tasmota device still wasn't getting the correct time.

Option 42 led me to a post about Tasmota and I found a command that let me query which ntp server pool Tasmota was looking at and it was still trying to get it from xxxxx.ntp.org. I was then able to set that parameter to the ip address of the router and now it works fine.

So, I can only guess that it must be a bug in the Tasmota software.

Thanks for helping me and hopefully this can also help others..

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.