2

I have Android 4.2.2, Nexus 4 and I would like to setup an adhoc network. Firstly I rooted the device, secondly I tried to create an adhoc network in Android phone: I create an adhoc network in an Android smartphone like below:

shell@android:/ # ip link set dev wlan0 down
shell@android:/ # iwconfig wlan0 mode ad-hoc
shell@android:/ # iwconfig wlan0 channel 6
shell@android:/ # iwconfig wlan0 essid 'Test1'
shell@android:/ # ip link set dev wlan0 up
shell@android:/ # ifconfig wlan0 192.168.65.129

when I typed iwconfig wlan0: the result is:

Qcom:802.11n ESSID:"Test1"
Mode:Ad-Hoc Frequency:2.437 GHz Cell: 02:82:5F:C1:4B:C1
Bit Rate=0 kb/s Tx-Power=0 dBm    
RTS thr=2347 B Fragment thr=8000 B
Encryption key:off

Secondly, in my laptop, I could see "Test1", so I connected to "Test1" and I configured a static ip address 192.168.65.128. In this case, the smartphone created the ad hoc network and my laptop joined it, then I can ping from my laptop to mobile and vice-versa.

However,in other case when my laptop creates the ad hoc network and later in an Android mobile, I tried to join it :

shell@android:/ # iwconfig wlan0 mode ad-hoc
shell@android:/ # iwconfig wlan0 channel 6
shell@android:/ # iwconfig wlan0 essid 'Test1'

But, when I type iwconfig wlan0, ESSID is still off/any.

Qcom:802.11n ESSID:off/any
Mode:Ad-Hoc Frequency:2.437 GHz Cell: Not-Associated
Bit Rate:0 kb/s Tx-Power=0 dBm
RTS thr=2347 B Fragment thr=8000 B
Encryption key:off

It seems that an Android mobile can create an adhoc network but can not join an existing one. I found the same result when I tried to setup adhoc network between two Android mobiles. Can anybody tell me what is wrong here, and if there is any possible solution, I tried many methods to setup an adhoc network in Android, and only this method seems to work, but there's still something wrong that prevents an Android phone from joining an existing adhoc network.

  • 1
    Please take a look at the ad-hoc-networks tag-wiki and frequent questions first. It's correct that Android usually doesn't support ad-hoc mode by default, but there are several solutions available and already mentioned. – Izzy Jun 24 '13 at 19:07
  • I have already tried many solution ,but this method is only one that works for me,but it still the problem to join existing ad hoc network – user2515490 Jun 25 '13 at 9:31
3

As far as I understand your question, you have successfully created an adhoc network on your Nexus and your laptop is able to connect.
Now you want to create an adhoc network on your laptop and you want to connect your Nexus to it.

After doing some research, I've found out that Android does not work (well) with adhoc networks.
There are some custom ROMs which have enabled the Ad Hoc function.
From what I've been reading, mako bb-8 and AOKP will be able to do Ad Hocs.
I think CyanogenMod has also a modified wpa_supplicant to support Ad Hoc networks.

If you don't want to flash a custom ROM, you could try to rip the wpa_supplicant (from the same Android version you are using) from one of the custom ROMs mentioned before. You could also try to install WiFi Ad Hoc enabler for Android, which might work for you.
If that doesn't work, you could try another method, which is harder. Check it out here.

I also found this, I don't think it'll work, but worth mentioning:
http://forum.xda-developers.com/showthread.php?t=1591207

| improve this answer | |
  • Maybe because Android does not support that for ad-hoc networks? It might do on some selected devices, but AFAIK those are only few. – Izzy Jun 24 '13 at 19:08
  • yes ,I tried already with GUI and with static IP address,it still said "Not in range",it not the problem in my laptop ,because I can join it from iphone or other laptop. – user2515490 Jun 25 '13 at 9:22
  • Did you try other (non-Android) devices? Or does this problem only persists on Android devices? – Tom Jun 25 '13 at 9:23
  • it's only with android devices, – user2515490 Jun 25 '13 at 9:24
  • I edited my question. – Tom Jun 25 '13 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.