I’m working on some test project, basically I want to route all traffic when I’m in hotspot mode into a fixed address. I have the IP range for example 192.168.0.0/24 I don’t know if I can use iptables without root or JNI functions (can’t find any that match what I want)
Thinking out of the box is very welcomed (DNS, low level packet broadcast on client connect etc…)
EDIT: How Android and iOS detect a Network Portal?
source : https://sudoroom.org/wiki/Mesh/Firmware/Splash_page
They try to HTTP GET on
iOS: http://www.apple.com/library/test/success.html and expect a 200 if not behind portal
Android: http://clients3.google.com/generate_204 and expect a 204 status when not behind portal, any other status is a portal
So, how can I respond correctly to those detections?
The easiest approach is to enable a socks proxy when configuring the wifi AP you are connecting to. This varies depending on the version of android, but it is typically something like:
- Touch and hold the wifi network you want to connect to.
- A dialogue box should pop-up. In that dialogue box, select advanced.
- Find the proxy option and enter in the IP and port of the server you want to forward traffic to.
Android speaks SOCKS and so long as your proxy speaks SOCKS as well, you are good to go. If you root the device you can (depending on your version of Android), configure this proxy automatically. See, for instance, AdBlock Plus for Android which does exactly that.
If you don’t want to go the proxy route you may be able to manually set ebtables rules if your device is rooted. This is significantly more work as you have to be careful not to mess up the NAT’ing that your device is already doing.