martin-ger / esp-open-lwip

ESP8266 lwIP library with NAT, SLIP, ENC28j60 Ethernet, and routing support
67 stars 25 forks source link

redirect devices to specific website #26

Open AlphaArslan opened 5 years ago

AlphaArslan commented 5 years ago

I understand that there is some routing happening on the ESP. what I want to do now is to always route the devices connected to the ESP NAT to a specific website.

how can this be achieved ?

martin-ger commented 5 years ago

This can be done ba manipulating DNS or by rewriting addresses of HTTP requests. The challenge is, to switch off this redirect selectivley, once authentication is done.

I did an example with Arduino that does IP address-rewrite and switches the MAC addresses, once "authentication" has been done: You can find the code here: https://github.com/martin-ger/lwip_nat_arduino

AlphaArslan commented 5 years ago

DNS manipulation can be bypassed if the client chooses to use another DNS or access sites by IP. right ? so, rewriting HTTP requests would be better I think. I will study your code and keep you updated thanks dude

AlphaArslan commented 5 years ago

In CaptiveHotspot.ino, the hostspot doesn't have any internet access, does it ?

AlphaArslan commented 5 years ago

but wait, there is actually no source ( C ) files in esp_wifi_repeater I have been looking for source files to learn from them but can't find them anywhere

martin-ger commented 5 years ago

There are all sources in the user subdir.

In CaptiveHotspot.ino the ESP's STA side should be connected to the internet (the captive hotspot will work without, but then you get nothing once switched through).