Now that one was a piece of cake:
As suspected /app/include/lwipopts.h overruled the file I modified previously.
So with a
#define IP_FORWARD 1
in there, the the module started forwarding packets
So I now could ping the Laptop (ouch: forgot to disable the firewall first) from the mobile device and vice versa.
Here is the caveat:
To daisy-chain / mesh more of these, I need to supply routing information to LWIP. It is not too obvious where to do that in the code or what it takes to add commands to manipulate routes through LUA.
PING | 192.168.1.50 | 192.168.1.75 | 192.168.4.1 | 192.168.4.3 |
---|---|---|---|---|
192.168.1.50 | n/a | n/a | n/a | YES |
192.168.1.75 | YES | n/a | n/a | n/a |
192.168.4.1 | YES | n/a | n/a | YES |
192.168.4.3 | YES | n/a | YES | n/a |
So I now could ping the Laptop (ouch: forgot to disable the firewall first) from the mobile device and vice versa.
Here is the caveat:
- I need a static route from the Laptop to the "StationMode" interface of the ESP8266. The cooler way to do that is on the default router.
To daisy-chain / mesh more of these, I need to supply routing information to LWIP. It is not too obvious where to do that in the code or what it takes to add commands to manipulate routes through LUA.
I have the same problem. But I can not compile nodemcu from source. Could you write some advise?
ReplyDeleteWhich way have you tried? I use the VirtualBox image supplied by Espressif, their SDK and the NodeMCU sources cloned from GitHub.
DeleteI use Espressif's VirtualBox image and their SDK
Deletebut I can't compile toolchain. Could you advise how to compile toolchain for compiling IP FORWARDING Lua image?
I use more or less the same setup. I use pfalcon's tools to install the SDK: https://github.com/pfalcon/esp-open-sdk
DeleteAll I need to to then is to set the environment variable for the path to the SDK and I can compile NodeMCU from the source.
Where exactly does it fail for you?
At last, I can compile by Eclipse on Windows10.
DeleteChanging points is :
1. file "lwipopts.h"
#define IP_FORWARD 1
2. file "opts.h"
#define IP_FORWARD 1
Are these points enough for IP_FORWARD ?
After compiling how to use it?
Thank you.
Which version of the NodeMCU source are you using? They switched to a newer LWIP version a little while ago. In older versions, you had to define USE_DNS, which is already the case in the newer version.
DeleteYou can check out the old video for the details on using the RangeExtender here: https://youtu.be/NH1rjk3Q_MU
Just last week, I have made a new, extremely well working build that simplifies things a lot. I'll release that along with docs and a video tutorial shortly.
Thank you very much.
DeleteI have tried to compile as following steps.
http://tridenttd-iot.blogspot.com/2016/02/lwip-ip-forward-espressif-devkit-eclipse.html
I don't know how to use them for using IP FORWARD on esp8266.
Hello Andreas. is http requests working on client side? for ex. can i receive abc.com/abc.php result from esp's client ?
ReplyDeleteHi Mehmet, I am still working on that. I had disconnects from the downstram AP when I put traffic through the ESP. It might be a power issue, but I haven't fully investigated the issue. In theory it should work, but it doesn't.
ReplyDeleteIs your source code available for this project? If so, where could I download it from?
ReplyDeleteYes.
DeleteRead here:
http://www.areresearch.net/2015/10/using-esp8266-as-wifi-range-extender.html
Or watch this:
https://youtu.be/NH1rjk3Q_MU
Hello Andreas, I tried following the code changes you mention here, applied to the latest nodemcu dev branch. I changed the lwip code in the nodemcu repo itself (as opposed to the lwip contained in the SDK), then rebuilt the firmware.
ReplyDeleteHowever, I can't seem to ping through the ESP. I can ping both ESP interfaces from either side, but not through it.
Are the code changes here still applicable to the latest dev branch? I understand that the firmware migrated to open lwip as of firmware 1.4.0.
I also got it working with 1.4.0
DeleteIf you can't ping accross the module, the most likely reason is that the
#define IP_FORWARD 1
is not set or in the wrong place.
Please try the firmware here:
Read here:
http://www.areresearch.net/2015/10/using-esp8266-as-wifi-range-extender.html
And watch this:
https://youtu.be/NH1rjk3Q_MU
I finally managed to ping through the ESP, the issue was the router, for some reason the static route didn't work. I switched to an older router I had and it worked.
ReplyDeleteThen, with the DNS forwarder code I was able to browse and even stream netflix through the ESP. That's not bad at all :)
Like I mentioned in your other article, I did not experience any disconnection issues during my tests (although I didn't really test too long either ;p)
Hi Daniel, great to hear that! I have a version available that does not require the DNS forwarder any more. Unfortunately it is affected by NodeMCU bug #1164, so I don't particularly like it, although it works. (Not much need for SPIFFS in this case.)
DeleteDo you mean this:
Deletehttp://www.areresearch.net/2015/10/using-esp8266-as-wifi-range-extender.html?showComment=1448065651378#c3704870924627971911
?
Or something else?
What I think would be interesting is to set the dns server sent out by the AP dhcp option to be the same as the dns server received by the STA.
Yes, exactly. That works great as suggested by Alx Aly. Your idea should also work. That would usually be the DSL-Router and is a bit more universal than a fixed IP.
Delete