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.