Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
howtos:hardware:arm:raspberrypi3_wap [2018/08/26 20:35 (UTC)]
bifferos [Hardware Requirements]
howtos:hardware:arm:raspberrypi3_wap [2018/08/28 20:08 (UTC)] (current)
bifferos [Introduction]
Line 3: Line 3:
 ===== Introduction ===== ===== Introduction =====
  
-Wary of the latest vulnerabilities in WPA? Got an ageing Wifi router that you'd like to bring a bit more up-to-date? Don't trust your ISP-supplied router to meet your Wifi requirements? ​ Or you just want to run on your AP the same software as you run on your desktop? +This HOWTO shows you how to replace the WiFi element of your home network setup with a Raspberry Pi running Slackware. ​ Other HOWTOs explain how to setup DHCP and so on for your wireless devices, but this tries to keep things really simple and just give you an ethernet->​Wifi bridge. ​ This is very close to the config I ended up with when I configured a TP-LINK ADSL router to do the same thingonly this way I get to patch stuff a lot more easily.
- +
-This HOWTO shows you how to replace the Wifi on your cable modem, ADSL or other router ​with a Raspberry Pi running Slackware. ​ Other HOWTOs explain how to setup DHCP and so on for your wireless devices, but I've assumed ​you'll keep your network topology exactly ​the same as it was beforebut simply disable the Wifi element of your router ​to give more control.+
  
 +Although I've originally written this HOWTO for a RPi 3, I've since tried it on an RPi2 and it works just as well.  Interface wlan1 will obviously change to wlan0 because the Pi2 has no on-board WiFi however.
 ===== Hardware Requirements ===== ===== Hardware Requirements =====
  
   * A Raspberry Pi 3 running Slackware 14.2   * A Raspberry Pi 3 running Slackware 14.2
-  * A powered USB hub with 2A Power supply (to ensure the Wifi Dongle ​gets enough juice)+  * A powered USB hub with 2A Power supply (to ensure the Wifi adapter ​gets enough juice)
   * Alfa Network AWUS036NHA - USB WiFi Adapter with chipset ar9271l   * Alfa Network AWUS036NHA - USB WiFi Adapter with chipset ar9271l
-  * Ethernet cable connected to the internet+  * Ethernet cable
  
 The powered Hub was purchased from the_pi_hut (http://​www.ebaystores.co.uk/​thepihut),​ although pretty much any decent powered hub should be OK.  The pi_hut one claimed to have the feature that it didn't push power up the USB connection to the Pi, which sounded like it may be useful. The powered Hub was purchased from the_pi_hut (http://​www.ebaystores.co.uk/​thepihut),​ although pretty much any decent powered hub should be OK.  The pi_hut one claimed to have the feature that it didn't push power up the USB connection to the Pi, which sounded like it may be useful.
  
-{{ howtos:​hardware:​arm:​hub.jpg }}+{{ howtos:​hardware:​arm:​hub.jpg?400 }} 
 + 
 +Whatever you get, Make sure it has a beefy power supply, e.g. 2A.  USB WiFi dongles, particularly the ones with external antennas can be thirsty and a 2A power adapter is unlikely to cost much more than a 1A one.
  
-{{ howtos:​hardware:​arm:​power.jpg }}+{{ howtos:​hardware:​arm:​power.jpg?300 }}
  
 The Wifi Adapter choice is important. ​ I did some research and went for the model that I believed would give maximum flexibility and compatibility with Linux. ​ The Alpha Network one seemed to do that.  It works with Kali (assuring Linux compatibility),​ but that is by no means the only thing you should look for.  You also want to see the output of: The Wifi Adapter choice is important. ​ I did some research and went for the model that I believed would give maximum flexibility and compatibility with Linux. ​ The Alpha Network one seemed to do that.  It works with Kali (assuring Linux compatibility),​ but that is by no means the only thing you should look for.  You also want to see the output of:
Line 37: Line 38:
  * outside context of a BSS</​code>​  * outside context of a BSS</​code>​
  
-Obviously the '​AP'​ bit is the bit we need, however considering that the built-in RPi3 Wifi adapter also had thatand never really worked satisfactorily it's just one of many things ​to look for.+Obviously the '​AP'​ bit is the bit we need, but IMHO the more things appearing ​in this listthe more likely your adapter is to be well tested and widely used.
  
 My adapter was purchased from Amazon: https://​www.amazon.co.uk/​dp/​B004Y6MIXS,​ however I am not connected with this seller. ​ The adapter looks like this: My adapter was purchased from Amazon: https://​www.amazon.co.uk/​dp/​B004Y6MIXS,​ however I am not connected with this seller. ​ The adapter looks like this:
  
-{{ howtos:​hardware:​arm:​alpha.jpg }}+{{ howtos:​hardware:​arm:​alpha.jpg?400 }}
  
 ===== Adapter detection ===== ===== Adapter detection =====
 +
 +<​note>​
 +I advise to not connect and disconnect the hub from the Pi while it's running. ​ Instead, power it up with hub connected (and powered) and then connect and disconnect the Wifi adapter as needed.
 +</​note>​
  
 Ensure that iwconfig shows two adapters wlan0 and wlan1. ​ wlan0 is the built-in one on the Pi.  If dmesg isn't showing the Alpha one has been plugged in, then just un-plug it and plug it in again. ​ Bring the Adapter up with: Ensure that iwconfig shows two adapters wlan0 and wlan1. ​ wlan0 is the built-in one on the Pi.  If dmesg isn't showing the Alpha one has been plugged in, then just un-plug it and plug it in again. ​ Bring the Adapter up with:
Line 59: Line 64:
 <​code>#​ iwlist wlan1 scanning | grep Channel</​code>​ <​code>#​ iwlist wlan1 scanning | grep Channel</​code>​
  
-This will indicate the channels that you **don'​t** want to use.  You can automatically select channels ​but this guide will not cover that.+This will indicate the channels that you **don'​t** want to use.  You can configure automatic channel selection ​but this guide will not cover that.
  
 ===== Bridge Configuration ===== ===== Bridge Configuration =====
Line 77: Line 82:
 <​code>#​ Example of how to configure a bridge:</​code>​ <​code>#​ Example of how to configure a bridge:</​code>​
  
-Ensure the following appears so a bridge will be created:+Ensure the following appears so a bridge will be created ​(adjust DHCP_HOSTNAME to suit):
  
 <​code>​IFNAME[0]="​br0"​ <​code>​IFNAME[0]="​br0"​
Line 99: Line 104:
 # installpkg /​tmp/​hostapd-2.6-arm-2_SBo.tgz</​code>​ # installpkg /​tmp/​hostapd-2.6-arm-2_SBo.tgz</​code>​
  
-Next you need to edit /​etc/​hostapd/​hostapd.conf to set stuff up.  ​You can backup what's there to another file, just make it look something like the following:+Next you need to edit /​etc/​hostapd/​hostapd.conf to set stuff up.  ​Backup the contents of hostapd.conf ​to another file as it contains useful comments, but replace ​the contents completely so it contains only this:
  
 <​code>​interface=wlan1 <​code>​interface=wlan1
Line 113: Line 118:
 auth_algs=1</​code>​ auth_algs=1</​code>​
  
-What this does:  The interface wlan1, we've seen before. ​ The bridge br0 will get wlan1 interface added to it when hostapd has fired up.  The syslog logging lines ensure you get something in /​var/​log/​messages to tell you what's going on.  The ssid, wpa and wpa_passphrase settings should be rather obvious, the hw_mode you can just leave as '​g'​ unless you know what you're doing, channel is set to something you didn't see when you ran '​iwlist wlan1 scanning'​ earlier on.+What this does:  The interface wlan1, we've seen before. ​ The bridge br0 will get wlan1 interface added to it when hostapd has fired up.  The syslog logging lines ensure you get something in /​var/​log/​messages to tell you what's going on.  The ssid, wpa and wpa_passphrase settings should be rather obvious, the hw_mode you can just leave as '​g'​ unless you know what you're doing, channel is set to something you didn't see when you ran ''​iwlist wlan1 scanning'' earlier on.
  
 That minimal config should get hostapd working fine, at least it did for me. That minimal config should get hostapd working fine, at least it did for me.
Line 127: Line 132:
 <​code>#​ chmod 755 /​etc/​rc.d/​rc.hostapd</​code>​ <​code>#​ chmod 755 /​etc/​rc.d/​rc.hostapd</​code>​
  
 +===== QR Codes =====
 +
 +{{ howtos:​hardware:​arm:​hostapd.png?​100 }}
 +
 +No home WiFi network setup is complete without a QR code that you can wave at all your mates when they are round your house wanting to connect. ​ You can create one of these from your WiFi settings using the **qrencode** program, available from [[https://​slackbuilds.org/​repository/​14.2/​graphics/​qrencode/​|Slackbuilds]],​ or alternatively,​ get the build from [[http://​www.slackware.com/​~alien/​slackbuilds/​qrencode/​build/​|Alien Bob]] for a slightly later version.
 +
 +Type the following to create a PNG file with the code, which you can print, copy to your mobile, put on a local webpage or whatever.
 +
 +<​code>#​ qrencode -t PNG -o wifi-setup.png "​WIFI:​S:​MYSSID;​T:​WPA2;​P:​MYPASSWD;​H:​true;"</​code>​
 +
 +The above assumes WPA2, MYSSID should be replaced with your SSID, MYPASSWD replaced with your password. ​ For my Android phone I installed a piece of software from the Play store called [[https://​play.google.com/​store/​apps/​details?​id=com.google.zxing.client.android|Barcode Scanner]] by the [[https://​play.google.com/​store/​apps/​developer?​id=ZXing+Team|ZXing Team]]. ​ It works very well for reading these codes.
 +
 +At a pinch, the following bash script should pull your SSID and passphrase out of the hostapd.conf file, and automatically use them to create a new QR code, so you can quickly keep it up to date after any changes.
 +
 +<​code>#​!/​bin/​sh
 +
 +SSID=$(cat /​etc/​hostapd/​hostapd.conf | grep ^ssid= | cut -d= -f2)
 +PASS=$(cat /​etc/​hostapd/​hostapd.conf | grep ^wpa_passphrase= | cut -d= -f2)
 +
 +qrencode -t PNG -o hostapd.png "​WIFI:​S:​$SSID;​T:​WPA2;​P:​$PASS;​H:​true;"</​code>​
 +
 + 
 ===== Conclusion ===== ===== Conclusion =====
  
-That's it!  You should now be able connect to this AP, and (assuming you are running a DHCP server on your ethernet) it will serve your wireless devices, and everything will be able to talk to everything else.  ​You desktop will be able to ping your mobile and so on.+That's it!  You should now be able connect to this AP, and (assuming you are running a DHCP server on your ethernet) it will serve your wireless devices, and everything will be able to talk to everything else.  ​Your desktop will be able to ping your mobile and so on.
  
 ====== Sources ====== ====== Sources ======

In Other Languages
QR Code
QR Code howtos:hardware:arm:raspberrypi3_wap (generated for current page)