I have been able to create a wireless access point on my Raspberry Pi using a USB Wi-Fi dongle using hostapd on wlan0. What I would like to be able to do is have the access point be on some virtual interface (i.e. wlan0:1) or vlan (wlan0.123) and have wlan0 connect to an existing access point.

That way I can connect to the device via the access point it provides, or through the network that it was able to connect to.

The end goal is this: I can connect to the device using the access point it provides. It will then do a scan of wireless access points it finds, ask me which one I would like to connect to, and then attempt to connect to it. It can then tell me the IP address it was able to get on that new connection or tell me that it failed to connect (because I will still be connected via the access point it is providing).

If there is some other way to do this (without having two physical Wi-Fi adapters) I'm all ears.

For now, the steps I am taking are to get the AP working on the vlan interface. That is not workin… the AP is visible, but it seems that the DHCP server is not issuing an IP address.

Here are the contents of /etc/network/interfaces:

auto lo
auto wlan0 wlan0.10
auto eth0

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0

iface wlan0.10 inet static
  vlan_raw_device wlan0

iface wlan0 inet manual

Here are the contents of hostapd.conf:


Note that above I had to say the interface is wlan0. It seems hostapd does not like it if I put wlan0.10.

Finally here is my dhcp configuration (isc-dhcp-server):

shared-network VLAN10 {
subnet netmask {
       option broadcast-address;
       option routers;
       default routers;
       default-lease-time 600;
       max-lease-time 7200;
       option domain-name "local";

It appears that the AP/dhcp doesn't like being on a VLAN as my phone seems to get stuck on "Obtaining IP address from RPiAP...". Or maybe I have to do some iptables rules to remove the tagging?

  • I am not trying to bridge them but have two ways to access the device. One via the access point it provides. Another via the LAN it connects to.
    – Gabe
    Jun 26, 2013 at 13:44
  • can you check the logs to see If the dhcp server receives any requests ?
    – Lawrence
    Sep 4, 2013 at 10:19
  • As I know, is impossible to work AP and station at same time on same physical WLAN interface. May 18, 2014 at 13:42
  • 1
    @mmv-ru That’s not true. There are plenty of devices out there that can do both at the same time. Obligatory warning though: Because AP mode requires a fixed channel, the client interface will be limited to this channel.
    – Daniel B
    Mar 15, 2015 at 12:27

2 Answers 2


Using a single WLAN device both as access points (AP) and client (station, STA) is only possible if the device supports it. You can use iw phy or iw list to find out if your device does; there's a line valid interface combinations which describes what combinations are possible (including other mode). Details are for example here.

If your device supports it, you can add new virtual interfaces with something like

iw phy phy0 interface add wlan0_ap type ap

(modify as needed, the other type is sta for client/station).

Then you can run hostapd on one interface, and use the other interface normally.


The hostap and dhcp server is working fine, but te time of your mobilephone and the raspberry pi not is sincronized. Try to put the same time both devices.

Not the answer you're looking for? Browse other questions tagged or ask your own question.