4
4
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
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?
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 – 2015-03-15T12:27:36.587
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 – 2013-06-26T13:44:11.373
can you check the logs to see If the dhcp server receives any requests ? – Lawrence – 2013-09-04T10:19:36.283
As I know, is impossible to work AP and station at same time on same physical WLAN interface. – Mikhail Moskalev – 2014-05-18T13:42:44.187