Table of Contents

Wireless Access Point With a Raspberry Pi 3

Introduction

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 thing, only this way I get to patch stuff a lot more easily.

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.

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.

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:

Adapter detection

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.

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:

# ifconfig wlan1 up

This should result in the blue LED coming on.

# ifconfig wlan1 down

This should result in the blue LED going off again. If this happens, it seems your adapter is being recognised.

While you're here, have a quick scan to see which channels might be in use:

# iwlist wlan1 scanning | grep Channel

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

We will configure the AP to get it's own IP address on the ethernet side. Edit /etc/rc.d/rc.inet1.conf. Comment out the section with your eth0 network config, it probably looks a bit like this (it may use a static IP address instead):

This sets up a bridge, with eth0 attached to it, and tells Slackware to give the new br0 interface an IP address via DHCP. Reboot after you've done that and check that your ethernet networking is still in working order.

Hostapd Install

The only AP software for Linux that I'm aware of is hostapd. Get it from Slackbuilds and build it directly on your Pi (you did install the 'D' disk set didn't you?)

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:

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.

Finally, you just need to start hostapd, either by adding /etc/rc.d/rc.hostapd to /etc/rc.d/rc.local or adding an extra entry to /etc/rc.d/rc.inet2 (my preference)

if [ -x /etc/rc.d/rc.hostapd ]; then
/etc/rc.d/rc.hostapd start
fi

Don't forget to:

# chmod 755 /etc/rc.d/rc.hostapd

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. Your desktop will be able to ping your mobile and so on.