Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have been able to create a wireless access point (on my raspberry pi) using a usb wifi 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 wifi 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 working... 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
  address 192.168.50.1
  netmask 255.255.255.0
  network 192.168.50.0
  broadcast 192.168.50.255
  gateway 192.168.50.1
  vlan_raw_device wlan0

iface wlan0 inet manual

Here are the contents of hostapd.conf:

interface=wlan0
driver=rtl871xdrv
country_code=NZ
ctrl_interface=wlan0.10
ctrl_interface_group=0
ssid=RPiAP
hw_mode=g
channel=1
wpa=3
wpa_passphrase=PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
beacon_int=100
auth_algs=3
macaddr_acl=0
wmm_enabled=1
eap_reauth_period=360000000

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 192.168.50.0 netmask 255.255.255.0 {
       range 192.168.50.10 192.168.50.250;
       option broadcast-address 192.168.50.255;
       option routers 192.168.50.1;
       default routers 192.168.50.1;
       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?

share|improve this question
    
You can't bridge to a WiFi client connection. WiFi is not Ethernet and doesn't support bridging unless WDS is configured on both ends. –  David Schwartz Jun 26 '13 at 7:27
    
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 '13 at 13:44
    
can you check the logs to see If the dhcp server receives any requests ? –  Lawrence Sep 4 '13 at 10:19
    
As I know, is impossible to work AP and station at same time on same physical WLAN interface. –  mmv-ru May 18 at 13:42
add comment

1 Answer

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.

share|improve this answer
add comment

protected by Community May 18 at 13:05

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

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.