Giter Club home page Giter Club logo

create_ap's Introduction

NOT MAINTAINED

This project is no longer maintained.

Forks and continuation of this project

  • linux-wifi-hotspot - Fork that is focused on providing GUI and improvements.
  • linux-router - Fork that is focused on providing new features and improvements which are not limited to WiFi. Some interesting features are: sharing Internet to a wired interface and sharing Internet via a transparent proxy using redsocks.

Features

  • Create an AP (Access Point) at any channel.
  • Choose one of the following encryptions: WPA, WPA2, WPA/WPA2, Open (no encryption).
  • Hide your SSID.
  • Disable communication between clients (client isolation).
  • IEEE 802.11n & 802.11ac support
  • Internet sharing methods: NATed or Bridged or None (no Internet sharing).
  • Choose the AP Gateway IP (only for 'NATed' and 'None' Internet sharing methods).
  • You can create an AP with the same interface you are getting your Internet connection.
  • You can pass your SSID and password through pipe or through arguments (see examples).

Dependencies

General

  • bash (to run this script)
  • util-linux (for getopt)
  • procps or procps-ng
  • hostapd
  • iproute2
  • iw
  • iwconfig (you only need this if 'iw' can not recognize your adapter)
  • haveged (optional)

For 'NATed' or 'None' Internet sharing method

  • dnsmasq
  • iptables

Installation

Generic

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

ArchLinux

pacman -S create_ap

Gentoo

emerge layman
layman -f -a jorgicio
emerge net-wireless/create_ap

Examples

No passphrase (open network):

create_ap wlan0 eth0 MyAccessPoint

WPA + WPA2 passphrase:

create_ap wlan0 eth0 MyAccessPoint MyPassPhrase

AP without Internet sharing:

create_ap -n wlan0 MyAccessPoint MyPassPhrase

Bridged Internet sharing:

create_ap -m bridge wlan0 eth0 MyAccessPoint MyPassPhrase

Bridged Internet sharing (pre-configured bridge interface):

create_ap -m bridge wlan0 br0 MyAccessPoint MyPassPhrase

Internet sharing from the same WiFi interface:

create_ap wlan0 wlan0 MyAccessPoint MyPassPhrase

Choose a different WiFi adapter driver

create_ap --driver rtl871xdrv wlan0 eth0 MyAccessPoint MyPassPhrase

No passphrase (open network) using pipe:

echo -e "MyAccessPoint" | create_ap wlan0 eth0

WPA + WPA2 passphrase using pipe:

echo -e "MyAccessPoint\nMyPassPhrase" | create_ap wlan0 eth0

Enable IEEE 802.11n

create_ap --ieee80211n --ht_capab '[HT40+]' wlan0 eth0 MyAccessPoint MyPassPhrase

Client Isolation:

create_ap --isolate-clients wlan0 eth0 MyAccessPoint MyPassPhrase

Systemd service

Using the persistent systemd service

Start service immediately:

systemctl start create_ap

Start on boot:

systemctl enable create_ap

License

FreeBSD

create_ap's People

Contributors

0x0blu avatar 2xsaiko avatar eduardohenriquearnold avatar evertheylen avatar graysky2 avatar guillomovitch avatar hashken avatar ichpuchtli avatar ihavenoface avatar l0g4n avatar mid-kid avatar mika avatar nicohood avatar oblique avatar orochimarufan avatar pldubouilh avatar proger avatar solsticedhiver avatar webreflection avatar wsxarcher avatar zhanghaha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create_ap's Issues

args --driver didn't work

spondbob@bikinibottom ~/create_ap :( (master)
$ sudo ./create_ap --driver rtl871xdrv -n wlan0 myssid mypassword
Config dir: /tmp/create_ap.wlan0.conf.Nl6ZZz1n
nl80211 not found.
Creating a virtual WiFi interface... nl80211 not found.

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


Doing cleanup...
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).

why it keeps using nl80211? I can confirm that the driver exist and working by running sudo hostapd -dd /etc/hostapd/hostapd.conf

NetworkManager crash on Debian

Hi,

I used the simple script "sudo create_ap wlan0 eth0 id key" and I created my ap. It worked fine but I saw that the NetworkManager icon in the top bar disappeared. After killing with CTRL-C and reboot the laptop, nothing works.
"ifconfig" doesn't show me the interfaces, only "ifconfig -a", but it useless to get up them.
I don't know what can I do.

Thanks,
Alessandro

Difficulties in Arch, but Ubuntu is working

See my post
(I don't know much about fancy formatting here 😄 )
I also wrote a script that will start create_ap just by clicking on a *.desktop file like this:

[Desktop Entry]
Version=1.0
Name=APstarter
GenericName=Access Point Enabler
X-GNOME-FullName=Access Point Enabler
Comment=By the use of WiFi devices can start and stop a hotspot
Exec=bash -c /home/user/start_my_AP
Icon=/usr/share/icons/gnome/scalable/devices/phone-apple-iphone-symbolic.svg
Terminal=false
NoDisplay=false
MimeType=Application
Type=Application

By OBLiQUE requests here are my reports:
The output of iw dev

phy#1
    Interface wlan1
        ifindex 4
        wdev 0x100000001
        addr xx:xx:xx:xx:xx:xx
        type managed
phy#0
    Interface wlan0
        ifindex 3
        wdev 0x1
        addr xx:xx:xx:xx:xx:xx
        type managed
        channel 11 (2462 MHz), width: 20 MHz (no HT), center1: 2462 MHz

The output of create_AP log:

WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan1.conf.I3pLsWqX
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan1.conf.I3pLsWqX/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan1.conf.I3pLsWqX/hostapd.conf
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan1 wasn't started

Error: Failed to run hostapd, maybe a program is interfering.

Doing cleanup...

The output of iw list:

$ iw list
Wiphy phy1
    max # scan SSIDs: 4
    max scan IEs length: 2285 bytes
    Coverage class: 0 (up to 0m)
    Device supports RSN-IBSS.
    Supported Ciphers:
        * WEP40 (00-0f-ac:1)
        * WEP104 (00-0f-ac:5)
        * TKIP (00-0f-ac:2)
        * CCMP (00-0f-ac:4)
    Available Antennas: TX 0 RX 0
    Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * WDS
         * monitor
         * mesh point
    Band 1:
        Bitrates (non-HT):
            * 1.0 Mbps
            * 2.0 Mbps (short preamble supported)
            * 5.5 Mbps (short preamble supported)
            * 11.0 Mbps (short preamble supported)
            * 6.0 Mbps
            * 9.0 Mbps
            * 12.0 Mbps
            * 18.0 Mbps
            * 24.0 Mbps
            * 36.0 Mbps
            * 48.0 Mbps
            * 54.0 Mbps
        Frequencies:
            * 2412 MHz [1] (20.0 dBm)
            * 2417 MHz [2] (20.0 dBm)
            * 2422 MHz [3] (20.0 dBm)
            * 2427 MHz [4] (20.0 dBm)
            * 2432 MHz [5] (20.0 dBm)
            * 2437 MHz [6] (20.0 dBm)
            * 2442 MHz [7] (20.0 dBm)
            * 2447 MHz [8] (20.0 dBm)
            * 2452 MHz [9] (20.0 dBm)
            * 2457 MHz [10] (20.0 dBm)
            * 2462 MHz [11] (20.0 dBm)
            * 2467 MHz [12] (20.0 dBm) (no IR)
            * 2472 MHz [13] (20.0 dBm) (no IR)
            * 2484 MHz [14] (20.0 dBm) (no IR)
    Supported commands:
         * new_interface
         * set_interface
         * new_key
         * start_ap
         * new_station
         * new_mpath
         * set_mesh_config
         * set_bss
         * authenticate
         * associate
         * deauthenticate
         * disassociate
         * join_ibss
         * join_mesh
         * set_tx_bitrate_mask
         * frame
         * frame_wait_cancel
         * set_wiphy_netns
         * set_channel
         * set_wds_peer
         * probe_client
         * set_noack_map
         * register_beacons
         * start_p2p_device
         * set_mcast_rate
         * Unknown command (104)
         * connect
         * disconnect
    Supported TX frame types:
         * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    Supported RX frame types:
         * IBSS: 0x40 0xb0 0xc0 0xd0
         * managed: 0x40 0xd0
         * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * mesh point: 0xb0 0xc0 0xd0
         * P2P-client: 0x40 0xd0
         * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * P2P-device: 0x40 0xd0
    software interface modes (can always be added):
         * AP/VLAN
         * monitor
    valid interface combinations:
         * #{ AP, mesh point } <= 4,
           total <= 4, #channels <= 1
    HT Capability overrides:
         * MCS: ff ff ff ff ff ff ff ff ff ff
         * maximum A-MSDU length
         * supported channel width
         * short GI for 40 MHz
         * max A-MPDU length exponent
         * min MPDU start spacing
    Device supports TX status socket option.
    Device supports HT-IBSS.
    Device supports low priority scan.
    Device supports scan flush.
    Device supports AP scan.
Wiphy phy0
    max # scan SSIDs: 4
    max scan IEs length: 2257 bytes
    Coverage class: 0 (up to 0m)
    Device supports RSN-IBSS.
    Device supports AP-side u-APSD.
    Device supports T-DLS.
    Supported Ciphers:
        * WEP40 (00-0f-ac:1)
        * WEP104 (00-0f-ac:5)
        * TKIP (00-0f-ac:2)
        * CCMP (00-0f-ac:4)
        * CMAC (00-0f-ac:6)
    Available Antennas: TX 0x1 RX 0x1
    Configured Antennas: TX 0x1 RX 0x1
    Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * WDS
         * monitor
         * mesh point
         * P2P-client
         * P2P-GO
    Band 1:
        Capabilities: 0x116e
            HT20/HT40
            SM Power Save disabled
            RX HT20 SGI
            RX HT40 SGI
            RX STBC 1-stream
            Max AMSDU length: 3839 bytes
            DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 8 usec (0x06)
        HT TX/RX MCS rate indexes supported: 0-7
        Bitrates (non-HT):
            * 1.0 Mbps
            * 2.0 Mbps (short preamble supported)
            * 5.5 Mbps (short preamble supported)
            * 11.0 Mbps (short preamble supported)
            * 6.0 Mbps
            * 9.0 Mbps
            * 12.0 Mbps
            * 18.0 Mbps
            * 24.0 Mbps
            * 36.0 Mbps
            * 48.0 Mbps
            * 54.0 Mbps
        Frequencies:
            * 2412 MHz [1] (16.0 dBm)
            * 2417 MHz [2] (16.0 dBm)
            * 2422 MHz [3] (16.0 dBm)
            * 2427 MHz [4] (16.0 dBm)
            * 2432 MHz [5] (16.0 dBm)
            * 2437 MHz [6] (16.0 dBm)
            * 2442 MHz [7] (16.0 dBm)
            * 2447 MHz [8] (16.0 dBm)
            * 2452 MHz [9] (16.0 dBm)
            * 2457 MHz [10] (16.0 dBm)
            * 2462 MHz [11] (16.0 dBm)
            * 2467 MHz [12] (16.0 dBm) (no IR)
            * 2472 MHz [13] (16.0 dBm) (no IR)
            * 2484 MHz [14] (disabled)
    Supported commands:
         * new_interface
         * set_interface
         * new_key
         * start_ap
         * new_station
         * new_mpath
         * set_mesh_config
         * set_bss
         * authenticate
         * associate
         * deauthenticate
         * disassociate
         * join_ibss
         * join_mesh
         * remain_on_channel
         * set_tx_bitrate_mask
         * frame
         * frame_wait_cancel
         * set_wiphy_netns
         * set_channel
         * set_wds_peer
         * tdls_mgmt
         * tdls_oper
         * probe_client
         * set_noack_map
         * register_beacons
         * start_p2p_device
         * set_mcast_rate
         * Unknown command (104)
         * connect
         * disconnect
    Supported TX frame types:
         * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    Supported RX frame types:
         * IBSS: 0x40 0xb0 0xc0 0xd0
         * managed: 0x40 0xd0
         * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * mesh point: 0xb0 0xc0 0xd0
         * P2P-client: 0x40 0xd0
         * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * P2P-device: 0x40 0xd0
    software interface modes (can always be added):
         * AP/VLAN
         * monitor
    valid interface combinations:
         * #{ managed } <= 2048, #{ AP, mesh point } <= 8, #{ P2P-client, P2P-GO } <= 1,
           total <= 2048, #channels <= 1, STA/AP BI must match
         * #{ WDS } <= 2048,
           total <= 2048, #channels <= 1, STA/AP BI must match
    HT Capability overrides:
         * MCS: ff ff ff ff ff ff ff ff ff ff
         * maximum A-MSDU length
         * supported channel width
         * short GI for 40 MHz
         * max A-MPDU length exponent
         * min MPDU start spacing
    Device supports TX status socket option.
    Device supports HT-IBSS.
    Device supports low priority scan.
    Device supports scan flush.
    Device supports AP scan.

The Networmanager version in Arch

$ nmcli --version
nmcli 工具,版本 0.9.10.1

My daughter study chinese 😛
The output of ip addr:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 84:4b:f5:95:dc:e5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.7/24 brd 192.168.1.255 scope global dynamic wlan0
       valid_lft 18535sec preferred_lft 18535sec
    inet6 fe80::864b:f5ff:fe95:dce5/64 scope link 
       valid_lft forever preferred_lft forever
4: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether xx:xx:xx:x:x:xx brd ff:ff:ff:ff:ff:ff

It seems to me that the wlan0 may be used for both directions, but I have the conflict with NetworkManager, which will disconnect it. //(at least in Ubuntu)//
All of this started in Arch.

$ lspci -k | grep -A 3 -i "network"
02:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)
    Subsystem: Foxconn International, Inc. Device e047
    Kernel driver in use: ath9k
    Kernel modules: ath9k

Hardware details

$ lsmod |grep c80211
mac80211              514630  3 ath9k,rt2x00lib,rt2x00usb
cfg80211              454161  5 ath,ath9k_common,ath9k,mac80211,rt2x00lib

$ uname -a
Linux A5733_arch64 3.16.3-1-ARCH #1 SMP PREEMPT Wed Sep 17 21:54:13 CEST 2014 x86_64 GNU/Linux

I'll be back in Ubuntu, to show the differences

device "wlan0ap" does not exist.

uname: Linux 3.14.0-031400rc7-generic #201403162235 SMP Mon Mar 17 02:36:19 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
ifconfig:
eth0 Link encap:Ethernet HWaddr bc:ee:7b:03:79:60
inet addr:192.168.0.104 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::beee:7bff:fe03:7960/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9937 errors:0 dropped:0 overruns:0 frame:0
TX packets:5464 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13209637 (13.2 MB) TX bytes:414895 (414.8 KB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:99 errors:0 dropped:0 overruns:0 frame:0
TX packets:99 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9624 (9.6 KB) TX bytes:9624 (9.6 KB)

wlan0 Link encap:Ethernet HWaddr 6c:71:d9:bd:20:7f
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Command:
sudo ./create_ap wlan0 eth0 VPNHomeRouter XXXXXX(Password)

Output:
Config dir: /tmp/create_ap.wlan0.conf.GkNwV3NP
Creating a virtual WiFi interface... wlan0ap created.
Device "wlan0ap" does not exist.
Device "wlan0ap" does not exist.
Device "wlan0ap" does not exist.
Network Manager config found, set wlan0ap as unmanaged device... DONE
"" is invalid lladdr.

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

Doing cleanup...
iptables: No chain/target/match by that name.
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
Cannot find device "wlan0ap"
Device "wlan0ap" does not exist.
Device "wlan0ap" does not exist.
command failed: No such device (-19)

create_ap can't work with NetworkManager on archlinux

Hello, I get a problem.
I use NetworkManager to connect the Internet, and when I run the command: sudo create_ap wlp8s0 wlp8s0 name testing
I returned:
Config dir: /tmp/create_ap.wlp8s0.conf.tt6F6zwg
Creating a virtual WiFi interface... wlp8s0ap created.
Network Manager config found, set wlp8s0ap as unmanaged device... DONE
RTNETLINK answers: Device or resource busy

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

Doing cleanup...
iptables: No chain/target/match by that name.
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).
iptables: Bad rule (does a matching rule exist in that chain?).

I tried --no-virt but neither works!!
But if I use wifi-menu, it works!!
So,I wonder what is wrong with NetworkManager and create_ap?
Could you help me?
Thanks

Change the Gentoo method for adding my overlay

Hi!
First, thanks for the credits for the installation of your script on Gentoo (and other Gentoo-based flavours, such as Calculate, Funtoo or Sabayon) from my overlay! I'm very thankful for that.

However, my overlay is now on the official list of the Gentoo Overlays, so the way to add it changed.
Please, check the README.md on my Github profile for more information.

Thanks.

NetworkManager Issue

Having the latest create_ap (version git~20140903-1) package from AUR installed together with NetworkManager 0.9.8.10-3 from the Official Repository does not work well on Arch Linux.

Invoking sudo create_ap -c 1 -w 1+2 -n -m nat wlp4s0 ppp0 'Airmont AP' 12345678'results in the following output:

Config dir: /tmp/create_ap.wlp4s0.conf.cB3ZD33C
Creating a virtual WiFi interface... wlp4s0ap created.
Network Manager found, set wlp4s0 as unmanaged device...

The script doesn't continue at this point until it receives the interrupt signal. Obviously the problem occurs within the networkmanager_add_unmanagedfunction defined at line 212 so that the command echo "DONE" at line 574 is never reached.

Sadly updating to NetworkManager 0.9.10 is not an option at the moment...

Domain/IP block

Is it possible to use domain/IP blocking with this script?

Thanks

Got these messages with the latest AUR version

Error: Object 'nm' is unknown, try 'nmcli help'.
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.m7BPD0qA/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.m7BPD0qA/hostapd.conf
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan0 wasn't started

ERROR: Failed to run hostapd, maybe a program is interfering.

distro: Arch 64bit
kernel: 3.15.7-1
networkmanager: 0.9.10.1

I think nmcli nm is replaced by nmcli g in the version of 0.9.10.1.

Failing to start service

I've updated my Arch system a few days ago and if I remember correctly the hostapd service was updated.

After this when I try to start the service, it fails with the following error messages:

Aug 10 10:06:18 VivoBook dnsmasq[1610]: cleared cache
Aug 10 10:06:18 VivoBook bash[1546]: hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp2s0.conf.uu...d_ctrl
Aug 10 10:06:18 VivoBook bash[1546]: Configuration file: /tmp/create_ap.wlp2s0.conf.uuIUe9iH/hostapd.conf
Aug 10 10:06:18 VivoBook bash[1546]: nl80211: Could not configure driver mode
Aug 10 10:06:18 VivoBook bash[1546]: nl80211 driver initialization failed.
Aug 10 10:06:18 VivoBook bash[1546]: hostapd_free_hapd_data: Interface wlp2s0ap wasn't started
Aug 10 10:06:18 VivoBook bash[1546]: ERROR: Failed to run hostapd, maybe a program is interfering.
Aug 10 10:06:18 VivoBook bash[1546]: Doing cleanup...
Aug 10 10:06:20 VivoBook systemd[1]: create_ap.service: main process exited, code

If I try to start the service multiple times it can manage to start properly. I figure it must be a bug with the hostapd package. However I don't know how to get a complete log of the service, so I can't know what is happening.

Possibility to run in parallel: 1st virt interface with a WLAN AP and 2nd with WLAN client

[OPEN question]
Is it possible to run in parallel: 1st virt interface wlan0 with a WLAN AP and 2nd wlan1 with a WLAN client?

[ArchLinux]
I managed to create a virtual interface wlan1 on which I have connected to local WiFI AP (not running on the same Raspi):

wlan1     IEEE 802.11bgn  ESSID:"Restoran"
Mode:Managed  Frequency:2.417 GHz  Access Point: 10:FE:ED:A4:5E:D4
Bit Rate=18 Mb/s   Tx-Power=20 dBm
Retry  long limit:7   RTS thr:off   Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=37/70  Signal level=-73 dBm  
Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
Tx excessive retries:0  Invalid misc:31   Missed beacon:0

When I tried to run:

$ create_ap wlan0 eth0 RasPi_Public --no-virt

I get the output:

Config dir: /tmp/create_ap.wlan0.conf.hEfC2oXD
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.hEfC2oXD/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.hEfC2oXD/hostapd.conf
Using interface wlan0 with hwaddr 02:3a:35:c2:ab:30 and ssid "RasPi_Public"
Failed to set beacon parameters
Interface initialization failed
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED 
wlan0: Unable to setup interface.
hostapd_free_hapd_data: Interface wlan0 wasn't started

Error: Failed to run hostapd, maybe a program is interfering.

Doing cleanup... 

Nevertheless, I successfully create_ap when no virtual interfaces are active.

What could be a possible workaround for this problem?

N.B. When I run:

$ iw phy phy0 info
.......
valid interface combinations:
         * #{ managed, P2P-client } <= 2, #{ AP, mesh point, P2P-GO } <= 2,
           total <= 2, #channels <= 1
.......

Which supposedly means that WiFi card (TP-LINK TL-WN722N) supports my idea of hosting WLAN AP and client on the same card.

Best regards,

Bogdan

dnsmasq: failed to create listening socket for 192.168.12.1: Address already in use

Hello everybody,
create_app is a cool project!
Run it on my computer and it worked perfectly, but when I run it on my Cubie Nand, the following error appears:


root@Cubian:~/create_ap# create_ap wlan0 eth0 Test
WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan0.conf.nHYCUjHU
PID: 4987
Sharing Internet using method: nat

dnsmasq: failed to create listening socket for 192.168.12.1: Address already in use

Doing cleanup.. done


Thanks for your help!

Cannot connect to host via ssh

Thanks for your great work First ! The AP works really fine and stable!
But I cannot ssh to my PC from my android phone. It is always said "Connection Refused". The PC's IP address I am using is the GATEWAY. And I think this problem may be due to iptables rules .I already tried some solutions to make it work, but I failed.
Any Idea? Maybe Dear you could add options for port auto-enabling?
If I am missing something, Please tell me. Thanks a lot!

deauthenticated due to inactivity problem

hi, I'm gettin this error, don't know how to solve

this is the log:

$ sudo Documenti/create_ap wlan0 eth0 APxxx xxxxxxxxx
[sudo] password for USR:
Config dir: /tmp/create_ap.wlan0.conf.QeHxKS9x
WARNING: All config files need .conf: /etc/modprobe.d/alsa-base.conf_old, it will be ignored in a future release.

dnsmasq: failed to create listening socket for 127.0.0.1: Indirizzo già in uso
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.QeHxKS9x/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.QeHxKS9x/hostapd.conf
Using interface wlan0 with hwaddr 60:d8:19:15:d9:1f and ssid 'A2-304'
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: associated (aid 1)
AP-STA-CONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx RADIUS: starting accounting session 524FCDCC-00000000
wlan0: STA 20:64:32:xx:xx:xx WPA: pairwise key handshake completed (RSN)
AP-STA-DISCONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: disassociated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: deauthenticated due to inactivity
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: associated (aid 1)
AP-STA-CONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx RADIUS: starting accounting session 524FCDCC-00000001
wlan0: STA 20:64:32:xx:xx:xx WPA: pairwise key handshake completed (RSN)
AP-STA-DISCONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: disassociated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: deauthenticated due to inactivity
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: associated (aid 1)
AP-STA-CONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx RADIUS: starting accounting session 524FCDCC-00000002
wlan0: STA 20:64:32:xx:xx:xx WPA: pairwise key handshake completed (RSN)
AP-STA-DISCONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: disassociated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: deauthenticated due to inactivity
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: associated (aid 1)
AP-STA-CONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx RADIUS: starting accounting session 524FCDCC-00000003
wlan0: STA 20:64:32:xx:xx:xx WPA: pairwise key handshake completed (RSN)
AP-STA-DISCONNECTED 20:64:32:xx:xx:xx
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: disassociated
wlan0: STA 20:64:32:xx:xx:xx IEEE 802.11: deauthenticated due to inactivity

iwlwifi: beacon intervals don't match

When I run create_ap, an error message like this:

[  412.771708] iwlwifi 0000:03:00.0: beacon intervals don't match (0, 100)

gets printed on the first tty. Roughly at the same moment (this happens every ~60 seconds) wifi clients experience some package loss (I let ping send a packet every 0.2 seconds and wait 10 seconds before reporting a timeout) for roughly four seconds.

This package loss does not happen on the machine acting as access-point.

This is the log of create_ap for a session where this occured:

Nov 08 01:53:18 entlein bash[453]: Config dir: /tmp/create_ap.wlp3s0.conf.lm23UnI2
Nov 08 01:53:19 entlein bash[453]: Network Manager found, set ap0 as unmanaged device... DONE
Nov 08 01:53:21 entlein bash[453]: Creating a virtual WiFi interface... ap0 created.
Nov 08 01:53:21 entlein bash[453]: Sharing Internet using method: nat
Nov 08 01:53:21 entlein dnsmasq[609]: started, version 2.72 cachesize 150
Nov 08 01:53:21 entlein dnsmasq[609]: compile time options: IPv6 GNU-getopt DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack i
Nov 08 01:53:21 entlein dnsmasq-dhcp[609]: DHCP, IP range 192.168.12.1 -- 192.168.12.254, lease time 1d
Nov 08 01:53:21 entlein dnsmasq[609]: reading /etc/resolv.conf
Nov 08 01:53:21 entlein dnsmasq[609]: using nameserver 8.8.8.8#53
Nov 08 01:53:21 entlein dnsmasq[609]: using nameserver 208.67.220.220#53
Nov 08 01:53:21 entlein dnsmasq[609]: cleared cache
Nov 08 01:53:21 entlein bash[453]: hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp3s0.conf.lm23UnI2/hostapd_ctrl
Nov 08 01:53:28 entlein hostapd[610]: ap0: STA 20:c9:d0:44:80:c1 IEEE 802.11: authenticated
Nov 08 01:53:28 entlein hostapd[610]: ap0: STA 20:c9:d0:44:80:c1 IEEE 802.11: associated (aid 1)
Nov 08 01:53:28 entlein hostapd[610]: ap0: STA 20:c9:d0:44:80:c1 RADIUS: starting accounting session 545D6981-00000000
Nov 08 01:53:28 entlein hostapd[610]: ap0: STA 20:c9:d0:44:80:c1 WPA: pairwise key handshake completed (RSN)
Nov 08 01:53:29 entlein dnsmasq-dhcp[609]: DHCPREQUEST(ap0) 192.168.12.26 20:c9:d0:44:80:c1
Nov 08 01:53:29 entlein dnsmasq-dhcp[609]: DHCPACK(ap0) 192.168.12.26 20:c9:d0:44:80:c1 lukas-mbp
Nov 08 01:53:32 entlein hostapd[610]: ap0: STA dc:86:d8:33:ed:2f IEEE 802.11: authenticated
Nov 08 01:53:32 entlein hostapd[610]: ap0: STA dc:86:d8:33:ed:2f IEEE 802.11: associated (aid 2)
Nov 08 01:53:32 entlein hostapd[610]: ap0: STA dc:86:d8:33:ed:2f RADIUS: starting accounting session 545D6981-00000001
Nov 08 01:53:32 entlein hostapd[610]: ap0: STA dc:86:d8:33:ed:2f WPA: pairwise key handshake completed (RSN)
Nov 08 01:53:32 entlein dnsmasq-dhcp[609]: DHCPREQUEST(ap0) 192.168.12.168 dc:86:d8:33:ed:2f
Nov 08 01:53:32 entlein dnsmasq-dhcp[609]: DHCPACK(ap0) 192.168.12.168 dc:86:d8:33:ed:2f Lukass-iPhone
Nov 08 01:55:10 entlein hostapd[610]: ap0: STA f0:f6:1c:29:73:bb IEEE 802.11: authenticated
Nov 08 01:55:10 entlein hostapd[610]: ap0: STA f0:f6:1c:29:73:bb IEEE 802.11: associated (aid 3)
Nov 08 01:55:10 entlein hostapd[610]: ap0: STA f0:f6:1c:29:73:bb RADIUS: starting accounting session 545D6981-00000002
Nov 08 01:55:10 entlein hostapd[610]: ap0: STA f0:f6:1c:29:73:bb WPA: pairwise key handshake completed (RSN)

Fallback to the connected channel doesn't work with older versions of iw

We have the following scenario:
wlan0 is connect to an AP which transmits at channel 2.
Now, we want create AP with the same interface:

% create_ap wlan0 wlan0 test
Config dir: /tmp/create_ap.wlan0.conf.41iyR2Dw
Creating a virtual WiFi interface... ap0 created.
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.41iyR2Dw/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.41iyR2Dw/hostapd.conf
Using interface ap0 with hwaddr xx:xx:xx:xx:xx:xx and ssid "test"
Failed to set beacon parameters
Interface initialization failed
ap0: interface state UNINITIALIZED->DISABLED
ap0: AP-DISABLED 
ap0: Unable to setup interface.
hostapd_free_hapd_data: Interface ap0 wasn't started

Error: Failed to run hostapd, maybe a program is interfering.

Doing cleanup...

We get the above error because older version of iw doesn't show the channel number that we are connected, so create_ap didn't fallback to channel 2.

If we add -c 2 to the arguments, then everything works fine.

Solution:
We can get the channel frequency with iw dev wlan0 link and convert it to the channel

[Question] how to adjust the iptables commands if laptop/server behind proxy server?

My laptop has wlan and lan adapters. It accesses internet via (LAN adapter) and localhost proxy localhost:8888 (tinyproxy) and tinyproxy connect the upstream proxy server.

Now by starting your script, my client (andriod device) can connect the created wifi-ap, if I set up the http proxy (192.168.12.1:8888) in android, it can access internet via browser with or without internet sharing option. However there is no global proxy option for a not-rooted android device. That is apps other than browser cannot access internet. I think it could be possible to define a rule that let the requests from wifi adapter go to proxy server? I checked dnsmasq doc as well, there is "--server" option, I am not sure if it could help too. I did some try, but no success due to the lack of my iptables-fu. Could you please give some suggestion?

thank you.

(this is not an issue, it should be question, as I wrote in title.)

Script not cleaning up after being stopped by Systemd

Hi there.
Firstly, thank you for the great work, this script is very useful.

I have only one problem, as I am using NetworkManager the script automatically adds the Wireless adaptor to the unmanaged list. However if I use systemctl to stop or kill the process it does not do the cleanup process, where it removes the adaptor from the unmanaged list. So I have to do this manually every time I need to use other Wireless connection.

I noticed that this does not happen if I execute the script in the terminal and kill it using CTRL-C, it does the cleaning process correctly.

I've tried to change the KillSignal option in the service file but it did not behave any differently. I am using the default service file provided. Is there any option missing?

is there any proxy support?

does create_ap have the ability to use a proxy for any clients that linked, or create_ap simply follows the system rule HTTP_PROXY, HTTPS_PROXY

Access Point - unable to connect to wifi - RA3070

hello , i created an access point using the command
-create_ap -c 7 wlan0 eth0 test --no-virt

the access point started but i can not connect to it .
log

Config dir: /tmp/create_ap.wlan0.conf.nGFBD4eM
Network Manager config found, set wlan0 as unmanaged device... DONE
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.nGFBD4eM/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.nGFBD4eM/hostapd.conf
Failed to update rate sets in kernel module
Using interface wlan0 with hwaddr xx:xx:xx:xx:xx:xx and ssid 'test'
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: did not acknowledge authentication response

nmcli command change from nm to g from version 0.9.9.0

I am using Fedora 20 and the NetworkManager CLI version 0.9.9.0 already uses nmcli g instead of nmcli nm:

# nmcli help
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }

OPTIONS
  -t[erse]                                   terse output
  -p[retty]                                  pretty output
  -m[ode] tabular|multiline                  output mode
  -f[ields] <field1,field2,...>|all|common   specify fields to output
  -e[scape] yes|no                           escape columns separators in values
  -n[ocheck]                                 don't check nmcli and NetworkManager versions
  -a[sk]                                     ask for missing parameters
  -w[ait] <seconds>                          set timeout waiting for finishing operations
  -v[ersion]                                 show program version
  -h[elp]                                    print this help

OBJECT
  g[eneral]       NetworkManager's general status and operations
  n[etworking]    overall networking control
  r[adio]         NetworkManager radio switches
  c[onnection]    NetworkManager's connections
  d[evice]        devices managed by NetworkManager
# nmcli -v
nmcli tool, version 0.9.9.0-45.git20131003.fc20

I suggest the following fix:

version_cmp $NM_VER 0.9.9

Request wireless connection sharing.

Gents,

Thanks for this great tool. I'm trying to see if I can help, but fear that this is above my expertise at the moment. I would request that we have a reverse AP available so it would specifically look like this.

WAN<--- (some wifi access point) <--- wlan0 (create_ap NAT's to eth0) ----> dhcp clients

so its simply sharing the wireless connection through a eth0.

I know there are other tools in the wild that can do this in the world but i would like to keep all simple using the create_ap commands/script. All the needed tools are available in this case but I don't think the command is built into the script.

Joeordie

Problem running create_ap more than once in python script

Hello again,
I'm sorry for the questions. But I decided to use the project create_ap for my work. Basically, I'm creating a Python script that is alternating the client device (scan) and access point (create_ap). However, when using create_ap, an error occurs on the second iteration of the while in the following code:


sudo python script.py


import os
import time
import subprocess
from wifi import Cell, Scheme

while True:
cmd = ['/usr/bin/create_ap', 'wlan2', 'eth0', 'Teste2']
pro = subprocess.Popen(cmd)
pid = pro.pid
time.sleep(15)
os.system("kill " + str(pid))
time.sleep(5)


Code execution output:


WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan2.conf.iYp5ZEUM
PID: 10209
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan2.conf.iYp5ZEUM/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan2.conf.iYp5ZEUM/hostapd.conf
Using interface wlan2 with hwaddr 00:08:10:76:ce:e1 and ssid "Teste2"
wlan2: interface state UNINITIALIZED->ENABLED
wlan2: AP-ENABLED

WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan2.conf.UjKHNLDg
PID: 10344
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan2.conf.UjKHNLDg/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan2.conf.UjKHNLDg/hostapd.conf
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan2 wasn't started

Error: Failed to run hostapd, maybe a program is interfering.
If an error like 'n80211: Could not configure driver mode' was thrown
try running the following before starting create_ap:
nmcli nm wifi off
rfkill unblock wlan

Doing cleanup.. done

WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan2.conf.PwMduQn0
PID: 10471
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan2.conf.PwMduQn0/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan2.conf.PwMduQn0/hostapd.conf
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan2 wasn't started

Error: Failed to run hostapd, maybe a program is interfering.
If an error like 'n80211: Could not configure driver mode' was thrown
try running the following before starting create_ap:
nmcli nm wifi off
rfkill unblock wlan


What is the problem? Realize that worked correctly on the first run, but on the second try an error occurs.

Thank you for your help!

Bridge mode does not work

hi.
I just tried your "little" script inside a kali VM with an USB wifi dongle.

I run

$ ./create_ap.sh -m bridge wlan0 eth0 MonOuiPhi autruchecourrantdanslasavane
Config dir: /tmp/create_ap.wlan0.conf.bGtr8XqE 
PID: 4483
Creating a virtual WiFi interface... ap0 created.
Sharing Internet using method: bridge
Create a bridge interface... br0 created.
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.bGtr8XqE/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.bGtr8XqE/hostapd.conf
Failed to update rate sets in kernel module
Using interface ap0 with hwaddr yy:yy:yy:yy:yy:yy and ssid 'MonOuiPhi'
ap0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authenticated
ap0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: associated (aid 1)
ap0: AP-STA-CONNECTED xx:xx:xx:xx:xx:xx
ap0: STA xx:xx:xx:xx:xx:xx RADIUS: starting accounting session 54B208F6-00000000
ap0: STA xx:xx:xx:xx:xx:xx WPA: pairwise key handshake completed (RSN)

The AP shows up on wifi scan, the wifi client is able to connect and to get an IP address via DHCP, but one can not reach the internet.

a simple "ping 8.8.8.8" gives "Destination Host unreachable"
Something is broken or missing

Static ip

Is it possible to create an open wireless ap with a static IP address? Using create_ap

DNS is not working on host computer

For me, I tested all those AP manipulation scripts for Linux out there, but this was the only one to truly succeed, but with a tiny problem. When I start the create_ap script in --no-virt mode (In normal mode it says that the device wlan0ap is not found), it works fine on my mobile phone. But when I access the internet from my computer, DNS seems to stop and only those lately-opened websites with their DNS-data cached are accessible. I think it is a problem with the dnsmasq.

fail to create virtual interface

In the past months the same command worked as aspected but now it fail to start the virtual interface. I can't understand why.

Command:
./create_ap -c 4 -m 'nat' -g 10.10.10.1 wlp3s0 wlp3s0
Output:

Config dir: /tmp/create_ap.wlp3s0.conf.y2pf1u2m
hostapd will fail to use channel 4 because wlp3s0 is already set to channel 12, fallback to channel 12.
Creating a virtual WiFi interface... wlp3s0ap created.
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp3s0.conf.y2pf1u2m/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp3s0.conf.y2pf1u2m/hostapd.conf
wlp3s0ap: IEEE 802.11 Configured channel (12) not found from the channel list of current mode (1) IEEE 802.11g
wlp3s0ap: IEEE 802.11 Hardware does not support configured channel
Could not select hw_mode and channel. (-3)
wlp3s0ap: interface state UNINITIALIZED->DISABLED
wlp3s0ap: AP-DISABLED 
wlp3s0ap: Unable to setup interface.
hostapd_free_hapd_data: Interface wlp3s0ap wasn't started

Error: Failed to run hostapd, maybe a program is interfering.
If an error like 'n80211: Could not configure driver mode' was thrown
try running the following before starting create_ap:
    nmcli r wifi off
    rfkill unblock wlan

Doing cleanup...

I have tried also to change driver with the one currently used by my wirless card but the script says:
invalid/unknown driver 'iwlwifi'

If you need more info, ask please.

however, you did a great job !

DHCP issue on arm7h debian

I'm having an issue with create_ap at the moment with a Cubietruck running Debian. The SSID appears but clients cannot obtain an IP address. Any ideas what might be causing this?

cubie@Cubian> sudo ./create_ap -n --no-virt wlan0 CubietruckAP                                                                                                            ~/src/create_ap
Config dir: /tmp/create_ap.wlan0.conf.yJZBVAgO
No Internet sharing
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.yJZBVAgO/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.yJZBVAgO/hostapd.conf
Failed to create interface mon.wlan0: -95 (Operation not supported)
Using interface wlan0 with hwaddr 02:1a:11:f2:8f:91 and ssid 'CubietruckAP'
wlan0: STA cc:fa:00:eb:0c:5e IEEE 802.11: associated
wlan0: STA cc:fa:00:eb:0c:5e RADIUS: starting accounting session 535FC41E-00000000
wlan0: STA cc:fa:00:eb:0c:5e IEEE 802.11: disassociated
wlan0: STA cc:fa:00:eb:0c:5e IEEE 802.11: disassociated
wlan0: STA cc:fa:00:eb:0c:5e IEEE 802.11: associated
wlan0: STA cc:fa:00:eb:0c:5e RADIUS: starting accounting session 535FC41E-00000001
wlan0: STA cc:fa:00:eb:0c:5e IEEE 802.11: disassociated
wlan0: STA cc:fa:00:eb:0c:5e IEEE 802.11: disassociated
wlan0: STA cc:fa:00:eb:0c:5e IEEE 802.11: associated
wlan0: STA cc:fa:00:eb:0c:5e RADIUS: starting accounting session 535FC41E-00000002

RTL8188CUS - wlan0 is not a WiFi interface

Hi guys,

I'm going to re-share my existing wifi using the same interface so I run create_ap wlan0 wlan0 my_ssid my_pass but it gives me ERROR: wlan0 is not a WiFi interface.
As I mentioned in title, I use Realtek RTL8188CUS chipset and I don't know why iw list doesn't give me anything. But I can say there is no problem with the driver as I can easily connect to my existing wireless network.

Any suggestions would be helpful, thx.

Not able to connect at first attempt after boot.

Trying to connect to hotspot created on the computer from Nexus 5 Android smartphone.

How to reproduce:

  • Boot your computer, start the hotspot
  • In the phone, the hotspot is detected, but when we try to connect, it attempts to but nothing happens
  • On the computer, no extra messages are shown by create_ap
  • Now, stop create_ap and start it again
  • Try to connect to the hotspot now and the connection happens smoothly.

This problem seems to happen only after boot. For eg: if I had used create_ap for sometime, stop it and after a few hours come bac and try to use it again, the phone is able to connect without any problem.

My code is at the lastest commit (258fbc1)

Supporting user profiles

One issue I face with create_ap is that I always have to retype the entrie command the next time I use it, despite being the case that almost all my parameters will remain the same. Of course, I can use command history search, but it would be nice if create_ap can remember my settings.

I was thinking of implementing this. All the switches used, wifi interface, ethernet interface, ssid, password etc. already have internal variables being set. Supporting user profiles would just involve saving these variables to a file and having new switches to enable saving and loading of profiles.

One security concern might be storing of password. But, if the user is entering the password on command-line then he/she is anyway taking the risk of it showing up in the process table and also in the command history. If he/she uses stdin to send the password to create_ap, then we can just not store the password and prompt it from the user.

One last point to be taken care of, is if direct editing of the user_profile file will be allowed. I'm in favour of this; we can maybe have a format similar to ssh config. In this case, we would need to do some basic validation of the fields. But, I'm sure this is not difficult as most of values given with the command-line switches are anyway being validated.

What are your thoughts on this? If the above description is fine, then I'll start implementing this and send a pull request.

Failed to set beacon parameters

I am lost in here , any clue?
without --no-virt option is not possible at all .
i have rtl8187 chipset

create_ap -w 2 -c 7 wlan0 eth0 test 123456 --no-virtConfig
dir: /tmp/create_ap.wlan0.conf.FkVKB6Tb
Network Manager config found, set wlan0 as unmanaged device... DONE
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.FkVKB6Tb/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.FkVKB6Tb/hostapd.conf
Failed to update rate sets in kernel module
Could not connect to kernel driver.
Using interface wlan0 with hwaddr xx:xx:xx:xx:xx:xx and ssid 'test'
Failed to set beacon parameters

rtl8192cu dongle and A10 boards `iw` gotchas

This is about the usage of iw inside the script, assuming a WiFi is already there and working so that the wlan should simply bridge it or something … well, eth0 is way easier to configure and a board with a wired cable connection and a WiFi cheap dongle as any rtl8192cu could be might be already a desirable Access Point or simply a shared in-house WiFi for data transfer through some WebServer capability … you name it!

Accordingly, in order to make my Marsboard/Cubieboard work with this extremely handy script, I have walked up all possible hell doors ^_^

First of all, hostapd needs to be rebuild editing the PKGBUILD and adding, or replacing, armv7h as supported architecture.

After that, packman -U hostapd-…. and it will install the script.

Secondly, the kernel should be built with iptables enabled.
This is quite tricky with common hints found online since iptables has directly nothing to do with IPv6 so that latter one should not be included … not in A10 sunxi-3.4 or similar versions since apparently IPv6 does not work until sunxi 3.12 which is …. nowhere around.

Third, iw will never ever recognize your dongle so … right now, get over it!

After booting, I had to manually ip link set dev wlan0 up and only after write something like ./create_ap --driver rtl871xdrv -n wlan0 hello itswifi! so that I could connect to hello wifi using itswifi! as password.

In order to do so I had to remove every single iw related command and never be able to reboot because the moment I exit create_ap script I have to reboot the board or the dongle won't work anymore.

I know this is more about the distro, the kernel, the iw support, and not directly a create_ap problem but if it only could make the usage of iw optional, many problems would be solved for many other A10 boards and cheap dongles out there.

Thank You!

Encounter Authentication problem while WPA + WPA2 passphrase

I love this script very much! Thank for the excellent developer!

However, I encounter authentication problem after I executed sudo create_ap wlp9s0 enp3s0 arch_ap archisbest and use Galaxy Nexus to connect it. I can connect it successfully when I do not use WPA + WPA2 passphrase, like sudo create_ap wlp9s0 enp3s0 arch_ap.

Here the log for the former case is:

$ sudo create_ap wlp9s0 enp3s0 arch_ap archisbest
[sudo] password for acgtyrant: 
Config dir: /tmp/create_ap.wlp9s0.conf.3XfPRb3m
Creating a virtual WiFi interface... wlp9s0ap created.
Network Manager config found, set wlp9s0ap as unmanaged device... DONE
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp9s0.conf.3XfPRb3m/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp9s0.conf.3XfPRb3m/hostapd.conf
Using interface wlp9s0ap with hwaddr 38:59:f9:dd:78:14 and ssid "arch_ap"
wlp9s0ap: interface state UNINITIALIZED->ENABLED
wlp9s0ap: AP-ENABLED 
wlp9s0ap: STA a0:0b:ba:d5:ad:80 IEEE 802.11: authenticated
wlp9s0ap: STA a0:0b:ba:d5:ad:80 IEEE 802.11: associated (aid 1)
WPA: wpa_sm_step() called recursively
wlp9s0ap: STA a0:0b:ba:d5:ad:80 IEEE 802.11: deauthenticated due to local deauth request
^C
Doing cleanup...

Thank you!

Device or resource busy

Hello,

With the latest version from AUR, I got the following problem:

┌[root@vampire] [/dev/pts/1] 
└[~]> ./create_ap wlp2s0 enp1s0f0 NAME PASS
Config dir: /tmp/create_ap.wlp2s0.conf.kzyIUSub
Creating a virtual WiFi interface... wlp2s0ap created.
RTNETLINK answers: Device or resource busy

Doing cleanup...

Do you have any idea where it could come from ? I downgraded to a previous version which works like a charm.

SET_VLAN_NAME_TYPE_CMD failed

Hi,
I have been using your script for almost a month and had really no issues here. I just keep getting this error message:
VLAN: vlan_set_name_type: SET_VLAN_NAME_TYPE_CMD name_type=2 failed: Package not installed

It is a bit cryptic for me, I have installed all required packages, maybe there is some dependency that I have not covered? It is not interfering with usage, but maybe it could be resolved.

Thanks for your work.
kayvax

Method to stop running access point

It would be nice to have a dedicated method to stop the running access point. It gets a little bit confusing, on how to switch between different Access Points and how to disable it is unknown for me.

Connection instability at times

Have noticed, that with Arno's IP Tables firewall, the connection can be unstable at times to the point of slowdowns. After stopping the Arno's IP Tables script, the connection is good but dies from time to time.

Any suggestions especially in particular to installations of where a existing firewall is used, the script should not be modifying that if there is one present.

no internet

this is something that has bugged me for far too long. i haven't been able to set up a working AP from my laptop for about a year now (it used to work before!). i've taken up to finding the issue multiple times but have had to give up each time. i don't know what to do anymore. please help me with my latest (and hopefully a successful one) attempt. let me put it as clearly as i can:

  1. i've created an ap using create_ap wlan0 enp7s0 MyAccesspoint MyPassPhrase, and every other option really
  2. the connection is established with the client and an ip is assigned as well. but the internet doesn't work. i've tried using multiple clients, but to no avail. there isn't any error, so i don't no whats wrong.
  3. my laptop supports AP
  4. i have installed all the required packages
  5. i have tried both nat-ing and bridging, via create_ap as well as manually.
  6. i have read through all the issues posted here! and tried everything i could try but no success yet.
  7. i will post the results of some commonly asked for commands, but do let me know if there's some more info you would like me to share
    ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 88:ae:1d:2e:aa:fa brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 78:e4:00:84:97:ca brd ff:ff:ff:ff:ff:ff

iw list

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

iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

please please help me find out what the issue is with my device.
Happy Holidays!!

Add 5GHz support?

Hello,

first off thank you for providing such a useful "little" script!

I have one suggestion , though:
With the 2.4Ghz band becoming more and more crowded in highly populated regions, how about adding an option to your scripts to use the 5GHz band?

It should be pretty much as easy as adding a new call parameter and using "hw_mode=a", instead of "hw_mode=g" in the hostapd.conf.

Thank you very much for your good work.

Regards

Ingmar

invalid driver?

Trying to set it up on a Pi B with latest Rasbpian.
Dongle: TP-LINK TL-WN725N

pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0bda:8179 Realtek Semiconductor Corp.

pi@raspberrypi ~ $ basename $( readlink /sys/class/net/wlan0/device/driver )
rtl8188eu

pi@raspberrypi ~ $ sudo create_ap -w 2 wlan0 eth0 test11 12test12 --driver rtl8188eu
WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan0.conf.cA81lsYf
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.cA81lsYf/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.cA81lsYf/hostapd.conf
Line 4: invalid/unknown driver 'rtl8188eu'
1 errors found in configuration file '/tmp/create_ap.wlan0.conf.cA81lsYf/hostapd.conf'

Error: Failed to run hostapd, maybe a program is interfering.

Doing cleanup...
pi@raspberrypi ~ $ iw list
nl80211 not found.

pi@raspberrypi ~ $ lsmod
Module                  Size  Used by
xt_tcpudp               2110  0
iptable_filter          1485  0
ipt_MASQUERADE          1762  0
iptable_nat             2607  0
nf_conntrack_ipv4      12965  1
nf_defrag_ipv4          1491  1 nf_conntrack_ipv4
nf_nat_ipv4             3630  1 iptable_nat
nf_nat                 15166  3 ipt_MASQUERADE,nf_nat_ipv4,iptable_nat
nf_conntrack           87622  5 ipt_MASQUERADE,nf_nat,nf_nat_ipv4,iptable_nat,nf_conntrack_ipv4
ip_tables              11694  2 iptable_filter,iptable_nat
x_tables               17030  4 ip_tables,xt_tcpudp,ipt_MASQUERADE,iptable_filter
snd_bcm2835            19584  0
snd_soc_bcm2708_i2s     6202  0
regmap_mmio             2818  1 snd_soc_bcm2708_i2s
snd_soc_core          127841  1 snd_soc_bcm2708_i2s
snd_compress            8259  1 snd_soc_core
regmap_i2c              1661  1 snd_soc_core
snd_pcm_dmaengine       5505  1 snd_soc_core
regmap_spi              1913  1 snd_soc_core
8188eu                663122  0
snd_pcm                83845  3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_page_alloc          5132  1 snd_pcm
snd_seq                55484  0
snd_seq_device          6469  1 snd_seq
leds_gpio               2079  0
led_class               4118  1 leds_gpio
snd_timer              20998  2 snd_pcm,snd_seq
snd                    62252  7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress

pi@raspberrypi ~ $ sudo create_ap -w 2 wlan0 eth0 test11 12test12 --driver 8188eu
WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt
Config dir: /tmp/create_ap.wlan0.conf.mtIvORsF
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.mtIvORsF/hostapd_ctrl
Configuration file: /tmp/create_ap.wlan0.conf.mtIvORsF/hostapd.conf
Line 4: invalid/unknown driver '8188eu'
1 errors found in configuration file '/tmp/create_ap.wlan0.conf.mtIvORsF/hostapd.conf'

Error: Failed to run hostapd, maybe a program is interfering.

Doing cleanup...

I'm out of ideas, any pointers?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.