33

Although many questions have already been asked regarding WiFi hotspot, I didn't get any of the solutions working for me.

I connect to the Internet using a 3G Dongle of Huawei 3772 (Vodafone). The connection type is Mobile Broadband connection. I have to share this Internet connection with my other devices like mobile phones and laptops.

How can I create a WiFi hotspot connection for this connection.

I am using Ubuntu 12.04 LTS.

I would like to note that I have already tried some help links from Ubuntu but, they are so confusing that I could not understand them.

54

Creating wifi-hotspot using Unity's default network manager without downloading any tool/software.

The method described in this answer only works if your wireless device supports master mode. To check whether it does, open a console and type

sudo iwconfig wlan0 mode master

Replace wlan0 with whatever Ubuntu calls your wireless device.

If you get an error, your device does not support master mode and this solution unfortunately does not work. Source: Community Help Wiki, this comment.

  1. Disable WIFI and plug in an internet cable or mobile-broadband modem to your Ubuntu so that your Ubuntu is connected to wired or broadband connection and wireless is disabled.

  2. Go to Network Icon on the top panel → Edit Connections, then click the Add button in the pop up windows.

    Edit connection

  3. Choose Wi-Fi from the drop-down menu when you're asked to choose a connection type:

    Choose wifi connection type to wifi

  4. In the next window, do:

    • Type in a connection name. The name will be used later.
    • Type in a SSID
    • Select mode: Infrastructure
    • Device MAC address: select your wireless card from drop-down menu.

    Create wifi hotspot

  5. Go to Wi-Fi Security tab,select security type WPA & WPA2 Personal and set a password.

  6. Go to IPv4 Settings tab, from Method drop-down box select Shared to other computers.

    Wifi IPv4 shared to other computer

When done, click the save button.

After above steps, a configuration file created under /etc/NetworkManager/system-connections directory. File name is same to the connection name you typed in step 4.

Now press Ctrl+Alt+T on keyboard to open terminal. When it opens, paste the commands below and hit Enter to edit the configuration file.

gksudo gedit /etc/NetworkManager/system-connections/wifi-hotspot

Replace wifi-hotspot with the connection name you types in step 4.

When the file opens, search for the line mode=infrastructure and change it to mode=ap.

Finally save the file.

Change mode to ap

When everything's done, enable WIFI from Network Manager icon on the panel. It should automatically connect to the hotspot you created. If not, select "Connect to Hidden Wi-Fi Network" and select it from the drop-down box.

Wifi Hotspot

Now you can search and connect the access point from your Android mobile ..... enyou <^_^>

Credit: UbuntuHandBook

  • works 14.04(.2)_64 and is easy to do!! thanks :D – Mina Michael Jun 9 '15 at 20:10
  • If it worked for you. Give an upvote instead of thanks... :D .Thanku. – Anuj TBE Jun 11 '15 at 4:36
  • I did! I wanted to increase emphasis with the comment coz strangely it has no upvotes – Mina Michael Jun 11 '15 at 5:57
  • hey just noticed sth! upon restart it doesn't work anymore. strange! it just acts as if it's trying to connect to the wifi network we made – Mina Michael Jun 11 '15 at 6:05
  • 1
    @ThePredator you can only share your internet connected via cable to your laptop with others using wifi hotspot. If you are connected to some other wifi on your laptop, you can't share that with others. Enabling hotspot will disable all wifi connections. – Anuj TBE Mar 8 '16 at 15:24
6

Install ap-hotspot :

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

Update it for Ubuntu 14.04 if you are using it :

amd64 : http://archive.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_amd64.deb
32 bit : http://archive.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_i386.deb

Example on amd64 :

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

Usage :

sudo ap-hotspot start

// Follow the configuration for password & ssid

If u want to re configure it again :

sudo ap-hotspot configure

To stop it :

sudo ap-hotspot stop

To check the configuration :

ap-hotspot

And most important of all: Don't forget to turn off the Firewall on the Hotspot!

  • 2
    For ap-hotspot to work you should turn-off your firewall. – Sudheer Jul 8 '14 at 8:17
  • I wanted to +1 the comment by Sudheer. You must turn off your firewall. I tried the above a lot but it didn't work because my firewall was ON. Thank you Sudheer! – Babbzzz May 15 '15 at 16:55
  • ERROR 404: Not Found for the given wget command. – Blauhirn Apr 1 '17 at 23:00
  • 1
    The PPA does not contains ap-hotspot with Ubuntu 17.04 – loxaxs Aug 26 '17 at 17:36
6

The best way, in my opinion, is:

  • First, install a few packages as follow:
sudo apt-get install procps iproute2 iw haveged hostapd

The usage is super simple and it basically "just works". First time AP actually works for me (it never worked correctly for me through default NetworkManager).

  • 1
    Yes. Also, hostapd needs to be in the install list, too. – Blauhirn Apr 1 '17 at 23:05
  • 2
    Tried: ap-hotspot, nm-plasma, network-manager-gnome, etc. etc. etc. This is the only thing I could get to work on Ubuntu 17.04 64-Bit. – nmax Jun 11 '17 at 18:44
3

Here are two very similar methods based on the great command line tool of NetworkManager. It is very straight forward, works with WPA and Access Point Mode (so it works on smartphones), and do not need complex set up. Once it's set up, you can just use the graphical interface to toogle the access point.

One line solution, without additional program

Just run

nmcli device wifi hotspot con-name my-hotspot ssid my-hotspot band bg password jesuisunmotdepasse

and it should create the access point and connect to it. If it does not work, you should try the 3 line solution here :

Three lines solution, without additional program

Just run the following lines to create and enable the access point :

# Create a connection
nmcli connection add type wifi ifname '*' con-name my-hotspot autoconnect no ssid my-local-hotspot
# Put it in Access Point
nmcli connection modify my-hotspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
# Set a WPA password (you should change it)
nmcli connection modify my-hotspot 802-11-wireless-security.key-mgmt wpa-psk 802-11-wireless-security.psk myhardpassword
# Enable it (run this command each time you want to enable the access point)
nmcli connection up my-hotspot

Now connect on your Smartphone... When you do not need it anymore, disable it with :

nmcli connection down my-hotspot

To enable it again, you will just need to use the last command of the 4 lines command. You can note that since the connection also appears in the available connections, you can enable/disable it from graphical interface.

  • Amazing, it works! (I needed the long version you wrote, and I am using Xubuntu 16.04). You deserve +1 specially because of not using any additional program. Could you tell me, where/how you learned to do this stuff? – loved.by.Jesus Jun 19 at 17:23
  • It can be that after disabling the hotspot, the network service in the computer is not working properly. In order to restart the network in Ubuntu you can run sudo service network-manager restart (See howopensource.com/2014/12/ubuntu-restart-network) – loved.by.Jesus Jun 25 at 11:32
2

Ubuntu 16.04+ LTS

the easiest way that I've seen is to simply use the built in Hotspot feature in Ubuntu. You just need to make sure that you are connected via ethernet to the internet since turning it on will disconnect to from the wi-fi.

( It might be different if you have an extra dongle attached to your laptop or computer allowing 2 connections at the same time )

1. Open settings an click on network

Settings window of Ubuntu with mouse over "Network"

2. Click on Wirelss and make sure that you have it enabled!

enter image description here

Click on "Use as Hotspot..." remember to make sure you are connected to the internet via ethernet.

3. "Click Turn On"

enter image description here

this is what pops up for me since I am still connecting to the wifi, but it still works regardless.

once you do that, You'll be greeted by the connection Name, and the autogenerated password key. Simply join that connection and type in the key and you're good to go!

1

To make your ubuntu machine act as a wifi hot-spot for any device, install and configure the hostapd package. It is designed for this very purpose. I'm sharing my mobile broadband connection (Tata Photon) with my android phone using this very method on ubuntu 12.04!

Here are the per-requisites you will need to use hostapd in this manner:

Pre-requsites:

  1. Ability of your wireless card to support infrastructure mode. To find out:

    i. Find your kernel driver module in use by issuing the below command: lspci -k | grep -A 3 -i “network” (In my case, the driver in use was ath9k)

    ii. Now, use the below command to find out your wifi capabilities (replace ath9k by your kernel driver): modinfo ath9k | grep ‘depend’ (iii) If the above output includes “mac80211” then it means your wifi card will support the AP mode.

  2. Hostapd software: Hostapd is the standard linux daemon that will be used to create your access-point.

  3. Dhcp software: Even after hostapd creates the AP and your device detects it, you will still need a dhcp server to assign a dynamic ip-address to your AP client. (unless you are assigning static address to each device)

Refer my article for further details on how to set up and configure the hostapd package.

Update on 08-Jul-2014

To solve this problem, I've written Hotspotd, a small linux daemon to create a wifi hotspot on top of hostapd. It uses dnsmasq for IP-address provisioning to and iptables to generate the routing table.

To install:

wget https://github.com/prahladyeri/hotspotd/raw/master/dist/hotspotd-0.1.tar.gz
tar xvf hotspotd-0.1.tar.gz
cd hotspotd-0.1/
sudo python setup.py install

Workaround for 14.04 broken hostapd bug is included.

1

You can create hotspot with single command using create_ap.

sudo create_ap wlo1 wlo1 'My superfast hotspot' superSecretpassword

To install it

# install hostapd using apt
sudo apt install hostapd

# install create_ap from source
git clone https://github.com/oblique/create_ap
cd create_ap
sudo make install

You can checkout readme page on the project for more examples on how to use it.

  • hostapd package 1:2.4-0ubuntu6 doesn't include the create_ap program. – John S Gruber Jul 2 '17 at 3:36
  • @JohnSGruber no that should be the github link – Wilf Dec 10 '18 at 16:58
  • 1
    @Wilf, thanks. Both steps are necessary. My mistake. – John S Gruber Dec 12 '18 at 5:10
0

This worked for me. It sets up the hotspot connection using the Kde network-manager connection editor. I'm on Ubuntu 14.04(.2) 64 bit. Follow the link or follow me:

First install it from the link above. (I think the package is plasma-nm, if I'm right run this to install: sudo apt-get install plasma-nm).

Press Alt+F2 and type kde-nm-connection-editor to run it.

In the window that comes out click Add button and choose “Wireless (shared)” from the drop-down list.

Type in a name, ssid, and select Access Point mode. If you want, set up a password under Wireless Security tab. Finally, click OK.

Click Network Manager applet on Unity panel and then choose “Connect to Hidden Wi-Fi network”, choose the connection you created. (You might not need to do this step)

protected by Community Jul 10 '15 at 13:30

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

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.