How to setup an Access Point (AP) mode Wi-Fi Hotspot?
Point to be noted: Wireless access points aren't the same as ad hoc networks. They differ significantly. In short, ad hoc networks aren't supported on newer devices and most Android, Windows Phone and Blackberry devices (and maybe 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 to this Wikipedia page.
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 followingLook for supported interface section, where it should be a entry called
AP
like belowIf 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 and host a network
gksu gedit
& press enter. We are going to edit a lot of files./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:
interface=wlan0
to your wireless card name. (If you have one wireless card it should be wlan0)ssid=test
.test
is the name of your hosted network.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 hereNow 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
Part 2: Set up DHCP server for IP address management
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 editingAgain comment out following lines too
Add following lines at end
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 belowwlan0
is your wireless interface. Change it accordingly.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
10.10.0.2
.Setup internet connection settings
For Internet connection sharing we need
ip forwarding
andip masquerading
. Enable ip forwarding : executeecho 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
orip address
For dialup/usb modem: it should be
ppp0
. If you want to share Ethernet connection you should useethX
where X is your ethernet device number. If you are connecting to internet through an android device with USB tethering, then the interface name should beusb0
.Now once you get the interface name execute
sudo iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -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 sharingppp0
. if you are using script and want to stop the server, usesudo 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 :
Ubuntu 20.04 LTS and newer
With GNOME 3.36 desktop on Ubuntu 20.04 LTS, WiFi tethering has become easier than ever!? Just open the Wi-Fi Settings from system menu.
In the Wi-Fi Settings window, click on the drop-down menu on top right and select Turn On Wi-Fi Hotspot option.
A dialog will show up, where you can set the name and password for your new hotspot.
If your hotspot gets created successfully, Wi-Fi Settings would now show a section with a toggle for the newly created hotspot.
A hotspot indicator would appear on the top bar as well, showing it's active status.
If you need to edit the hotspot and do more advanced configuration, follow instructions similar to that of Ubuntu 18.04 LTS described below.
Ubuntu 18.04 LTS
GNOME 3.28 desktop on Ubuntu 18.04 LTS makes it easy to start a WiFi hotspot. Open the Wi-Fi Settings from system menu.
And then from the hamburger menu on Wi-Fi Settings, select Turn On Wi-Fi Hotspot. That's it, your WiFi access point is now up and running!
Advanced Stuff
If you wanna change the name (SSID) and password of your access point, open Network Connections editor tool by entering the following in either Terminal or Alt+F2:
Double click on Hotspot and the editor window'll appear. You may change SSID and password from the Wi-Fi and Wi-Fi Security tabs.
Ubuntu 16.04 LTS & 14.04 LTS
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: Start the built-in Hotspot
Network comes with a built-in option to start an Ad-Hoc hotspot. So, let's use this first, so that it could be configured and converted to an Access Point mode hotspot in the next step.
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.
Step 3: Configure Hotspot
Open Network Connections from Dash or 'Edit Connections' from Network Indicator menu.
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.
In the window that appears, you may edit the broadcast name (SSID) of your hotspot. Now comes the most important part of this configuration: change mode to 'Hotspot', which'll finally convert the hotspot to Access Point mode. Users of Ubuntu 14.04 LTS'll notice that this mode isn't available to choose from the dropdown. Don't get disappointed, as you can still do it via an extra Step 3.1.
Save and open the same Editing Hotspot window again. This time go to the WiFi Security tab for selecting password type. If you don't want to set a password, you can set 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. Once the configurations are done, don't forget to save it so that the changes could apply.
In the General tab, make sure that “Automatically connect to this network when it is available” is turned off (unless you only ever use your wifi as a hotspot). Otherwise, since the hotspot is always available, you won't see the menu entries to connect to other wifi networks in the network manager applet.
Step 3.1: Only for Ubuntu 14.04 LTS
Since Ubuntu 14.04 LTS's Networks (
network-manager v9.8.8
) doesn't offer a graphical setting to select AP mode, we'll manually edit it's config file to force the conversion. Copy the following command, then press Alt+F2 or open Terminal and paste it there:Type your password in the authorization dialog that appears and the configuration file will be opened in text editor. Find a line beginning with
mode=
, change it tomode=ap
and save the file.Step 4: 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.
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 4 only.
K.. That's all folks! Have fun with your new Access Point ?
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:
Next, to start the hotspot:
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 :
To configure it:
If any problem, hope this link helps.
EDIT:
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:
64bit:
32bit:
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.
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,
Search(Alt+F2) for kde-nm-connection-editor( You'll it as soon as you start typing kde).
OR
Open it manually from the Terminal.
2.Now click + Add and select Wireless (shared)
3.Now, you'll see the below window.
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.
Select WAP & WPA2 Personal and type your password.
Click Ok.
5.Now your connection is ready.
Enjoy!
one of the easiest way i found is by using create_ap by github user oblique
Prerequisite:
1) hostapd
steps :
then two turn on hotspot
assuming u want to share internet from ethernet with interface name
eth0
using wifi interfacewlan0
, You can use following syntax:for more info and reference
https://github.com/oblique/create_ap
@Web-E's answer was helpful, but also configures the computer as a router. I wanted only an Access Point, since I am already using my ISP's router.
I'm also running Ubuntu Server (18.04.2), so I couldn't use any GUI tools to set this up.
So, what I did was install and configure hostapd as described in this answer and then simply bridged my Ethernet and Wi-Fi adapters. Here are the contents of my `/etc/netplan/01-netcfg.yaml file:
Of course you will need to tweak your config file for your own needs. Just run
sudo netplan apply
afterwards to apply the configuration.