Create_AP: Script to share our Internet connection via WiFi

Create_AP Wifi

The situation is as follows: We have a Laptop with an Internet connection and we want to share that connection to use our Smartphone or Tablet through WiFi.

Normally to achieve this, we should create a WiFi connection, then make use of IPTables for NAT, etc ... But a user of ArchLinux you have created a script, which you named Create_AP and does all of that for us.

This script makes use of de hostapd + dnsmasq + iptables to create access point NAT, and hostapd + brctl + dhclient to create Access Point. The default behavior is a access point via NAT.

Create_AP installation:

To install Create_AP what we do is open a terminal and put:

$ git clone https://github.com/oblique/create_ap $ cd create_ap $ sudo make install

Likewise, we can simply run a .sh that will be inside the folder. For it to work correctly we must have the following dependencies installed:

  • bash (to run the script)
  • util-linux (for getopt)
  • hostapd
  • iproute2
  • iw
  • haveged (optional)

Script use

# No password (open network):
create_ap wlan0 eth0 MyAccessPoint

# WPA + WPA2 with Password:
create_ap wlan0 eth0 MyAccessPoint MyPassword

# AP without shared Internet:
create_ap -n wlan0 MyAccessPoint MyPassword

# Network Bridge with shared Internet:
create_ap -m bridge wlan0 eth0 MyAccessPoint MyPassword

There is more information on how to use this script in the README.md file. To start the service we simply execute in the console:

# systemctl start create_ap

And to start it automatically:

# systemctl enable create_ap

Conclusions

For me personally, the Script works perfectly for me, I can connect my ZTE Open to my Laptop via WiFi but I have not found a way to connect to the Internet. It may be the fault of FirefoxOS that it does not have by default the option to put Proxy or something like that, I don't know, but it would be good if you share your experience with us in case it works for you.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

60 comments, leave yours

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Eduardo said

    EXCELLENT!

    It works for Ubuntu / Debian ????

    Thank you!
    Eduardo

    1.    elav said

      In fact I think so, and if I don't think it can be modified 😉 I suppose that in this case the important thing would be to have the necessary dependencies.

      1.    dhunter said

        Confirmed on Debian Jessie, the script is a masterpiece.

        1.    elav said

          But were you able to use the internet from your phone?

          1.    dhunter said

            Yes, but I have an Android with MIUI that brings integrated Proxy support.

        2.    eliotime3000 said

          Downloading the Debian Jessie netinstall ISO in 3, 2, 1 ...

  2.   Jorgicio said

    Excellent. Something like that is necessary. I will already create my own Gentoo package for you to test.

    It is appreciated 😀

    1.    elav said

      You're welcome 😉 I think we should mainly thank its author.

      1.    Jorgicio said

        Ready. Here is my Gentoo layout. create_ap is inside net-wireless.

        https://github.com/jorgicio/jorgicio-gentoo

  3.   likewho said

    And of course, as is custom in Arch Linux, it is already in AUR 😀 https://aur.archlinux.org/packages/create_ap

    yaourt -S create_ap

    1.    bocon said

      how to run create ap in arch

  4.   eliotime3000 said

    Excellent tip. I did not know that you could share the network from the PC with the WiFi.

    Either way, it will work for my netbook.

  5.   Ghermain said

    I tried it with Kademar (64 bit) which is Arch and it worked for me, later I will test it on my netbook with Kademar (32bit), but I think I will do it from AUR which is already there.
    By the way, I take the opportunity to recommend this distribution, I always wanted to use Arch but its installation and way of using it was complicated but with Kademar they made it comfortable and it is easy to install, use and update it.
    You can see some information here and it would be good to know the opinions that motivate you:
    http://germanlancheros.blogspot.com.ar/2014/06/disponible-kademar-5-version-escritorio.html

  6.   rpayanm said

    It worked perfect for me on my Ubuntu 14.04, I just had to install a missing dependency (hostapd) !!!

    When I needed to do this I had to go to Windows and run Connectify. Now I do it on Linux !!!

    Thank you very much xD

  7.   otkmanz said

    Excellent contribution, thank you very much for sharing this with us !! Really very useful, at first I did not quite catch on about sharing wifi, I was thinking: but .. if a laptop is connected to wifi, how is it going to share wifi? But I have fallen that you mean to be connected with a USB Modem or just a modem, now it makes sense hahaha
    Thank you very much for this contribution!

    1.    Ocelan said

      I didn't get it either, until I read your comment 😀

  8.   ¿ said

    What packages should be removed to have NO internet connection?

  9.   Keiller said

    Everything works fine on Ubuntu 14.04. Thank you.

  10.   Cristianhcd said

    ERROR: Maybe your WiFi adapter does not fully support virtual interfaces. Try again with –no-virt.

    : Cry

    and if I add –no-virt
    Cannot find device "wlan0"

    on fedora 20 with gnome 3.12

    1.    elav said

      That is because in Fedora the WiFi interface should not be wlan0, that was before .. to know the name of your interface try with:
      ip link

      1.    dhunter said

        Mine was a very long name in F19 and now in F20 it's em1.

  11.   Kuroro said

    Hello, your Script worked for me successfully in Fedora 20 x64 - Gnome. Thanks a lot! 😀. But now I have a problem: I can't connect to any network, none of them recognize me, what do you think is the fault?

    1.    KZKG ^ Gaara said

      You touched something in the /etc/NetworkManager/NetworkManager.conf right?
      Just put a pound sign (#) in front of the lines you added.

      1.    Kuroro said

        I didn't really touch any configuration, just run the script and when closing the terminal it already recognized the networks. Help me, I can't connect to the internet from Fedora 🙁

        1.    Kuroro said

          ... and when I closed the terminal, it no longer recognized the networks

      2.    Kuroro said

        I can only see the networks through the terminal, but I can't do it with the graphical interface Image

  12.   gabriel said

    Hello, I tell you that sharing the internet to a phone or tablet can be done for a long time with the fedora 20 kde, going to the connection editor then to add, select shared wireless, in the wireless tab choose to restrict the network to the device where They want to broadcast the signal to share and voila, they already have internet on any cell phone or tablet. I hope it helps you!

  13.   moa said

    Can you help me, I get the following error when running create_ap wlan0 eth0 MyAccessPoint MyPassword

    ERROR: Your adapter can not be a station (ie be connected) and an AP at the same time

  14.   ivan said

    hi, i'm a newbie at this and when it comes to trying the line
    $ sudo make install
    I vote this message «is not in the sudoers file»
    … In fedora 21 gnome version 3.14

    1.    KZKG ^ Gaara said

      You must add your user to the wheel group, or put the following in the / etc / sudoers file:
      ivan ALL=(ALL) ALL

      Of course, assuming your username is ivan.

  15.   JP said

    All perfect. But it waits for a DHCP IP and never connects

    1.    KZKG ^ Gaara said

      Do you have all the necessary packages installed? Read README file or something like that

  16.   mat1986 said

    I tried using this script with my USB modem (Huawei E353) and it didn't work for me. I get the message “ERROR: Maybe your WiFi adapter does not fully support virtual interfaces. Try again with –no-virt. ». I think it's a modem problem, I spent the whole afternoon at my mother's house making it work and I couldn't xD

  17.   TOfriki said

    this link explains how to do it without the script

    http://seravo.fi/2014/create-wireless-access-point-hostapd

  18.   Pablo said

    Hi, I'm working on my final ASIR course project and I need to create a Wi-Fi access point, so this article has caught my attention.
    First of all very good explanation, but I have a problem and that is that I get the following error when trying to create a network bridge with shared internet:
    root @ pablo-Aspire-5741G: / home / pablo / create_ap # create_ap -m bridge wlan0 eth0 Final project final project
    WARN: Your adapter does not fully support AP virtual interface, enabling –no-virt
    Config dir: /tmp/create_ap.wlan0.conf.DgNR09hJ
    PID: 4816
    Network Manager found, set wlan0 as unmanaged device… DONE
    Sharing Internet using method: bridge
    Create a bridge interface… br5 created.
    hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.DgNR09hJ/hostapd_ctrl
    Configuration file: /tmp/create_ap.wlan0.conf.DgNR09hJ/hostapd.conf
    Failed to create interface mon.wlan0: -23 (Too many open files in system)
    Try to remove and re-create mon.wlan0
    Failed to update rate sets in kernel module
    Using interface wlan0 with hwaddr f0: 7b: cb: 16: 52: cc and ssid 'Final Project'

    Regarding the last line, previously I tried to configure it manually without installing anything in the wlan interface but it didn't work, so I eliminated it, however it still appears as it exists.

    Could someone give me a cable? Thank you…!

  19.   jesusguy said

    This is awesome it worked perfect for me on my Lubuntu 15.04.

    Since I discovered Conectify in Windows, I was trying to find the same solution for linux until today when I came across this article, I think this should be more widespread.

    How can I see the connected clients? Their IP and monitor them in general?

  20.   Alexander said

    Hello, I installed everything detailed and then I ran and it worked perfectly, the only thing I'm going to have to find is how to make it run when I turn on the pc since that part is not working for me. thanks for sharing.

  21.   cristiand391 said

    Hi, I'm on Xubuntu 14.04, with the ethernet cable and this script worked for 10 days, I created the AP and my android phones connected without problems to the internet. I have had problems with the internet for about 1 week, the phone connects to the network but the internet speed is very slow (4 or 5kb / s) compared to before (400 or 500kb / s), someone knows what the problem?

    I clarify that I have the Saucy hostapd because with the Trusty there is no way to create an AP.

  22.   ofer said

    To share from WI-FI to WI-FI, it is necessary to have two wireless network cards, for example the one that is included in a laptop and another connected by Usb. Then the command would be more or less like this:

    create_ap wlan0 wlan1 MyAccessPoint Miconpassword

  23.   technophorese said

    Excellent I congratulate you for the contribution, it served me very well. I downloaded it and confirmed that you had the necessary programs installed on PointLinux. Very good distribution based on Debian jessie. I have a laptop with a usb wifi card and an internal wifi card.
    - I downloaded and unzipped it
    - Then run it as root user: ./create_ap create_ap wlan0 wlan1 vinotinto parangacutimiricuaro
    - The process was executed and at the moment my smartphone already had a Wi-Fi signal with internet ... 🙂

    I hope my comment helps others. Thank you.

  24.   David fabry said

    It works hard with the LXLE with the indicated packages. Excellent script thank you very much for sharing

    http://www.lxle.net/articles/?post=3264-bit-versions-of-lxle-14043-released

  25.   alicia nicole san said

    I can not start the program tells me that
    root @ linux: / home / linux / create_ap # systemctl start create_ap
    systemctl: command not found
    root @ linux: / home / linux / create_ap #
    from there no pass 🙁

  26.   The King said

    Hello, I would like to know how to manage the amount of KB or MB that I am providing to those who are connected through this script,

    regards
    Thanks in advance

  27.   christlove said

    Greetings, I was testing in Debian Weezy and it creates the AP but when I try to authenticate on the android device or on a laptop it takes time to get ip and in the end it does not authenticate me. Can anybody help me.

  28.   David said

    Did you try changing the encoding method of the AP?

  29.   Pedritin said

    I'm new to this where is the link to download the script

  30.   JOSEPH said

    Regards…

    I have been able to create 2 APs simultaneously with the Script. Is it possible to create more than 2 APs with this tool?

  31.   David fabry said

    I don't know if it can, the point here is what would be the practical utility of continuing to create APs, having virtual APs on a nic lowers performance since you are sharing the resource.

  32.   JOSEPH said

    Thanks for your answer David ...

    The issue is that I am doing a job on virtualization and I need to verify the virtualization behavior, in a scenario with more than 2 virtual APs. Hopefully some of you have a solution.

    regards

  33.   luisg595 said

    When I run create_ap wlan0 eth0 MyAccessPoint MyPassword it gives me the following error:
    ERROR: Your adapter can not be a station (ie be connected) and an AP at the same time
    What is happening?

  34.   yoandri said

    I use manjaro 16 it gives me this error if someone could help me ERROR: Your adapter can not transmit to channel 36, frequency band 5GHz.

  35.   Yoandri said

    I use manjaro 16 when I run create_ap it gives me this error ERROR: Your adapter can not transmit to channel 36, frequency band 5GHz.

  36.   Andres Eduardo Garcia Marquez said

    dnsmasq package is missing from installation

  37.   Beta2404 said

    perfect after solving a couple of disasters in the configuration that I had before, I managed to use it without major problems
    now I receive internet from my internal wifi card and share internet from the same card through the other antenna of this one (it has two antennas, in a tp-link tl-wn851nd)

  38.   Wasosky said

    wow !!! simply surprised it was an answer to all my problems and even in 2017 it works 120%

  39.   hipy said

    Hello, thanks for the contribution, very good solution to put to work the old junk that many of us have. I know that the post is somewhat old but it is still valid for many, I would like to know if someone here has managed to make a connection to a network that has a proxy server, let me explain, I already have the AP working like a charm but I can't share the internet connection I have with a proxy server and I don't want to remount another proxy on the AP. If someone has managed to do something similar and can share their experience, I would appreciate it.

  40.   Yino said

    Hello very good and greetings to all, I am new to the world of Linux, I installed Linux Mint 19 and it already gave me the first problem and I would like to know if you can help me, I need to create an access point or better known as a hotspot, but repeat the signal and capture it with the same wifi card that the laptop has, that is, without a wired network because it did very well with windows without installing any other usb tp-link or anything, I would like to know how I can achieve it please, because it allows me to create host pot very well but not when connecting to the wireless network to capture internet signal, the hotspot is disconnected. I appreciate the help they can give me. Greetings to all. If linux does not do what windows does in that sense. believe me that Linux at least for me does not work.

  41.   Juan Cruz said

    HOW IS THE SCRIPT CREATED TO MAKE THE HOT-SPOT ??? TRY IT AS FOLLOWS:

    #! / Bin / bash

    clear

    create_ap wlan0 eth0 network 12345

    create_ap -m bridge wlan0 eth0 network 12345

    systemctl enable create_ap

    I hope your help friends

  42.   RFG said

    I get the same error as Yoandri_

    ERROR: Your adapter can not transmit to channel 104, frequency band 5GHz.