Pages

Monday, August 31, 2015

Android can not connect to adhoc network

Android does not seem to like adhoc networks and wont connect to one. But no need to fret you can make a simple network instead of an adhoc network and share your connection or do whatever you intend.

You can make a softAP on windows 7 by just typing in a couple of commands
in run type cmd, right click cmd.exe and select run as administrator

then type in

"netsh wlan set hostednetwork mode=allow ssid=YOURSSID key=YOURPASSPHRASE keyUsage=persistent"
replace YOURSSID and YOURPASSPHRASE with an SSID and passphrase of your choice. Remember the pass phrase must be thirteen characters long for WPA .

Example:
"netsh wlan set hostednetwork mode=allow ssid=zedAP key=abcdefghij keyUsage=persistent"

This is a one time step and will create the required “Microsoft Virtual WiFi Miniport adapter” and also set up your hostednetwork. You may now setup Internet Connection Sharing or Network Bridging for this newly found adapter. All this is onetime setting.

Now you need to start the hosted network by typing in

"netsh wlan start hostednetwork” 

And if you need to stop

"netsh wlan stop hostednetwork”

The connection is permanent but would need to restarted when PC is restarted, it is suggested to make a shortcut for the above command

On the empty space on desktop right click and select create shortcut
In the location type in
"C:\Windows\System32\cmd.exe /c netsh wlan start hostednetwork"
and hit next

Right click the shortcut created and goto properties->advanced and select run as administrator
Wola you are done!

But wait Android is not done with you yet. When you try to connect to the AP it may get stuck in an endless obtaining IP address loop. If that happens, select the network properties on your phone, goto advanced and select static instead of DHCP for the address. In the IP field observe the default gateway, assign a new IP same as the default gateway but change the last digit. If connecting more devices keep on incrementing by one.
Leave all other fields as is.


For instance if the default gateway is 192.168.1.1
use 192.168.1.2 as IP
and 192.168.1.3 and so on for subsequent devices.
Enjoy!!