How to Enable Ad-hoc Connection on your Android

Hello,
I was searching for a long time how to enable ad-hoc connections on my HTC chacha and finally I found it!, so I decided to share my experience with you.
btw I found many ways but guess what?! most of them didn’t work 🙁

lets stop talking and start enjoying the unlimited internet connection on your mobile 🙂

Ubuntu Users

First of all you had to install hostapd

“In simple words, hostapd allows you to create software wifi access points allowing decent amount of configuration options. In rest of this post, I will show how to create a software access point in Linux using hostapd and share your internet to the devices through it”

To Install hostapd just type this command on the terminal

sudo apt-get install hostapd

Then, open a text editor program, for example gedit. Copy the following into it.

interface=wlan0
driver=nl80211
ssid=MyAP
hw_mode=g
channel=11
wpa=1
wpa_passphrase=MyPasswordHere
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

Please don’t forget to fill in the name of your network after “ssid=”, as well as the password after “wpa_passphrase=”.

After all these, save the file as hostapd.conf in your home folder.

Then create a normal ad-hoc network from the wireless menu from the top bar click on “Create New Wireless Network

after the new network created successfully proceed to the next and the final step

Now, in your terminal:

sudo hostapd hostapd.conf

Turn the wifi connection on in your devices and enjoy the fast network share!

Windows Users

You can install Virtual Router

Project Description

Virtual Router turns any Windows 7 or Windows 2008 R2 Computer into a Wifi Hot Spot using Windows 7’s Wireless Hosted Network (Virtual Wifi) technology.

What is Virtual Router?

Virtual Router is a free, open source software based router for PCs running Windows 7 or Windows Server 2008 R2. Using Virtual Router, users can wirelessly share any internet connection (Wifi, LAN, Cable Modem, Dial-up, Cellular, etc.) with any Wifi device (Laptop, Smart Phone, iPod Touch, iPhone, Android Phone, Zune, Netbook, wireless printer, etc.) These devices connect to Virtual Router just like any other access point, and the connection is completely secured using WPA2 (the most secure wireless encryption.)

Download Virtual Router

http://virtualrouter.codeplex.com/downloads/get/93540

 Preparing your Wireless Connection

After installing Virtual Router and restarting, open the application this window will appear

Type your network name ,, and your password ,, choose network to share ,, and click on Start Virtual Router

Turn the wifi connection on in your devices and enjoy the fast network share!

 

Resources

http://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/

http://exain.wordpress.com/tag/hostapd/

http://zhangyou.wordpress.com/2010/08/26/easily-turn-your-ubuntu-into-a-virtual-router/

http://virtualrouter.codeplex.com

You may also like

62 Comments

  1. Great job!
    It worked perfectly for me and is completely secure with WPA encryption. Thanks a lot!

    Just FYI, the first time, I had to try twice to get my HTC wildfire S connected. Now, it works directly.

  2. Hi. My HTC sensation has detected the wifi network,and i got connected to it successfully. However i cannot surf internet on my HTC. its like, its just connected to the wifi, not the internet. 🙁

  3. I can do it when i use ubuntu 12.04, but it is failed to be done in ubuntu 12.10. So I retry it, but there is only isc-dhcp-server instead of dhcp3-server. Now my kindle can search this wifi, but cant connect. can you give me some advice?

    1. so another hack is to create an adhoc connection from “Create New Wireless Network” , and when the connection established run the commend “sudo hostapd hostapd.conf” and you can now connect to this network =)) ,, hope this work with you

  4. Thanks very much! It worked for galaxy s (gt-i9003) w kubuntu 12.12. But due to “kernel bugs” I couldn’t set up adhoc wireless + WAP on network_management. I created an unsecured one. Is it unsecured indeed?

      1. Thanks a lot for the answer! But maybe I was not clear. My hostap.conf is exactly the one you suggested, with the wap lines.

        Connecting from my android, for example, it asks for the wap password.

        It is just the adhoc on kubuntu (I needed to set up to obtain IP) which is not wap (nor wep).

        My question is whether I am safe or not.

  5. Thank you very much but … it doesn’t work for me…
    I have Ubuntu 12.04 and when I run “sudo hostapd hostapd.conf” on my terminal, it says this:

    Configuration file: hostapd.conf
    Could not set interface mon.wlan0 flags: Operation not possible due to RF-kill
    nl80211: Failed to set interface wlan0 into AP mode
    nl80211 driver initialization failed.
    ELOOP: remaining socket: sock=4 eloop_data=0x9a198f8 user_data=0x9a19e98 handler=0x807c5e0
    ELOOP: remaining socket: sock=6 eloop_data=0x9a1bca0 user_data=(nil) handler=0x8086770

    Have you any idea…?
    Thank you!!!!!

      1. Hi, But for me, it says..

        Could not read interface wlan0 flags: No such device
        nl80211 driver initialization failed.
        ELOOP: remaining socket: sock=4 eloop_data=0x86e38f8 user_data=0x86e3e98 handler=0x807c5e0
        ELOOP: remaining socket: sock=6 eloop_data=0x86e5d28 user_data=(nil) handler=0x8086770

        Help!

  6. hello, i have just installed virtual hotspot 1.2 application to my windows xp and after that my i phone easily connected to it but galaxy note 1 is not even finding the hotspot name in available network list….
    pl help.

  7. I tried this on my ubuntu 12.04 but my galaxy ace watch the connection but it does’t take an ip, must i do something with dhcp?

  8. It continuous to show ‘Obtaining IP address’ in my micromax A110. I’m using ubuntu 12.10. Should I add anything to the above steps?

  9. Its stuck at
    “Configuration file: hostapd.conf
    Using interface wlan0 with hwaddr 68:5d:43:c5:2c:95 and ssid ‘abcds'”
    Any idea to resolve this..
    OS : Ubuntu

  10. cant get the Ip on mySamsung s.
    Terminal says:
    sudo hostapd hostapd.conf
    Configuration file: hostapd.conf
    Using interface wlan0 with hwaddr 00:25:d3:9c:fb:db and ssid ‘Floswlan’
    wlan0: STA 20:13:e0:c6:d7:1b IEEE 802.11: authenticated
    wlan0: STA 20:13:e0:c6:d7:1b IEEE 802.11: associated (aid 1)
    wlan0: AP-STA-CONNECTED 20:13:e0:c6:d7:1b
    wlan0: STA 20:13:e0:c6:d7:1b RADIUS: starting accounting session 5152E85F-00000000
    wlan0: STA 20:13:e0:c6:d7:1b WPA: pairwise key handshake completed (WPA)
    wlan0: STA 20:13:e0:c6:d7:1b WPA: group key handshake completed (WPA)
    wlan0: AP-STA-DISCONNECTED 20:13:e0:c6:d7:1b
    wlan0: STA 20:13:e0:c6:d7:1b IEEE 802.11: disassociated
    wlan0: STA 20:13:e0:c6:d7:1b IEEE 802.11: deauthenticated due to inactivity

    Thanks for help

  11. Problem… 🙁

    using an ubuntu based distro
    pppoe is cofigured with pppoeconf

    my samsung galaxy connects perfectly with wifi but can’t access internet

  12. Perfect! Now I can connect my kindle to sync via my ubuntu shared connection. (using Ubuntu 12.04). Thank you! I connected with no internet sharing though, until I did the hack/tweak mentioned in comment #10.

  13. Configuration file: hostapd.conf
    nl80211: ‘nl80211’ generic netlink not found
    Failed to initialize driver ‘nl80211’

  14. Hello ,

    Really thank you very much for your tutorial , i was very happy to see the (GEEKPEEK) at my android device connected to my ubuntu. but unfortunately , there is no internet in my android device. could you please help me to share the internet.

    when i run the command to start sharing the wirless this line appears:
    Using interface wlan0 with hwaddr 00:c0:a8:ee:f4:48 and ssid ‘geekpeek’

    and after configuring my phone – it has beem connected succefully and these lines appears:
    wlan0: STA 30:85:a9:65:f0:bf IEEE 802.11: authenticated
    wlan0: STA 30:85:a9:65:f0:bf IEEE 802.11: associated (aid 1)
    AP-STA-CONNECTED 30:85:a9:65:f0:bf
    wlan0: STA 30:85:a9:65:f0:bf RADIUS: starting accounting session 51880568-00000000
    wlan0: STA 30:85:a9:65:f0:bf WPA: pairwise key handshake completed (RSN)

    your help is really appreciated.

    All Respect;

  15. Hi,

    I’m able to see the network I set up and my phone is trying to connect to it, but it always stops at the “Obtaining IP address” phase. On the terminal I see

    IEEE 802.11: authenticated
    IEEE 802.11: associated
    AP-STA-CONNECTED
    RADIUS: starting accounting session
    WPA: pairwise key handshake completed (WPA)
    WPA: group key handshake completed (WPA)
    —-(Slight pause here, phone is trying to obtain IP address)—-
    AP-STA-DISCONNECTED
    IEEE 802.11: disassociated
    IEEE 802.11: deauthenticated due to inactivity

    Any ideas?

  16. oh my! this is working wonderfully. I am successfully sharing my wired connection from Ubuntu 13.04 to my 2 android devices! things are looking good.

    Thanks for the write-up!

  17. i’ve only LOCAL AREA CONNECTION in SHARED connection
    also when I click (START VIRTUAL ROUTER) it give : couldnot be started >> 🙁

    help plzz

  18. HI..Thank you for the information.
    As per u i downloaded virtual router on my windows 7 laptop, however when i tried to start it it showing an error as virtual router could not be started.. Can you please help me on this..

  19. I just now couldn’t go away completely your internet-site ahead of suggesting that I definitely cherished the regular details a person offer in your company? Will probably be backside nonstop in an effort to take a look at innovative discussions

  20. Thank you, but it doesn’t work for me, when i run sudo hostapd hostapd.conf from terminal it says

    Configuration file: hostapd.conf
    Could not read interface wlan0 flags: No such device
    Could not read interface wlan0 flags: No such device
    nl80211 driver initialization failed.

  21. I have the impulse 49 for at&t (u8800-51) and my device fails to connect with my adhoc network. Im sending the signal from a laptop and my phone can see it but wont obtain the IP address. IT’S DRIVING ME MADDD!!! Is there a way I can get this thing to connect??

  22. does this work without a wireless modem???????
    i want to access internet in my android tablet but i dont have a wireless modem…. will this solve my problem???????

  23. i downloaded it and installed , but iam not able to fill any of the columns , and its written in the down that “Can not manage virtual router.The service is not running” what should i do , plzz help me????

  24. Sir,
    I want to use my nokia e63 wifi adhoc (joikuspot) connection on micromax canvas hd version 4.2.1.Pls tell me will it work or not.tx in advance

  25. Thanks a lot , but i still have a problem , i have ubuntu 13.10, so when i run hostapd.conf in a terminal i get error :
    ” $ sudo hostapd hostapd.conf
    Configuration file: hostapd.conf
    Line 7: invalid WPA passphrase length 5 (expected 8..63)
    WPA-PSK enabled, but PSK or passphrase is not configured.
    2 errors found in configuration file ‘hostapd.conf’

    where i use hotspot as a username and myhot as a password.
    Sorry iam new for ubuntu , so any help would be great appreciated
    thanks .

  26. this way just change adhoc network to insfrastructure hotspot,
    so that android device can connect to it, and i think i can’t really call this one as adhoc.

    am i wrong??
    and is there another way to connect my android device to adhoc net?

  27. However this solution is not ad-hoc mode wifi. This solution is related to infrastructure mode by creating a virtual wireless access point router. As Stated in many sites, ad-hoc mode needs the android to be rooted

Leave a Reply

Your email address will not be published. Required fields are marked *