6

I have successfully set up my Pi 3B+ as an access point so it can create and broadcast it's own network SSID "wallPi" on the internal wlan0. My goal is to make a video wall using this Wi-Fi network. But now I am struggling to get it to connect to a different network that has internet access so that I can download new things to the Pi. The second network should connect through my Wi-Fi dongle on wlan1.

I'm running Raspbian Stretch on Pi 3B+. The Wi-Fi dongle is Edimax EW-7722UTn V2.

Here is the result of iwconfig.

pi@raspberrypi:~ $ iwconfig
wlan0     IEEE 802.11bg  ESSID:"wallPi_AP"  Nickname:"<WIFI@REALTEK>"
      Mode:Master  Frequency:2.442 GHz  Access Point: 74:DA:38:DE:05:7E
      Bit Rate:54 Mb/s   Sensitivity:0/0
      Retry:off   RTS thr:off   Fragment thr:off
      Power Management:off
      Link Quality=86/100  Signal level=76/100  Noise level=0/100
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.

wlan1     IEEE 802.11  ESSID:off/any
      Mode:Managed  Access Point: Not-Associated   Tx-Power=31 dBm
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Power Management:on

pi@raspberrypi:~ $

But if I add my network name and password to the /etc/wpa_supplicant/wpa_supplicant.conf file then it won't create the wallPi network. Both wlan0 and wlan1 are associated with my home network.

Aurora0001
  • 6,308
  • 3
  • 23
  • 38
Mark Peterson
  • 161
  • 1
  • 2

3 Answers3

2

I am doing the same thing. But in my case I want to use the onboard wifi as WIFI access point and I want to use an Edimax EW-7811UTC AC600 as wireless client. I used to run this configuration on my RPI3B successfully.

For installing the EDIMAX I followed: https://edimax.freshdesk.com/support/solutions/articles/14000032146-how-to-install-ew-7811-ac600-series-and-ew-7822uac-adapters-on-raspberry-pi This was a very good description, only mistake in there is that at several places they used: rtl8812Au where it should have been rtl8812au. For the rest this worked as a charm.

Further I have adapted the following files.

  • /etc/dhcpcd.conf
  • /etc/dnsmasq.conf
  • /etc/rc.local
  • /etc/default/hostapd
  • /etc/hostapd/hostapd.conf
  • /etc/init.d/hostapd
  • /etc/network/interfaces
  • /etc/network/interfaces.d/native_wifi.cfg
  • /etc/systemd/network/99-default.link
  • /etc/wpa_supplicant/wpa_supplicant.conf

Current status is that my WIFI access point is working well, but the WIFI client is still not working. For getting predictable interfaces I have added the file: /etc/systemd/network/99-default.link The out of the box installation has a link there like: 99-default.link -> /dev/null. This I renamed to 99-default.old and added in a new file. This file looks like:

[Link]
NamePolicy=kernel database onboard slot path mac
MACAddressPolicy=persistent

This ensures you will have the predictable interfaces. In my case they are called:

wlxb827ebceb73c which is the RPI3B+ onboard WIFI and enx74da38c6f9fc which is the Edimax EW-7811UTC AC600.

In /etc/hostapd/hostapd.conf the SSID and PASSWORD for the WIFI access point are defined.

In the file /etc/wpa_supplicant/wpa_supplicant.conf the SSID and PASSWORD of the internet modem to which the WIFI client should connect are defined.

What I think to be rather strange is the following: For the RPI3B the Edimax WIFI interfaces always got a predictable interface name starting with wlx* Now on the RPI3B+ the Edimax WIFI name starts with en*, the same as the fixed Ethernet connection.

/etc/dhcpcd.conf:

hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
denyinterfaces wlxb827ebceb73c

/etc/dnsmasq.conf:

interface=wlxb827ebceb73c
dhcp-range=10.0.0.100,10.0.0.200,255.255.255.0,12h

/etc/rc.local:

_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

sleep 10
sudo iw enx74da38c6f9fc set power_save off
exit 0

/etc/default/hostapd:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

/etc/hostapd/hostapd.conf:

driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
beacon_int=100
auth_algs=1
wpa_key_mgmt=WPA-PSK
ssid=MEITH
channel=1
hw_mode=b
wpa_passphrase=ChangeMe
interface=wlxb827ebceb73c
wpa=1
wpa_pairwise=TKIP
country_code=NL

/etc/init.d/hostapd:

#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON_SBIN=/usr/sbin/hostapd
DAEMON_DEFS=/etc/default/hostapd
DAEMON_CONF=/etc/hostapd/hostapd.conf
NAME=hostapd
DESC="advanced IEEE 802.11 management"
PIDFILE=/run/hostapd.pid

[ -x "$DAEMON_SBIN" ] || exit 0
[ -s "$DAEMON_DEFS" ] && . /etc/default/hostapd
[ -n "$DAEMON_CONF" ] || exit 0

DAEMON_OPTS="-B -P $PIDFILE $DAEMON_OPTS $DAEMON_CONF"

. /lib/lsb/init-functions

case "$1" in
  start)
    log_daemon_msg "Starting $DESC" "$NAME"
    start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_SBIN" \
        --pidfile "$PIDFILE" -- $DAEMON_OPTS >/dev/null
    log_end_msg "$?"
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" "$NAME"
    start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_SBIN" \
        --pidfile "$PIDFILE"
    log_end_msg "$?"
    ;;
  reload)
    log_daemon_msg "Reloading $DESC" "$NAME"
    start-stop-daemon --stop --signal HUP --exec "$DAEMON_SBIN" \
        --pidfile "$PIDFILE"
    log_end_msg "$?"
    ;;
  restart|force-reload)
    $0 stop
    sleep 8
    $0 start
    ;;
  status)
    status_of_proc "$DAEMON_SBIN" "$NAME"
    exit $?
    ;;
  *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload|reload|status}" >&2
    exit 1
    ;;
esac

exit 0

/etc/network/interfaces:

source /etc/network/interfaces.d/*.cfg

/etc/network/interfaces.d/native_wifi.cfg:

allow-hotplug enx74da38c6f9fc
iface enx74da38c6f9fc inet dhcp

allow-hotplug wlxb827ebceb73c
iface wlxb827ebceb73c inet static
    address 10.0.0.1
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255
wireless-power off

/etc/systemd/network/99-default.link:

[Link]
NamePolicy=kernel database onboard slot path mac
MACAddressPolicy=persistent

/etc/wpa_supplicant/wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=NL

network={
    ssid="YOUR_SSID"
    psk="YOUR PASSWORD"
    key_mgmt=WPA-PSK
}

Please note I have left out all commented out remarks. One strange thing is if I did not do the predictable interfaces and if I started out with the Edimax unplugged, and did not set the SSID and PASSWORD for the modem, then plugged in the Edimax it all works.

Cheers, Paul

Paulo01
  • 21
  • 1
  • Would this setup work if I want to connect the Pi to two networks? See my question here: https://raspberrypi.stackexchange.com/questions/98599/connecting-the-pi-to-multiple-wifi-networks-simultaneously – Vin Shahrdar May 15 '19 at 01:12
0

How to set up networking/WiFi shows Use different wpa_supplicant files and Prevent dhcpcd from configuring an interface

NOTE that using wlan0 & wlan1 is likely to be unreliable, as there is no guarantee which will be allocated to which interface (although the on-board interface will probably win). You should enable Predictable Network Interface Names which most Linux distos use.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • Where do I change the Wi-Fi name from wlan1 to wlx(MAC address)? – Mark Peterson May 02 '18 at 17:55
  • I found the predictable network names setting in 'sudo raspi-config'. That didn't immediately help. Whenever I put my network name and password in wpa_supplicant.conf then both wifi radios access that network. I'm trying to have one access the network and the other create an access point. – Mark Peterson May 02 '18 at 22:05
0

I have found a way to make it work 100% but with a special workaround. For the above files, where applicable:

  • Rename wlxb827ebceb73c to wlan0
  • Rename enx74da38c6f9fc to wlan1

Remove the file /etc/systemd/network/99-default.link and put back the link which was originally there

Rename the file /etc/wpa_supplicant/wpa_supplicant.conf to /etc/wpa_supplicant/wpa_supplicant-wlan1.conf

Remove the Edimax during poweron. Only after it is powered on insert the Edimax. Now it will work. Reproducible. But each time during poweron the Edimax must not be present.

Later on I will post the complete image of the code on my website: www.meith.org

Cheers, Paul

Paulo01
  • 21
  • 1