User avatar
SlowBro
Posts: 165
Joined: Sat Feb 18, 2017 1:30 am

[SOLVED] Zero W with extra USB Wi-Fi adapter; One static, one DHCP client

Mon Sep 17, 2018 2:33 am

How do I configure Raspbian Stretch Lite on my Zero W with a second USB Wi-Fi adapter? The built-in adapter (wlan0) must have a fixed IP (192.168.4.1) serving hostapd and dnsmasq. The second (wlan1) uses a standard DHCP client. How would I configure this?

I've managed to work out setting up wlan0 with the static IP, but I'm not sure how to configure the second adapter.

Code: Select all

root@raspberrypi:/Pi# cat /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=Pi
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=**********
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
root@raspberrypi:/Pi# cat /etc/dnsmasq.conf
interface=wlan0
  dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
root@raspberrypi:/Pi# grep -C5 wlan0 /etc/dhcpcd.conf

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant

denyinterfaces wlan1
root@raspberrypi:/Pi# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
root@raspberrypi:/Pi# cat /etc/wpa_supplicant/wpa_supplicant.conf
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
    ssid="*****"
    psk=*********************************************************************
    key_mgmt=WPA-PSK
}
root@raspberrypi:/Pi#
Last edited by SlowBro on Mon Sep 17, 2018 2:58 am, edited 1 time in total.

User avatar
SlowBro
Posts: 165
Joined: Sat Feb 18, 2017 1:30 am

Re: Zero W with extra USB Wi-Fi adapter; One static, one DHCP client

Mon Sep 17, 2018 2:58 am

Solved. Helps to use the correct SSID in wpa_supplicant.conf :D

Otherwise, that configuration is correct.

Return to “Networking and servers”