As the title says... Chat on...

User avatar
By picstart1
#6135
Code: Select allwifi.sta.setip({ip="192.168.18.119",netmask="255.255.255.0",gateway="192.168.18.1"})

This ability to assign a static ip is working perfectly.
When a server is given a fixed ip on a local wifi network it makes it very easy for clients on the local network to connect to the server.

Thank you for this feature..
User avatar
By PuceBaboon
#6138
Code: Select allwifi.sta.setip({ip="192.168.18.119",netmask="255.255.255.0",gateway="192.168.18.1"})



Thank you Zeroday, for that and for all of the rest of the Lua development, too. Works beautifully!

-John-
User avatar
By yes8s
#8745 Hi,

Firstly, I want to highlight that the api documentation on github regarding this feature is wrong.

Here, you've said that the syntax is:

wifi.sta.setip({ip="192.168.18.119",netmask="255.255.255.0",gateway="192.168.18.1"})

while in github, it's documented as:

cfg = { "ip":"192.168.0.111", "netmask":"255.255.255.0", "gateway":"192.168.0.1" }
wifi.sta.setip(cfg)

The github version syntax throws up an error, while the syntax in this post seems to be accepted ok and it seems to be processed by Lua and I am able to read back the values I've set.

However, it doesn't seem to be actually working for me. I'm trying to test this at work on our VPN and if I let our routers DHCP assign an IP, I can access my web-server but when I set a static IP that has been assigned, it doesn't work. I can see I've apparently got an IP from wifi.sta.status() and wifi.sta.getip().

Before I hassle our IT department, I just want to confirm that:

a) This feature is actually working and implemented in full
b) I've got the syntax and the config right (see below)

I'm using the following to configure:
Code: Select all>print(wifi.sta.getip())
172.17.5.5   255.255.252.0   172.17.4.2
> wifi.sta.disconnect()
> wifi.sta.setip({ip="172.17.4.135",netmask="255.255.252.0",gateway="172.17.4.2"})
> wifi.sta.connect()
> print(wifi.sta.getip())
172.17.4.135   255.255.252.0   172.17.4.2
>


172.17.5.5 is the IP i get when I let the routers assign it for me
172.17.4.135 is the static IP I've had IT allocate for exclusive use by me for testing

Is there something I'm missing here?