I've read through https://wiki.luckfox.com/Luckfox-Pico/L ... -static-ip but it applies to eth0.
Would a similar approach work for the wifi?
static ip address for wifi/wlan
The method introduced on the wiki for setting a static IP for Ethernet (eth0) assumes that the network cable is already connected before entering the root filesystem. The boot script uses udhcpc -i eth0 to obtain an IP address, then runs a static IP setting script to override the original IP and apply the static address.
However, for Wi-Fi, there isn't a default boot script to obtain an IP (since the SSID or password may change). Therefore, when writing a script to set a static IP for Wi-Fi, you first need to ensure the SSID and password are correct and that the connection is successful. And then, you can use udhcpc -i wlan0 to obtain an IP, then apply the preconfigured static IP settings(Make sure to apply the settings only after obtaining the IP; otherwise, there is a risk of it being overwritten.).
Another solution is to modify /etc/network/interfaces to configure the static IP (a common approach, though it hasn't been tested yet on the Luckfox Pico).
However, for Wi-Fi, there isn't a default boot script to obtain an IP (since the SSID or password may change). Therefore, when writing a script to set a static IP for Wi-Fi, you first need to ensure the SSID and password are correct and that the connection is successful. And then, you can use udhcpc -i wlan0 to obtain an IP, then apply the preconfigured static IP settings(Make sure to apply the settings only after obtaining the IP; otherwise, there is a risk of it being overwritten.).
Another solution is to modify /etc/network/interfaces to configure the static IP (a common approach, though it hasn't been tested yet on the Luckfox Pico).
Thanks for the information. I will make some experiments.