Need to make nodemcu a station and a access at the same time
Need to make nodemcu a station and a access at the same time
I need the nodemcu connect to internet through a router and i need my laptop to connect to nodemcu and access the internet. I created AP and STA in nodemcu at the same time, nodemcu connects to the router, and laptop connects to network created by nodemcu, but the problem is they work as 2 separate networks, and can't communicate data between them. Can anyone help please
Re: Need to make nodemcu a station and a access at the same time
Connect your board to the router (check your IP via REPL with wlan.ifconfig().
Connect your laptop to the router (so you will have Internet connection).
You can ping your board from the laptop now with the IP you got from wlan.ifconfig(). Or you can use webrepl to interact with the board directly.
You can reserve the DHCP address of your board in the router interface so the local IP address doesn't change with every connection. You can add a startup script on the board to scan the wifi APs and connect to one if it's known, that way you can put your esp anywhere within the reach of your WiFi.
It's worth noting that this usage of webrepl is not officially supported (yet), but it works well for me.
Connect your laptop to the router (so you will have Internet connection).
You can ping your board from the laptop now with the IP you got from wlan.ifconfig(). Or you can use webrepl to interact with the board directly.
You can reserve the DHCP address of your board in the router interface so the local IP address doesn't change with every connection. You can add a startup script on the board to scan the wifi APs and connect to one if it's known, that way you can put your esp anywhere within the reach of your WiFi.
It's worth noting that this usage of webrepl is not officially supported (yet), but it works well for me.
Re: Need to make nodemcu a station and a access at the same time
Oh, and of course use your laptops local IP to communicate with it from the ESP!
Re: Need to make nodemcu a station and a access at the same time
Can you explain what you are trying to accomplish more generally? It sounds like you want the ESP8266 to bridge the station and access point connections so that the laptop connected via the ESP8266's access point can access the Internet.
If you take a look at this thread it may not be possible. You might be able to get it to work for a certain category of traffic like HTTP by running a very basic proxy though on the device though. I'm curious to hear what problem you're trying to solve in case there is another approach that might be easier.
If you take a look at this thread it may not be possible. You might be able to get it to work for a certain category of traffic like HTTP by running a very basic proxy though on the device though. I'm curious to hear what problem you're trying to solve in case there is another approach that might be easier.
Re: Need to make nodemcu a station and a access at the same time
This really sounds like a misuse of the product and is never going to work well.
Jon
Jon
Re: Need to make nodemcu a station and a access at the same time
Tried to do something similar, but due to the fact that my system uses a proxy server (http://advanced.name), little came of it. working with the spoofed ip complicates this thing twice.