"Wi-Fi was turned off since internet connection was not available on " I have a local wireless network at my home that doesn't provide me with internet access. If I connect my Android device (AT&amp;T NEC Terrain running Ice Cream Sandwhich v4.0.4) to that WiFi network, as soon as it receives an IP address, it turns off WiFi again and prompts me with the message above where &lt;SSID&gt; is the SSID of my wifi network.

Any ideas how I can turn off this behavior?

I have a linux server hooked up to that WiFi and have full control over its DHCP and DNS, so if I can provide some fake host on the network for my phone to stay connected, that's a perfectly fine solution, too.
This was a painful one, but I figured it out:

When Android connects to a new network, it tries to auto-detect whether it can actually reach the internet via this network. If not, it will display a browser window and open a random http-address in the hope to bring up the captive portal of the network (i.e. your hotel's wifi login page, etc.).

The detection is done by requesting http://clients3.google.com/generate_204 (or similar) and expecting a certain answer. (I deliberately didn't turn this address into a link, because if you try to open it, nothing happens as it returns HTTP Status 204: No Content, which most browsers ignore).

Now, my confusion came from the fact that I did have an HTTP server running to serve this response and did have a DNS server set up to direct the request to that server. But the server wasn't getting any requests from this particular phone (other Android phones worked).

Turns out this particular phone does two things differently:


It simply disables WiFi rather than bringing up the captive portal page if no network is detected, which made it really hard to even understand what was going on.
It didn't use a DNS lookup for clients3.google.com, but instead used a hard-coded IP for it!


So, I was finally able to solve the problem by setting up an iptables-rule that simply forwarded all HTTP requests to my HTTP server, irrespective of which IP they were targeted at. After that, the phone got its generate_204-reply and everything worked as planned...