Fakeinternet service/package

Is there a way to have fakeinternet monitor a specific interface only?

Possibly, you'll need to elaborate on specifics.

Openwrt device has multiple interfaces operating VLANs for network segmentation. Is it possible to utilize the fakeinternet environment on only one of the interfaces?

I'm guessing I can start and stop the fake internet package with a cronjob as below or do I have to restart a script in init.d or something.
While the service is running it is blocking in nature or does the internet passthrough if it is available?

00 23 * * * uci set fakeinternet.config.enabled=1; uci commit fakeinternet
23 00 * * * uci set fakeinternet.config.enabled=0; uci commit fakeinternet

Can I enable it on only a specific lan interface?

Use case its to have the kids devices still attach to the WIFI to media sharing and printer services but disable the internet on a schedule during study and night time.

Seems like this could be more easily done by setting time-restricted firewall rules tied to the interface.

Yes but they know when it says they have no internet i have blocked them :slight_smile:

It's not going to be achieved easily, you'd need to set up a special dnsmasq instance for that interface and most likely you'd still need to tweak fakeinternet code to target specific dnsmasq instance.

@stangri Am trying to implement captive portal redirect host capport detection for Android 12+

Is there way to detect and add the hostname in ./fakeinterenet.cgi.

echo 'HTTP/1.1 200 OK'
echo 'Cache-Control: private'
echo 'Content-Type: application/captive+json'
echo ' '
echo '{'
echo '    "captive": true,'
echo '    "user-portal-url": "http://<hostname>.local", '
echo '   "venue-info-url": "http://<hostname>.local" '
echo '}'

It's not clear to me what are you trying to achieve, but you can check the logger commands for some of the environment variables available.

Thank you, I'll check the logger commands output.

Am trying to get the mobile clients to automatically prompt users to open a website as soon they connect to the WiFi. This behavior achieved through new feature described in this page

That's not what the fakeinternet package is for. It is not a captive portal solution.

Indeed, Thanks to its clean design, it possible for me repurpose it with single patch. Apart from the simplicity of the design, the performance is far superior than dedicated projects for captive portal which requires you to have internet access to work.

Just don't forget to remove all the dnsmasq-related entries then. :wink:

Hey mate. I myself am running VLANS, one for Android TV, another for kids network.

It would be tremendously useful if I could enable fake internet package for specific vlans. Are you able to expand on how I may be able to achieve this?

When you asked for hostname, you mean of the machine sending the request or the hostname it requested?

PS. Depending on the patch, I may be able to include your file in fakeinternet and make it build two packages -- fakeinternet and fakecapportal.

I'd create another dnsmasq instance and modify fakeinternet code to:

  1. target that new dnsmasq instance rather than [0].
  2. rewrite the firewall dns hijack rule to only affect traffic from specific VLAN (by targeting it's CIDR probably).
1 Like

Thanks mate.

Can this be used to allow android device to connect to networks that have google.com blocked which would normally result in a prompt advising the following network has no internet available, do you still want to connect to it?

I have a need to block google.com on a couple of vlans that have google.com blocked in opensdns

To a point. This can fake replies to the unencrypted requests, however I recall some newer devices also attempt to connect to the internet-detecting URLs via https requests and replies to these cannot be faked afaik.

@stangri Would this work to force an iPhone to automatically use it's own cell data while remaining connected to the router's offline wifi network? Ideally without changing any settings on the iPhone.

I don't think so.