Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How to setup an Access Point mode Wi-Fi Hotspot?

Point to be noted: Wireless hotspots aren't same as ad hoc networks. Significant difference is there. In short, ad hoc networks aren't supported in most Android, Windows Phone and Blackberry devices (and may be iOS devices too) whereas AP mode Wi-Fi hotspots are. To get an idea about AP mode hotspots, ad hoc networks and their difference, refer this and this.

share|improve this question
iOS devises does support ad-hoc networks. But they disconnect whenever you turn off the screen. –  leo Aug 28 '13 at 18:41

4 Answers 4

up vote 67 down vote accepted

Whether your wireless card support Access Point mode.

First thing to be done is perform the test whether your wireless card support going into wireless access point mode. As told earlier following test is for mac80211 framework based driver.

Install iw & execute following

sudo aptitude install iw
iw list

Look for supported interface section, where it should be a entry called AP like below

Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
         * mesh point

If your driver doesn't shows this AP, It doesn't mean it can't create wireless hotspot. But those cards aren't in scope of this tutorial. For more tests follow ubuntu documentation on master mode.

The setup is divided in three sections,

  1. Setup & host a wireless network
  2. IP address setup
  3. Internet sharing

1.Setup and host a network

  • Software required: hostapd Install hostapd (install it)
  • Press alt + F2 and type gksu gedit & press enter. We are going to edit a lot of files.
  • In gedit, press ctrl+o, ctrl+l & paste it in location box /etc/hostapd/hostapd.conf. Press Enter.
  • Paste the following code,


Please make sure there are no trailing white space and the end of the line! Hostapd is very sensitive to ending white spaces that are hard to troubleshoot!

Changes you need to do:

  1. Change interface=wlan0 to your wireless card name. (If you have one wireless card it should be wlan0)
  2. ssid=test. test is the name of your hosted network.
  3. wpa_passphrase=1234567890, 1234567890 is the password of your network.

The configuration above creates a wpa & wpa2 enabled access point in g mode. A more detailed instruction to build configuration file can be found here

Now start the hostapd. Edit the file /etc/default/hostapd and modify the line of DAEMON_CONF like this:


Then start the hostapd service using the following command,

sudo service hostapd start

It should start a wireless network. In your mobile device now you can see a wireless network and can authenticate. But the device won't get IP address. Stop it with the command sudo service hostapd stop

If you get any error, possibly your card doesn't support g mode. Try with other >modes. Guide

Part 2: Set up DHCP server for IP address management

Install isc-dhcp-server Install isc-dhcp-server

Edit the file /etc/default/isc-dhcp-server and set INTERFACES like this:


In gedit, press Ctrl+O, in location box paste /etc/dhcp/dhcpd.conf Find (ctrl+F) below lines and put # before it. It should look like after editing

# option definitions common to all supported networks…
#option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;

Again comment out following lines too

#default-lease-time 600;
#max-lease-time 7200;

Add following lines at end

subnet netmask {
        option domain-name-servers,;
        option routers;

Range describe how long the address pool will be. you need to adjust subnet value also. This config can give IP up to 15 devices

Again press Cctrl+O in gedit and paste following in location bar /etc/network/interfaces, Add below

auto wlan0
iface wlan0 inet static

wlan0 is your wireless interface. Change it accordingly.

Note: After reboot the wireless will be shown as not managed. So you can't use any other wi-fi network. To get wireless with normal behaviour, put # before those newly added line and execute sudo start networking

now run

sudo service isc-dhcp-server start

sudo service hostapd start

At this point , your mobile device will see a network, authenticate it & after authentication it will get ip address something like

Setup internet connection settings

For Internet connection sharing we need ip forwarding and ip masquerading. Enable ip forwarding : execute

echo 1| sudo tee /proc/sys/net/ipv4/ip_forward

Now say you are using to a dial up/usb modem connection to connect to INTERNET. You need to get the logical interface name. For that execute ifconfig or ip address

For dialup/usb modem: it should be ppp0. If you want to share Ethernet connection you should use ethXwhere X is your ethernet device number. If you are connecting to internet through an android device with USB tethering, then the interface name should be usb0.

Now once you get the interface name execute sudo iptables -t nat -A POSTROUTING -s -o ppp0 -j MASQUERADE

The ppp0 in above command is the interface whose internet connection you are sharing over wireless.

If you have edited upto /etc/network/interfaces you can use this script to start the service. Edit it if you are not sharing ppp0. if you are using script and want to stop the server, use sudo killall hostapd

A blog that is mostly a summary of what has been described here: http://dashohoxha.blogspot.com/2013/06/how-to-setup-wifi-access-point-on-ubuntu.html

A script that tries to automate the steps described here: https://gist.github.com/dashohoxha/5767262

Please feel free to report or fix any bugs that you notice.

Great helps from :

share|improve this answer
I could connect to hotspot and authenticate. But I am not able to receive an IP. Could you help me out? –  neo Mar 2 '13 at 14:30
@neo have youcommented out the lines in config –  Web-E Mar 2 '13 at 15:25
I did. I actually tried the whole process twice, just to make sure I did not do it wrong the first time. –  neo Mar 3 '13 at 14:07
Neo is right. There is something definitely wrong with ubuntu. This has recently stopped working! –  Indian Apr 5 '13 at 19:09
@Web-E This should be documented at Ubuntu community wiki for hostapd. May be a separate section under sharing Mobile Broadband? –  Khurshid Alam Jun 3 '13 at 9:10

I too had the same problem. The best solution I could find is to use ap-hotspot for creating a hotspot of the ubuntu machine. It works fine for connecting to almost all android, windows phones, etc.

To install it:

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install ap-hotspot

Next, to start the hotspot:

$ sudo ap-hotspot start

It asks you which adapter's internet you want to share, name of the network, password, etc. in an interactive manner.

To stop the hotspot :

$ sudo ap-hotspot stop

To configure it:

$ sudo ap-hotspot configure

If any problem, hope this link helps.


For now it seems there is some problem with Ubuntu 14.04, and as specified in the webupd8.org article linked, you have to downgrade hostapd:


cd /tmp
wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_amd64.deb
sudo dpkg -i hostapd*.deb
sudo apt-mark hold hostapd


cd /tmp
wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_i386.deb
sudo dpkg -i hostapd*.deb
sudo apt-mark hold hostapd
share|improve this answer
Dude, that worked like a charm! –  Milkncookiez Nov 12 '13 at 22:24
I followed the instructions on the previous answer and found that my wireless card was not supported for access point mode. But ap-hotspot still worked perfectly. So my advise would be to just install ap-hotspot and see if it's working –  Hashken Dec 10 '13 at 14:34
It works for me if I stop network-manager with sudo stop network-manager before starting ap-hotspot. Thanks! –  Rmano Dec 18 '13 at 15:51
You have to turn the wireless on the computer on first, but not connect it to anything - This works brilliantly :-) -But I will say that I could just use the default Use as Hotpot button in Fedora 19 (other half off dual boot) –  Wilf Jan 2 '14 at 11:10
Didn't work for me. When I try connecting with my iPhone, it can connect and give a password successfully, but it never gets past that. –  Seanny123 Jan 10 '14 at 7:29

Ubuntu 14.04LTS

Step 1: Test whether your WiFi card supports AP mode

Follow the Access Point mode check in the answer provided by Web-E

Step 2: Configure Hotspot

Search Network in Dash and open it. Press the "Use as Hotspot" button and Network Manager will start an AdHoc hotspot.


But that's not what we want, is it? ;-) Stop the hotspot. Open Network Connections from Dash or 'Edit Connections' from Network Indicator menu.

Edit Connections

In the Network Connections window that appears, there'll be a connection named Hotspot listed under the WiFi section. Select it and click the "Edit" button.

Network Connections

In the window that appears, you can edit the broadcast name (SSID) and password of your hotspot. If you don't want to set a password, you can set the security to none and thus create an open hotspot. If you're setting a password, it's recommended to change the security key from WEP to WPA2.

Edit Hotspot Name and Password

Save and close the Network Connections window after doing the configurations. Now, it's time to do a tweak, the most important part of this configuration. Open the Terminal and run this command:

sudo gedit /etc/NetworkManager/system-connections/Hotspot

and the configuration file will be opened in text editor. Find a line beginning with mode= and change it to mode=ap and save the file.

Step 3: Start Hotspot

Now that the configuration part is over, we'll start the hotspot. Click on 'Create New Wi-Fi Network' from Network Indicator menu.

Create New WiFi Connection

In the window that appears, click on the connection drop-down button and change "New..." to "Hotspot". Press the "Create" button and your hotspot will start running. From now on, whenever you need a hotspot, you just need to do this step i.e Step 3 only.

Start Hotspot


Ubuntu 14.04LTS "Trusty Tahr"'s default Network Manager (network-manager v9.8.8) already has the ability to start Access Point mode WiFi hotspot. But the problem is that, support for AP mode hotspot haven't yet been implemented in Network Manager's Gnome frontend. This means that you can't create an AP mode Hotspot directly from the GUI, atleast for now. But, Network Manager's KDE frontend has already implemented support for AP mode hotspots. This is why Kubuntu and other KDE based distro users can directly start AP mode hotspots, even though they're having the same version of Network Manager backend. You may install KDE's Network Manager frontend to edit hotspot configuration, as described in this blog - Create WiFi Hotspot in Ubuntu 14.04 using KDE's Network Manager. Though Fedora uses Gnome Shell, it's Network Manager gnome applet is patched with AP support. Infact, Fedora had AP mode support long since Fedora 18, with real-hotspot patch for it's network-manager v0.9.6. Let's hope Ubuntu will also create a similar patch to start AP mode hotspots directly from Network Manager GUI and make our lives easier! :-)


Ubuntu 12.04LTS

  1. First start Ubuntu's default Adhoc hotspot through Network Manager.
  2. Then follow the AP mode check and Step 1 from the answer provided by Web-E.

After doing the above, run this command:

sudo service hostapd start

and the Access Point will be up and ready for connection! No need to go through Step 2: Set up DHCP server for IP address management and Step 3: Setup internet connection settings as they have already been done by Network Manager. Hostapd simply reuses the existing settings done for the Adhoc hotspot. If anything goes wrong, run the following command to see debug messages:

sudo hostapd -dd /etc/hostapd/hostapd.conf

This method was suggested by Jatin Dhankhar on Open Source for You magazine.


  • You just need to configure hostapd only. No need to manually do DHCP IP address management using dnsmasq/isc-dhcp-server and Internet sharing using ip forwarding and ip masquerading.
  • Doesn't have problems like ap-hotspot script's dnsmasq conflict and subsequent IP management issues.


  • Works only if Wireless card supports both AP mode and IBSS(AdHoc) mode!
  • Still not as easy as GUI solutions like Connectify, Virtual Router, real-hotspot patch,etc.
share|improve this answer
Coolest easy steps @HEXcube –  Amit Rane Aug 18 '14 at 7:32
I had completed the 3 steps described by @Web-E but my android phone wouldn't connect, perennially trying to "obtain ip address." Then I just did the "mode=ap" change in /etc/NetworkManager/system-connections/my_wifi_connection_name suggested by HEXcube and got connected instantly. My Ubuntu is 13.10 64bit on Acer laptop Aspire E1-531. –  Sri Sep 9 '14 at 18:51
The ip_forward and masquerade commands were executed as part of Web-E's steps - should we revoke them? If yes, how? –  Sri Sep 9 '14 at 19:05

Now, here's a method that's simple and will definitely do the job.

Install KDE Connection Editor

Open Terminal (Ctrl+Alt+T) and type the following commands, one after the other.

$ sudo apt-get install plasma-nm
$ sudo apt-get update

Now, you've just installed KDE Connection Editor.

Let's create a Wi-Fi Hotspot.

Create a Wi-Fi Hotspot (Access Point mode)

1.Now open the installed application by either,

  1. Search(Alt+F2) for kde-nm-connection-editor( You'll it as soon as you start typing kde).


  2. Open it manually from the Terminal.

    $ sudo kde-nm-connection-editor

2.Now click + Add and select Wireless (shared)

Adding A new connection

3.Now, you'll see the below window.

Connection setup tab

SSID: Give a name for your new Hotspot

Mode: Select Access Point

Cloned MAC address: Click Random button to generate a random MAC address.

Everything else should be already set to fine.

4.Now let's go to the Wireless Security tab.

WPA Password tab

Select WAP & WPA2 Personal and type your password.

Click Ok.

5.Now your connection is ready.



share|improve this answer

protected by Community Nov 18 '12 at 22:02

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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