RPi3 and using a USB wifi adaptor

Posted by paul33B 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
RPi3 and using a USB wifi adaptor
May 13, 2016 12:21PM
Hello. I am having trouble having the RPi boot into using the usb wifi adaptor. It's always going into the built in one.

Any suggestions?

Thanks!
Re: RPi3 and using a USB wifi adaptor
May 13, 2016 12:28PM
[alarm@alarmpi ~]$ ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:7c:23:1c  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 cool smiley
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 cool smiley
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 166  bytes 13150 (12.8 Kicool smiley
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 166  bytes 13150 (12.8 Kicool smiley
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.77.1  netmask 255.255.255.0  broadcast 192.168.77.255
        inet6 fe80::ba27:ebff:fe29:7649  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:29:76:49  txqueuelen 1000  (Ethernet)
        RX packets 406  bytes 57305 (55.9 Kicool smiley
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 210  bytes 35526 (34.6 Kicool smiley
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[alarm@alarmpi ~]$ iwconfig
wlan0     IEEE 802.11bgn  Mode:Master  Tx-Power=1496 dBm   
          Retry short limit:7   RTS thryawning smileyff   Fragment thryawning smileyff
          Power Managementyawning smileyn
          
lo        no wireless extensions.

eth0      no wireless extensions.

wlan1     IEEE 802.11bgn  ESSIDyawning smileyff/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm   
          Retry short limit:7   RTS thryawning smileyff   Fragment thryawning smileyff
          Power Managementyawning smileyff
Re: RPi3 and using a USB wifi adaptor
May 13, 2016 07:06PM
In your piratebox.conf file, change all instances of wlan0 to wlan1 also change your interface in hostapd.conf from wlan0 to wlan1 and reboot. See if that works for you.


PirateBox Installs:
2x Zsun's (both testing, one with serial interface)
A5-V11 (mostly for OpenWRT testing DIY)
2x RPi Zero's
(one active in car 24/7, gets a lot of hits at Walmart, movie theaters and the mall)
2x RPi3's (both home servers, one Ubuntu custom install along side a ton of other services)
1x RPi2 (currently work server)



Edited 2 time(s). Last edit at 05/13/2016 07:10PM by TheExpertNoob.
Re: RPi3 and using a USB wifi adaptor
May 14, 2016 03:02PM
Thanks, did that.

Also, had to change an instance of, "phy0" to "phy1"

Now it works.
I am attempting to use a TP-Link TL-WN722N as a USB wifi adaptor on the RaspberryPi 3, but after following the above steps to cause the pi to use the external it stopped broadcasting the network. Any suggestions?
Here's some more info:

[alarm@alarmpi ~]$ iwconfig
wlan0 IEEE 802.11bgn ESSIDyawning smileyff/any
Mode:Managed Access Point: Not-Associated
Retry short limit:7 RTS thryawning smileyff Fragment thryawning smileyff
Power Managementyawning smileyn

lo no wireless extensions.

eth0 no wireless extensions.

wlan1 IEEE 802.11bgn ESSIDyawning smileyff/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry short limit:7 RTS thryawning smileyff Fragment thryawning smileyff
Power Managementyawning smileyff

[alarm@alarmpi ~]$
Re: RPi3 and using a USB wifi adaptor
May 20, 2016 06:24PM
can you please post the content of

/opt/piratebox/conf/piratebox.conf
/opt/piratebox/conf/hostapd.conf
Hostapd.conf is as follows:

interface=wlan1
driver=nl80211
ssid=PirateBox - Share Freely
hw_mode=g
channel=1
#auth_algs=1
#ieee80211n=1

And piratebox.conf:

#########
## Config for pirate-box WWW Release
## written by Matthias Strubel (matthias.strubel@aod-rpg.de) 2011-02-22
## licenced by gpl ; feel free to improve or send me feedback
##
## 2012-04-12 Created
## 2012-06-08 Changed IP Stuff to generating dnsmasq.conf stuff
## ADDed SubConfig for IPV6 config
## Changed Order of config
## 2013-08-14 Added timesave url
##
########

#######
## Configuration help
## If you plan to use one laptop as the piratebox:
## Set DO_IFCONFIG , USE_APN, USE_DNSMASQ to yes
## If you plan to run a two component setup (one router and one providing the storage+website)
## connected with ethernet:
## Set DO_IFCONFIG , USE_APN, USE_DNSMASQ to no
## Configure your ethernet eth0 (or whatever) to a static IP
## force your router to publish the HOST Option with your static IP; in case of dnsmasq add the /etc/hosts entrys
## Have a look at [wiki.daviddarts.com] for futher instructions
##
## You may deactivated severall option as needed. It's flexible.


#----------------- Folder Configuration -------------------#

PIRATEBOX_FOLDER="/opt/piratebox"
WWW_FOLDER="/opt/piratebox/www"

#Do not change untill really needed.
PIRATEBOX_PYTHONPATH="$PIRATEBOX_FOLDER/python_lib"


#Datafolder , where is you usb-stick // drive mounted
SHARE_FOLDER="$PIRATEBOX_FOLDER/share"

#Upload Folder
# Change this if you want to user uploaded data in a subfolder
# Make sure the folder exists
# UPLOADFOLDER="$SHARE_FOLDER/Upload"
UPLOADFOLDER="$SHARE_FOLDER/Shared"

#----------------- Startup Configuration -------------------#
# Which Steps has to be done

#Do network config
DO_IFCONFIG="yes"

#Do IW config - setting up a wlan0 interface with iw
# for some wifi-cards required
DO_IW="yes"
#Iw physical interface
PHY_IF="phy1"

# Check if interface exists
# should be set to yes if you use a USB wifi card
PROBE_INTERFACE="yes"
# wait how many seconds until throw an error
PROBE_TIME=10

#Start services...
# act like a apn / <yes|no>
# please have a look @ hostapd.conf ; you may need to change some options, regarding wifi-card
USE_APN="yes"
# act like dns&dhcp (dnsmasq)
USE_DNSMASQ="yes"

#HOSTNAME ... if you really want to change it, plz change:
# bin/droopy
# conf/hosts
HOST="piratebox.lan"

#----------------- Configuration for DNSMASQ & IF-Setup -------------------#
# Name of the wlan interface
INTERFACE="wlan1"
# On which interface DNSMASQ should listen. -i is the parameter for dnsmasq
# Make it empty to disable
DNSMASQ_INTERFACE="wlan1"

#Brdige add interfacce (setr yes to enable bridging)
DO_BRIDGE="no"
BRIDGE="br-lan"

#Network
NET=192.168.77

#IP-SHORT (is stringed together)
# Which IP is your Box?? i.e. 1 => 192.168.77.1
IP_SHORT=1

#DHCP LEASE Start
START_LEASE=10
#DHCP LEASE End Range
END_LEASE=250
#Leasetime (When should the client renew it's IP)
LEASE_DURATION=12h

# Where is the leasefile stored to?
LEASE_FILE_LOCATION=$PIRATEBOX_FOLDER/tmp/lease.file


# Define the netmask
NETMASK=255.255.255.0

#SET IP for ifconfig stuff - DON'T CHANGE
IP=$NET.$IP_SHORT

#Load Config about ipv6 stuff - DON'T CHANGE
. $PIRATEBOX_FOLDER/conf/ipv6.conf


#----------------- Configuration for the pure piratebox -------------------#
## droopy, webserver, shoutbox- and forum-server

## Timesave file for non RTC devices
TIMESAVE="$PIRATEBOX_FOLDER/share/timesave_file"

#On non OpenWRT you can use the default output format
# as an input format. For OpenWrt you need to specify +%C%g%m%d%H%M
# The content is exchanged during makefile processing and image build
TIMESAVE_FORMAT="+%C%g%m%d %H%M"

#Start droopy? - Enable upload?
DROOPY_ENABLED="yes"
#Image-SRC
IMAGENAME="piratebox-logo-small.png"
IMAGE="$PIRATEBOX_FOLDER/src/$IMAGENAME"
DROOPY_TXT=""
DROOPY_PORT="8080"
# Set correct permissions for an uploaded file
DROOPY_CHMOD="755"
DROOPY_USERDIR=""
# Uncomment line below for adding directory feature
#DROOPY_USERDIR=" -u True "

#Use UserId from lighttpd for droopy (use on ext-filesystems)
DROOPY_USE_USER="yes"

#Configuration for chat (If you decide to move the chat folder, you have to change /opt/piratebox/chat/cgi-bin/py* files )
CHATFILE="$WWW_FOLDER/cgi-bin/data.pso"

#Generated File
GEN_CHATFILE="$WWW_FOLDER/chat_content.html"

#Generated File for DiskUsage
GEN_DISKFILE="$WWW_FOLDER/diskusage.html"

# Reset Shoutbox on Startup?
RESET_CHAT="yes"

#Inititiation Chat-Message
CHATMSG="<div class='message'><date>00:00:00</date> <name>PirateBox:</name> <data class='def'>Chat and share files anonymously!</data></div>"

#Activate Global chat
# Still experimentall!
GLOBAL_CHAT="no"

#On which broadcast address should it send
# Take care on the syntax!!
GLOBAL_DEST="[ #255.255.255.255# , #10.255.255.255# , #$NET.255# ]"

#------------------------ Additional configuration for lighttpd
LIGHTTPD_USER=nobody
LIGHTTPD_GROUP=nogroup


#------------------------ Hook in user-config
. $PIRATEBOX_FOLDER/conf/hook_custom.conf
In case it might help with a diagnosis, I plugged in the wifi adaptor into the RPi2 and it works out of the box. So I am assuming the problem lies in changing which wlanx is active?
Re: RPi3 and using a USB wifi adaptor
May 29, 2016 07:53AM
I'm sorry for the late response.
I wonder what is wrong, because the configuration itself looks quite ok.

My guess is, that the wifi-chip detection does not work and you may run the wrong hostap version.

I need to contact stylesuxx, he may have an idea about that.


This is only my signature.
Re: RPi3 and using a USB wifi adaptor
May 29, 2016 09:58AM
Interesting.
Can you please try running:
/opt/piratebox/rpi/bin/wifi_detect.sh
and post the output.
Is hostapd running after you boot up the PI?
For some reason, my hostapd.conf file is auto generating during boot. So, even if I modify it, during boot, it is back to the original hostapd.conf file. How do I fix this?
Re: RPi3 and using a USB wifi adaptor
February 01, 2018 03:57AM
hostap.conf is not generated and is a static file.
If you change it, how do you perform a reboot? A normal command „reboot“ or „shutdown -r now“, or do you just power the device off and on?

An unconditional reboot without a proper shutdown can causes data loss and issues like this.

Best regards Matthias
Re: RPi3 and using a USB wifi adaptor
February 01, 2018 09:05AM
Putting "wlan1" into the /boot/wifi_card.conf file in place of "wlan0" appears to have fixed the problem of the /opt/piratebox/conf/hostapd.conf file being overwritten. It may still be being overwritten, but if so, it's being overwritten with "wlan1", which solves the problem that was preventing my 7inova 7U300A USB wifi adapter (RT5372 chip) from working. So that's another wifi adapter that works with the PirateBox on the Raspberry Pi 3.
Re: RPi3 and using a USB wifi adaptor
February 01, 2018 05:13PM
Ooooohh ....
Sorry, I forgot about that mechanism, which is RPi specific. It replaces only the name of the WiFi interface in the hostap config file.

Good catch, sorry for the wrong information

Best regards Matthias
Re: RPi3 and using a USB wifi adaptor
March 26, 2018 01:30AM
Resuming work here!

TP-LINK TL-WN7200ND works great!

Cheers from Argentina

Marcelo