I have a Raspberry Pi with 2 WiFi interfaces (built-in and USB dongle). I want to set up one of them (wlan0) to connect to a WiFi router for Internet access and the other one (wlan1) as an Access Point for clients to connect to.
I have the following, which worked perfectly fine in Raspbian Jessie:
/etc/network/interfaces
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
# eth0 is upstream (Internet - currently unused)
iface eth0 inet manual
# wlan0 is upstream (Internet)
allow-hotplug wlan0
iface wlan0 inet manual
# eth1 and wlan1 are for clients
allow-hotplug eth1
iface eth1 inet manual
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
/etc/wpa_supplicant/wpa_supplicant.conf
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="UPSTREAM_SSID"
psk="UPSTREAM_PASSWORD"
proto=WPA
key_mgmt=WPA-PSK
}
/etc/hostpad/hostapd.conf
logger_syslog=-1
logger_syslog_level=2
interface=wlan1
driver=nl80211
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
ssid=MY_AP_SSID
wpa_passphrase=MY_AP_PASSWORD
This all worked in Jessie. In Raspbian Stretch, however, I cannot see my AP SSID broadcast. iwconfig
shows UPSTREAM_SSID
as the ESSID for both wlan0 and wlan1.
syslog has this (not sure if relevant):
syslog:Jun 2 16:07:00 atom hostapd[665]: Configuration file: /etc/hostapd/hostapd.conf
syslog:Jun 2 16:07:00 atom hostapd[665]: wlan1: Could not connect to kernel driver
syslog:Jun 2 16:07:00 atom hostapd[665]: Using interface wlan1 with hwaddr WLAN1_MAC and ssid "MY_AP_SSID"
syslog:Jun 2 16:07:00 atom hostapd[665]: wlan1: interface state UNINITIALIZED->ENABLED
syslog:Jun 2 16:07:00 atom hostapd[665]: wlan1: AP-ENABLED
syslog:Jun 2 16:07:00 atom hostapd: wlan1: STA UPSTREAM_ROUTER_MAC IEEE 802.11: disassociated
syslog:Jun 2 16:07:00 atom hostapd: wlan1: STA UPSTREAM_ROUTER_MAC IEEE 802.11: disassociated
syslog:Jun 2 16:07:00 atom hostapd: wlan1: STA UPSTREAM_ROUTER_MAC IEEE 802.11: disassociated
syslog:Jun 2 16:07:00 atom hostapd: wlan1: STA UPSTREAM_ROUTER_MAC IEEE 802.11: disassociated
So it doesn't seem like it's even trying to set up an AP but just connects to the upstream WiFi router using both WiFi cards!
Edit: Forgot to say that I had to add a /etc/dhcpcd.conf file in Stretch - under Jessie these settings were in /etc/network/interfaces
# ... all the stuff from the default file ...
interface eth1
static ip_address=192.168.5.1/24
interface wlan1
static ip_address=192.168.4.1/24
Edit 2: With Epehmeral's help I ended up getting it working by removing the interface wlan1
lines from /etc/dhcpcd.conf and instead adding this to /etc/network/interface:
iface wlan1 inet manual
post-up ip a add 192.168.4.1/24 dev wlan1
post-down ip a del 192.168.4.1/24 dev wlan1