I've developped a fakeinternet service so that the standalone (non internet connected) routers would not cause Android/iOS/Kindle Fire tablets to display the warning message about lack of internet connectivity and/or blacklist the WiFi.
The use case would be anywhere where the WiFi and local connectivity is needed while internet access is not available -- for example remote cabin/plane/boat with the local service like emby.
I'd welcome some real-world feedback from iOS users.
Check out the
README for more information. The pre-built package is available from my repo.
Also iirc both android and iphone do check if they are online via a http get request
Are there any specific requests which are not handled by the current code?
Added handling of requests sent by Kindle Fire tablets.
Converted iptables rules to PROCD firewall rules for more OpenWrt-like code.
It's ready for prime time! If you have an offline network and don't want your devices to annoy you with "This network has no internet connection" -- just install this package.
@stangri Thank you for package. Kudos! Am doing extensive testing with multiple devices and OS's in next few weeks. Will do bit of contribution by filing any bugs I find.
Here is a question? Is it possible to use this Fakeinternet settings itself to redirect all HTTP/HTTPS connections to the Internet redirected to local website hosted on the
http://localserver.lan/ when Internet is connected (WAN cable is disconnected.) Thanks!
You'd have to edit the code a bit. In the file /etc/init.d/fakeinternet replace the
line 27 with the assignment like
ip=192.168.1.xx, where 192.168.1.xx is an IP for localserver.lan.
It would break the functionality unless you configure your localserver to give exactly same responses to specific requests as my package does.
@stangri for the prompt response. I think what I am trying to do this redirect all traffic except these matching the policy declared in fakeinternet.conf ( https://github.com/stangri/openwrt_packages/blob/master/fakeinternet/files/fakeinternet.conf).
Let me write a testcase.
User connects to Access Point with a Android device.
The user open a web browser and types '
http://google.com'. The FakeInternet intercepts the connections and redirects the browser to localserver.lan.
Basically we are redirecting all traffic to the localserver if it doesn't match any address defined in fakeinternet configuration or local lan addresses.
Problem here might be Android 7 and Android 8, because of also using https. And even checking for
google.com, because of HSTS.
Besides, for Android <=6 I suspect fakeinternet.conf to be incomplete.
Having done similar functionality, but as a commercial implementation, I am interested in results of testing.
If you mean that Android 7 & 8 started using https for checking connectivity please post references.
@stangri Reading through the dnsmasq docs, I found out that all traffic could be redirected by adding following line to dnsmasq custom configuration.
Wonder if I could just add it as last policy at the end of fakeinternet.conf. Not sure what sort of actions there are other than 'fake' and 'block'? Is there a redirect or allow?
option address '/#/10.0.0.1'
option action '?'
Fake means that the address will be set to that of the fakeinternet web IP and block means that the address will be set to 127.0.0.1.
@stangri Thanks, Let me see if I can achieve some kind of captive portal using error.cgi. I need to learn more about openwrt package development.
Meanwhile I gave a shot at support Gnome and Firefox network detection system. Please kindly review.
Thank you, the
fakeinternet 0.1.2-9 package with your edits has been uploaded to repo.
Great! Tested version 0.1.2-9 package on real device. It works as expected. Will continue testing and contribute patches in future.
@stangri Is there any docs about /www_fakeinternet/error.cgi configuration. At the moment whenever there is no code to handle fake or block a URI, you are show a directory listing of the root page with "/ error.cgi"
As far as I remember it should give a "Generic 200 OK/Success" reply to anything unexpected.
Perhaps it is because I tried to fake all addresses with '#'. Perhaps I'll modify the code to give it a '302 Location:
This might basically replicated the dnsmasq setting:
It should still reply with "Generic 200 OK/Success" for any unknown request URLs.
Can you please advise in which case are you seeing the directory listing?
@stangri How do I build/cross compile the fakeinternet package locally on Ubuntu 64bit machine? I want to make some changes and test the package on OpenWRT Virtual machine or the real device. Thanks!
Just like you would any other package. Or you can modify files on the live router. Not sure if you'd even need to restart the service if you're only changing the .cgi.