I wanted to use my desktop with a wired ethernet connection (eth0) to operate my "TP-LINK TL-WN722N" USB Wifi Adapter (wlan0) as a non-adhoc (infrastructure mode) access point for my Android to connect to.

After MUCH searching, I finally found a method (spread across many websites) that does most of what I need...



I modified "/etc/network/interfaces"

sudo gedit /etc/network/interfaces

to contain:

# This file describes the network interfaces available on your system
# and how to activate them.

auto lo br0
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual

# Bridge setup

# for dhcp address
iface br0 inet dhcp
bridge_ports eth0 wlan0

# for static ip
# iface br0 inet static
# bridge_ports eth0 wlan0
# adapt with your network settings
# address
# netmask
# network
# broadcast
# gateway
# dns-* options are implemented by the resolvconf package, if installed
# dns-nameservers
# dns-search localdomain

### Reference ###

# Creating a Wireless Access Point with Debian Linux « Agent Oss (October 31, 2011)
# https://agentoss.wordpress.com/2011/10/31/creating-a-wireless-access-point-with-debian-linux/

My "/etc/hostapd/hostapd.conf" (which I somehow managed to put together myself)

sudo gedit /etc/hostapd/hostapd.conf


 ### Guts ###


 ### General ###


 ### Security ###

 ignore_broadcast_ssid=0     ## 0 visible # 1 hidden ##

 ### Reference ###

 ## Created Tuesday, February 14, 2012 ## Ubuntu 11.10/12.04 ##

 # Hostapd Linux Documentation Page
 # http://linuxwireless.org/en/users/Documentation/hostapd

 # Creating a Network Bridge on Ubuntu (January 16th, 2011)
 # http://webserver.linuxportal.nl/?p=422

(I've edited out the security bits for this post)

All of that allows me to open up a Terminal and execute:

 sudo hostapd -B /etc/hostapd/hostapd.conf

to have a functioning access point that my Android and all other WiFi devices can connect to.

Aside from sharing this method with others since info for this setup is so sparse; there are three problems that would be nice to fix:

  1. This configuration deactivates network manager and all of its functions. When you click it, it gives a "device not managed" message. (not essential, but a bit annoying to me)
  2. This method can struggle with IP addresses from time to time.
  3. I must use a terminal to turn on Wifi. (Ok for me, but not family friendly). I figured out how to make a launcher using gksu and a simple script if anyone needs one...

Launching wifi/Hostapd without a terminal

  1. (Why can't network manager do this out-of-the-box??)

Thanks in advance! I hope all of this can help someone else; I've never written a tutorial before and know virtually nothing about networking...

Perhaps related to network bridge - without destroying network manager (among others).

Tested using Ubuntu 11.10, 12.04.

3 Answers 3


I'm not sure about how to do this without clobbering NM, but it is possible to run automatically at boot and get IP addresses to assign easily (at least I have managed this with the same wireless card). This requires the packages hostapd and dnsmasq (not dnsmasq-base)


driver=nl80211 # This works on my TL-WN722N



wpa_pairwise=TKIP CCMP


# Defaults for hostapd initscript
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz

# Additional daemon options to be appended to hostapd command:-
#   -d   show more debug messages (-dd for even more)
#   -K   include key data in debug messages
#   -t   include timestamps in some debug messages
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.

/etc/dnsmasq.conf (diff against maintainer's version):

--- /etc/dnsmasq.conf.dpkg-dist 2011-09-20 00:28:30.000000000 +0100
+++ /etc/dnsmasq.conf   2012-02-13 21:03:03.713554612 +0000
@@ -82,7 +82,7 @@
 # specified interfaces (and the loopback) give the name of the
 # interface (eg eth0) here.
 # Repeat the line for more than one interface.
 # Or you can specify which interface _not_ to listen on
 # Or which to listen on by address (remember to include if
@@ -133,7 +133,7 @@
 # a lease time. If you have more than one network, you will need to
 # repeat this for each network on which you want to supply DHCP
 # service.

 # This is an example of a DHCP range where the netmask is given. This
 # is needed for networks we reach the dnsmasq DHCP server via a relay


auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static

/etc/sysctl.conf patch (run sudo sysctl -p /etc/sysctl.conf after changing):

--- sysctl.conf 2012-05-14 18:06:57.514873009 +0100
+++ /etc/sysctl.conf    2012-05-14 18:09:27.122876525 +0100
@@ -25,7 +25,7 @@

 # Uncomment the next line to enable packet forwarding for IPv4

 # Uncomment the next line to enable packet forwarding for IPv6
 #  Enabling this option disables Stateless Address Autoconfiguration

Finally, set up NAT in iptables:

sudo iptables -A FORWARD -o eth0 -i eth1 -s -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
sudo iptables-save | sudo tee /etc/iptables.sav

and add iptables-restore < /etc/iptables.sav above exit 0 in /etc/rc.local.

This setup was mostly implemented by reading this howto and staring at man pages scratching my head.

  • Thanks! I know what you mean by the head scratching; this thing sure was a pain to get working at all. I'll try your config and let you know how it goes in the next few days. :)
    – askuhn
    Feb 20, 2012 at 20:30
  • In the last few days, I've found that the /etc/network/interfaces file doesn't work for some reason, and my phone doesn't connect properly. I've gone back to manually giving wlan0 an address on boot for now.
    – dutchie
    Feb 23, 2012 at 9:35
  • My setup has been working pretty well as long as I don't try to connect more than one device (when I do, sometimes it works, sometimes it doesn't). I'm still tinkering, so if I come up with anything better, I'll be sure to post. :)
    – askuhn
    Feb 23, 2012 at 20:24

Most trouble occurs because of the Broadcom drivers in HP Laptops at least. If you have a broadcom network controller Check if your card is compatible with b43(link 1). If it is, awesome, keep reading. The default Broadcom sta driver (wl) will not support access point mode. So install b43 taking precautionary measure to be online by any means necessary. Turn it on using modprobe. Now follow instructions and try to set up access point.

I've finally got hostapd working with this and the sweet part is that my Nokia phone can detect the wifi so created (It can detect anything, adhoc or not). Now I have to play around with your file and see if I can get my playbook to detect.

  1. http://linuxwireless.org/en/users/Drivers/b43
  2. http://pclinuxos.com/forum/index.php?topic=91991.0
  • Also this worked when i got device not managed in the device manager. askubuntu.com/questions/71159/… Apr 2, 2012 at 14:57
  • Glad this was helpful for you! It took me forever to figure out what I needed to get something that worked for me. Thanks for the link about network manager, I'll be sure to try it out :)
    – askuhn
    Apr 4, 2012 at 1:51
  • And it Works! The amazing part is eth0 does not have to be static by this method. The ip acquired will be for all of eth0, the bridge and the device you wish to connect! Apr 6, 2012 at 10:39
  • On last paragraph, did you mean playbook to be detected?
    – tshepang
    May 24, 2013 at 15:11

Excellent answers above, however it's not just one or two chipsets that don't support hostapd or AP mode.

Here's how to see if your driver and hardware supports AP mode:

sudo iw list | less

Look for the "supported interface modes" section. If it doesn't include "AP", you're out of luck. If it does say "AP", then proceed with the many good instructions already provided by other posters!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .