Page 1 of 1

APSTA Mode and SNTP

Posted: Fri Jun 30, 2023 10:34 am
by leemoore1966
Hi All
I hope I am posting in the correct part of the forum!

I have an example which sets up the WiFi in APSTA mode.
It creates a local SoftAP, and also connects to a Station - I seem to have this working correctly

I am now trying to integrate the code here to obtain WireGuard capability to a remote peer.
https://github.com/trombik/esp_wireguard
Standalone this works fine, however when integrated with my APSTA project it fails

The first issue I see, is that wireguard uses the SNTP to synchronize the server - but this never synchronizes

I have a suspicion that this is due to running the WiFi in APSTA mode as opposed to STA mode, which is the mode in which it works fine.

Effectively I have 2 networks, I have the network which runs as an access point allowing clients to connect, and I have a connection to a router.
I suspect that traffic routing or the DNS is not working as expected in this mode, and either the SNTP does not know how to get the address of the NTP server, or it cannot route data to/from it via the STA network

The SNTP code is very simple - in fact from the examples it is nothing more than
https://docs.espressif.com/projects/esp ... _time.html
sntp_setoperatingmode(SNTP_OPMODE_POLL);
sntp_setservername(0, "pool.ntp.org");
sntp_init();

Could my problem be related to running in APSTA mode ?

Thx
Lee