This blog article refers to my YouTube Video you find here.
It shows how an ESP8266 module (like this one) can be used as a (rather unreliable) WiFi range extender.
Overview of the setup |
Beside an ESP8266 module, you need to:
- download the modified firmeware here and flash it to your module
- copy the DNS forwarder script from here to your module
- add a route to the 192.168.4.0 subnet to your default gateway (i.e. usually your WiFi dsl/cable router)
- attach the module to your WiFi network and run it in StationAP mode:
wifi.setmode(wifi.STATIONAP)
wifi.sta.config("YOURSSID","YOURWIFIPASSWD")
tmr.alarm(0, 500, 1, function()
if wifi.sta.getip()==nil then
print("Connecting to AP...")
else
tmr.stop(1)
tmr.stop(0)
print("Connected as: " .. wifi.sta.getip())
end
end)
cfg={}
cfg.ssid="intarwebs"
wifi.ap.config(cfg)
- connect another device to the "intarwebs" SSID. If you want to really use that, you should encrypt that side as well. Here is how.
I have captured the traffic with wireshark, but could not make sense of it yet. My best guess at the moment is that with a big TCP windows size, the module runs into a buffer size problem or that it is busy for too long on the "left" side. The module only has one radio to serve both connections, so unlike your typical router, it can't forward a continuous stream of packets.
------------------------------------------------------------------------------------------------------------------------------------------------------
The modifications are scattered around my blog, sorry about that. The relevant changes to make this work are:
In /app/include/lwipopts.h add a #define IP_FORWARD 1
and
In /app/include/lwip/app/dhcpserver.h add #define USE_DNS somewhere (around line 54)
These two should be sufficient to make it work.
In /app/include/lwipopts.h add a #define IP_FORWARD 1
and
In /app/include/lwip/app/dhcpserver.h add #define USE_DNS somewhere (around line 54)
These two should be sufficient to make it work.
Could you the content of this post without modifying the firmware?
⇒Michael, I've thought about that for a while: If we need to stick to the original firmware, we'd need a http-proxy implementation on the ESP8266. While this is certainly possible, I haven't seen an implementation yet.
We can only run one TCP server on the module, so support for automatic proxy detection is an additional (if optional) challenge.
So at the moment the firmware approach seems like the easiest solution.
没有评论:
发表评论