LOADING

Type to search

Android Arena featured Linux Tutorials

Procedure to create Wifi Hotspot on Linux |Creating Wireless Access point on Linux [Ubuntu/LinuxMint/Fedora/OpenSUSE]

Share

Many times, we need to share our Internet Connection to our mobile devices/other laptops or gadgets, but we do not have a wifi router or wireless access point at our disposal. In such cases we can use our PC/laptop itself as a wireless access point to share the internet connection to other devices, and its free and doesn’t require any extra hardware too. while Windows OS contains softwares such as connectify.me,virtual router which do the same, Linux on the  other hand has fewer alternatives, one of those alternatives is : hotspotd by [email protected] . Lets have a look on how to create wifi hotspot linux . I have personally tested this on Ubuntu and LinuxMint but it should work on most linux distros.

Hotspotd is a small daemon to create a wifi hotspot on linux, it works by creating a virtual NAT (Network address transation) table between your connected device and the internet using linux iptables.

Requirements/Pre-requisites for using hotspotd to create access point

  • dnsmasq (typically pre-installed on most linux distributions).
  • hostapd for AP provisioning.

hostapd must be installed for hotspotd to be installed, you can install hostapd by running these commands in the terminal —

For Ubuntu based terminal command issudo apt-get install hostapd

And for RHEL based distros

terminal command : yum install hostapd

hostapd install is quick in process and will get processed in 2 seconds maximum :)shown in the figure below – .

Now after you have installed hostapd , we need to install our hotspot app – hotspotd

Installation of hotspotd –

To install hotspotd, just follow these steps: , type them one by one in the terminal :

First of all we will download the hotspotd package from wget command –

wget https://github.com/prahladyeri/hotspotd/raw/master/dist/hotspotd-0.1.tar.gz

Now,we uncompress the tar file and navigate to the extract directory –

tar xvf hotspotd-0.1.tar.gz
cd hotspotd-0.1/

Here, in this installation directory we give the setup command from the terminal by —

sudo python setup.py install

If everything goes fine, hotspotd will be installed successfully :)

Using the Hotspot

To start hotspot:

sudo hotspotd start

To stop hotspot:

sudo hotspotd stop

The first time you run hotspotd, it will ask you for configuration values for SSID, password, etc. Thus enhancing the security of your hotspot and giving you more customizable options to play with :)

Alternatively, you may also run:

sudo hotspotd configure

Precutionary Measures / Troubleshooting

  • Make sure all dependencies (hostapd, dnsmasq and python 2.7) are installed.
  • hotspotd creates the NAT by manipulating iptables rules. So if you have any other firewall software that manipulates the iptables rules (such as the firewalld on fedora), make sure you disable that.
  • To create a hotspot, your wifi must support AP mode. To find that out, use this process:
    • Find your kernel driver module in use by issuing the below command:lspci -k | grep -A 3 -i network(example module: ath9k)
    • Now, use the below command to find out your wifi capabilities (replace ath9k by your kernel driver):modinfo ath9k | grep depend
    • If the above output includes “mac80211” then it means your wifi card will support the AP mode.

Rejoice, Now you  can use and share your Internet Connection on as many devices as you want  :) also, you can create a wifi hub for Gaming too :) , If any doubts/queries/suggestions feel free to comment :)

51 Comments

  1. jv September 1, 2014

    Tested and this works in Ubuntu 14.04, but not in Fedora 20. The hardware was same. Have you tested this on Fedora?

    Reply
    1. Chaitanya September 1, 2014

      Yes, i tested in Fedora but i tested it on Fedora 18 🙁 , it should work on 20 though, what’s the error which is showing up?

  2. jv September 1, 2014

    No errors, but can not see the hotspot (SSID) there as I can see on Ubuntu. Command ‘sudo hotspotd start’ says the hotspot is running, but looks like actually not.

    Reply
    1. Chaitanya September 1, 2014

      Might be a missing library issues, i will google and let you know if i find the solution :), am extremely sorry for the inconvenience caused 🙁

  3. Ajay rai September 27, 2014

    Traceback (most recent call last):
    File “/usr/local/bin/hotspotd”, line 9, in
    hotspotd.main(sys.argv[1:])
    AttributeError: ‘module’ object has no attribute ‘main’

    Reply
  4. Francis October 20, 2014

    Hi there .I followed every step but still does not work on opensuse 13.1 . I get this python error whenever i try to start or stop the hotspotd.

    Traceback (most recent call last):
    File “/usr/bin/hotspotd”, line 9, in
    hotspotd.main(sys.argv[1:])
    AttributeError: ‘module’ object has no attribute ‘main’

    Kindly assist

    Reply
  5. Divya November 4, 2014

    Traceback (most recent call last):
    File “/usr/local/bin/hotspotd”, line 9, in
    hotspotd.main(sys.argv[1:])
    AttributeError: ‘module’ object has no attribute ‘main’

    Reply
    1. Chaitanya November 4, 2014

      Hi Divya, can we know the GNU Linux distro which you’re using?

      1. Divya November 4, 2014

        Yes, It is LinuxMint 16 .

  6. Divya November 4, 2014

    Yes, It is LinuxMint 16 .

    Reply
    1. Chaitanya November 4, 2014

      It should work in LinuxMint 16 🙁 as it worked for me in the first go .. Do Make sure all dependencies (hostapd, dnsmasq and python 2.7) are installed and please check whether your hardware supports AP mode. will try to check for bugs in the code till then..

      1. Divya November 4, 2014

        Thanks for your response I was searching throughout internet and got to know that
        my hardware was not supportive I am having Dell 1525 inspiron .

        I did try your precautions and troubleshooting tips which was as follows

        lspci -k | grep -A 3 -i network
        0b:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)
        Subsystem: Intel Corporation Device 1020
        Kernel driver in use: iwl3945
        [email protected] ~ $ modinfo iwl3945 | grep depend
        depends: iwlegacy,cfg80211,mac80211

        Finally , I got a s/w which tells me that my wireless card does not support AP mode.

        the command is as follows for this I have to install ap-hotspot

        sudo ap-hotspot configure
        [sudo] password for divya:
        Sorry, try again.
        [sudo] password for divya:
        Your wireless card does not support Access Point mode

        Thanks for Helping.

        1. Chaitanya November 4, 2014

          Thank you Divya for the new software for hotspot, sorry to hear that the hardware doesn’t provide support 🙁

  7. shrihari November 7, 2014

    when i enter the command cd hotspotd-0.1/ it says there is no such filr or directory.
    am using dell xps l502x…ubuntu14.04…what can i do now?

    Reply
    1. chetan November 9, 2014

      It is hotspotd-0.1.1/

  8. chetan November 9, 2014

    It is showing me this error please help.. I am using Lenovo Flex 14,ubuntu latest version

    [email protected]:~$ sudo hotspotd start
    Traceback (most recent call last):
    File “/usr/local/bin/hotspotd”, line 9, in
    hotspotd.main(sys.argv[1:])
    AttributeError: ‘module’ object has no attribute ‘main’
    [email protected]:~$ sudo hotspotd configure
    Traceback (most recent call last):
    File “/usr/local/bin/hotspotd”, line 9, in
    hotspotd.main(sys.argv[1:])
    AttributeError: ‘module’ object has no attribute ‘main’
    [email protected]:~$

    Reply
    1. Chaitanya November 9, 2014

      Hi Chetan, i guess your wi-fi adapter doesn’t support hosted networks, there’s a solution to a similar problem faced by divya, posted by her in comments. can you try that and tell us the results?

      1. chetan November 9, 2014

        Yeah I tried that one too..
        Heres what I got-

        [email protected]:~$ sudo ap-hotspot configure
        Detecting configuration…
        Detected eth0 as the network interface connected to the Internet. Press ENTER if this is correct or enter the desired interface below (e.g.- eth0, ppp0 etc.):

        Detected wlan0 as your WiFi interface. Press ENTER if this is correct or enter the desired interface (e.g.- wlan1):

        Enter the desired Access Point name or press ENTER to use the default one (myhotspot):
        myhotspot1
        Enter the desired WPA Passphrase below or press ENTER to use the default one (qwerty0987):
        12345678
        [email protected]:~$

        1. chetan November 9, 2014

          It supports.. Mine is lenovo flex 14, I bought it last month only It must support ..! I think there is any other error can you help me out??

  9. govind November 14, 2014

    step by step guide
    how to create wi-fi hotspot in Linux
    http://linux-all-over.blogspot.in/2014/10/how-to-create-wi-fi-hotspot-in-linux.html

    Reply
  10. levy November 21, 2014

    [email protected]:~$ sudo hotspotd start
    Verifying interfaces
    done.
    applying hostapd workaround for ubuntu trusty.
    done.
    created interface: mon.wlan0 on IP: 192.168.45.1
    wait..
    enabling forward in sysctl.
    net.ipv4.ip_forward = 1
    creating NAT using iptables: wlan0eth1
    running dnsmasq
    hotspot is running.
    But I don’t see the hotspot (as jv).

    Reply
    1. levy November 22, 2014

      I have seeb in run.dat that the driver is supposed to be nl80211.
      This is not my driver. So I have change this line with
      driver=iwl4965
      But with the same deceiving result : no hotspot.

  11. mithu December 11, 2014

    sudo hotspotd configure
    [sudo] password for lazycoder:
    Verifying connections
    Wifi interface found: wlan0
    0 eth0
    1 ppp0
    Enter number for internet supplying NIC :

    i have done all the above command step by step and at last it came down to this . what is this number for internet supplying NIC ? someone care to explain to me . thnx .

    Reply
    1. mithu December 11, 2014

      got it , now running my hotspot , great post , thanx for the step by step guide . many thnx

      sudo hotspotd start
      Verifying interfaces
      done.
      created interface: mon.wlan0 on IP: 192.168.45.2
      wait..
      stopping dnsmasq
      enabling forward in sysctl.
      net.ipv4.ip_forward = 1
      creating NAT using iptables: wlan0ppp0
      running dnsmasq
      hotspot is running.

    2. Priya July 16, 2015

      Just enter 1

  12. harikrishna January 17, 2015

    Wow. Worked for me. Thank you.

    Reply
  13. Bhavik January 27, 2015

    hotspot is running…..

    but cnt find my ssid on wifi device when i scan for it

    Reply
  14. hollemukhlish February 7, 2015

    i followed all steps but my device (iphone) could not detect any wireless connection. whats happen? any suggestion?

    Reply
    1. Chaitanya February 7, 2015

      Hello Mukhlish, is the wireless connection visible in any other phone ?

  15. Ryan Fadillah February 12, 2015

    hi i followed all step until sudo hotspotd start, but i stop at enter ip address, what should i do?
    -sorry bad english

    Reply
    1. Chaitanya February 12, 2015

      Hello Ryan, Please enter any IP address there e/g 192.168.0.1 🙂

      1. Ryan Fadillah February 13, 2015

        thank you very much sis

        1. Chaitanya February 13, 2015

          Ryan , you can call me bro 😛 i’m male 🙂

  16. Ryan Fadillah February 13, 2015

    oh sorry my fault :D, i have another question, how to change ip name and password?
    thank before for your answer

    Reply
    1. Chaitanya February 17, 2015

      Hello Ryan, can you tell us your linux distro ? so that we can help you better . thanks!

      1. Ryan Fadillah February 21, 2015

        i use ubuntu 14.04 32 bit

  17. Jobin February 28, 2015

    Yes, due it works! awesome.
    thank you so much.

    I’m using Linux Minit 17 and HP Pavilion g6

    Reply
  18. srinivas March 20, 2015

    hai, when i am running “sudo sudo hotspotd start” i am getting below error

    [email protected]:~/Downloads/hotspotd-0.1.4$ sudo hotspotd start
    Verifying connections
    Wireless interface could not be found on your device.
    Traceback (most recent call last):
    File “/usr/local/bin/hotspotd”, line 22, in
    hotspotd.main.main(args)
    File “/usr/local/lib/python2.7/dist-packages/hotspotd/main.py”, line 302, in main
    dc =json.load(open(‘hotspotd.json’))
    IOError: [Errno 2] No such file or directory: ‘hotspotd.json’

    i am using ubuntu 14.04 pc and my system having wired connection.

    Reply
  19. Vrk Jake July 6, 2015

    Can I make a hotspot from a wifi connection? Or is an ethernet connection necessary? I know its stupid. 😀

    Reply
  20. Jason August 2, 2015

    Hello.
    I am following step by step, and everything seems to be working as expected, except that when the hotspot is set up running, I can’t connect to it on my iphone. It can scan the hotspot, but every time I tried to connect the phone gives me an incorrect password error.

    I’ve verified that the card supports AP mode, in fact I can set up a wifi hotspot using Linux mint’s network manager by simply clicking on the “Create a wireless hotspot” button and in that way I am able to connect from the phone. The problem is that the password is generated randomly, and I need something that is fixed so that I can let my rasberry pi to connect when running headless.

    Please help.

    Reply
  21. shiva August 13, 2015

    Wifi name is not discoverable in any device kindly help me

    Reply
  22. arie geerdink February 12, 2016

    installed perfectly ran perfectly but can not be seen by other computers on the network 🙂

    Reply
  23. Julio Ontiveros March 23, 2016

    Hi to everyone who does not “sees” the AP on the devices make sure your firewall is disabled and I entered to the file declared in the running script such as
    “hostapd -B /usr/lib/python2.7/site-packages/hotspotd/run.conf” making the file to edit “run.conf”
    look for interface=wlan0 and change it to interface= in my case was interface=wlp2s0
    and it worked right away

    Reply
  24. paras jain April 10, 2016

    when i typed “tar xvf hotspotd-0.1.tar.gz
    cd hotspotd-0.1/”
    it is showing “”tar: hotspotd-0.1.tar.gz: Cannot open: No such file or directory””
    can you help me with that

    Reply
  25. Hemavathy May 27, 2016

    My Hotspot detected, but unable to connect with Internet..:(…Please help me to solve this..

    Reply
  26. arun August 17, 2016

    It is working fine and thanking u..

    Reply
  27. POORNENDRA KUMAR RAI August 23, 2016

    hey bro i tried it on ubuntu it worked for me but now how could i stop this daemon to use my home wifi

    Reply
  28. Ioanna October 4, 2016

    Dear all, is this AP capable or not, please shade some light on my ignorence. I have setup everything but not working
    [email protected]:~/Desktop$ lspci -k | grep -A 3 -i network
    02:00.0 Network controller: Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01)
    Subsystem: Hewlett-Packard Company BCM4312 802.11b/g Wireless LAN Controller
    Kernel driver in use: wl
    07:03.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5788 Gigabit Ethernet (rev 03)
    [email protected]:~/Desktop$ modinfo NetXtreme BCM5788 | grep depend
    modinfo: ERROR: Module NetXtreme not found.
    modinfo: ERROR: Module BCM5788 not found.
    [email protected]:~/Desktop$ modinfo BCM5788 | grep depend
    modinfo: ERROR: Module BCM5788 not found.
    [email protected]:~/Desktop$ modinfo wl | grep
    depend
    depends:cfg80211

    I appreciate your kind help,
    Ioanna (female)

    Reply
  29. JAIARJUN December 26, 2016

    i hav centOS 6 and i’m new to it . In that when am entering this – “yum install hostapd” .
    it shows Loaded plugins: fastestmirror, refresh-packagekit, security
    Setting up Install Process
    Loading mirror speeds from cached hostfile
    * base: centos.excellmedia.net
    * extras: centos.excellmedia.net
    * updates: centos.excellmedia.net
    base | 3.7 kB 00:00
    extras | 3.3 kB 00:00
    updates | 3.4 kB 00:00
    No package hostapd available.
    Error: Nothing to do

    now what i should do to make this.

    Reply
  30. harish February 2, 2017

    Thank you..

    Reply
  31. Vivek sharma June 6, 2017

    [[email protected] vivek]# sudo hotspotd start
    You need root permissions to do this, sloth!
    ?????????
    I’m already logged in as root.

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: