Check WLAN drivers
Check that your Pi sees your USB WiFi dongle
lsusb
If it is a Realtek chipset RTL8192EU, you will see something like:
Bus 001 Device 004: ID 0bda:818b Realtek Semiconductor Corp.
the 818b indicates the RTL8192EU chipset.
Unfortunately this chipset is currently not ‘officially’ supported by Rasbian, but MrEngman over at raspberrypi.org maintains a good library of drivers (https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=127214).
First be sure of the kernel version you are running:
uname -a
resulted, for me in,
4.4.13-v7+ #894
So i grabbed the driver and installed it with:
wget https://dl.dropboxusercontent.com/u/80256631/8192eu-4.4.13-v7-894.tar.gz tar xzf 8192eu-4.4.13-v7-894.tar.gz sudo ./install.sh
sudo apt-get install hostapd
Set up wlan0 for static IP
If you happen to have wlan0 active because you set it up, run
sudo ifdown wlan0
Next we will set up the wlan0 connection to be static and incoming. run
sudo vi /etc/network/interfaces to edit the file
Find the line auto wlan0 and add a # in front of the line, and in front of every line afterwards. If you don’t have that line, just make sure it looks like the screenshot below in the end! Basically just remove any old wlan0 configuration settings, we’ll be changing them up
Depending on your existing setup/distribution there might be more or less text and it may vary a little bit
Add the lines
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.77.254
netmask 255.255.255.0
network 192.168.77.0
broadcast 192.168.77.255
#gateway 192.168.77.254
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
Any other lines afterwards should have a # in front to disable them.
After that, re-enable the wlan0 interface and check if you have your IP set it up on interface
sudo ifup wlan0
sudo ifconfig wlan0 pi@nissanpi:~ $ ifconfig wlan0 wlan0 Link encap:Ethernet HWaddr e8:4e:06:13:f2:a9 inet addr:172.16.77.254 Bcast:172.16.77.255 Mask:255.255.255.0 inet6 addr: fe80::c318:331c:4663:3977/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4311 errors:0 dropped:0 overruns:0 frame:0 TX packets:8497 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:369129 (360.4 KiB) TX bytes:9830120 (9.3 MiB) pi@nissanpi:~ $
Configure Access Point
Now we can configure the access point details. We will set up a password-protected network so only people with the password can connect.
Create a new file by running
sudo vi /etc/hostapd/hostapd.conf
Paste the following in, you can change the text after ssid= to another name, that will be the network broadcast name. The password can be changed with the text after wpa_passphrase=
-
# This is the name of the WiFi interface we configured above interface=wlan0 # Use the nl80211 driver with the brcmfmac driver driver=nl80211 # This is the name of the network ssid=Pi3-AP # Use the 2.4GHz band hw_mode=g # Use channel 6 channel=6 # Enable 802.11n ieee80211n=1 # Enable WMM wmm_enabled=1 # Enable 40MHz channels with 20ns guard interval ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] # Accept all MAC addresses macaddr_acl=0 # Use WPA authentication auth_algs=1 # Require clients to know the network name ignore_broadcast_ssid=0 # Use WPA2 wpa=2 # Use a pre-shared key wpa_key_mgmt=WPA-PSK # The network passphrase wpa_passphrase=raspberry # Use AES, instead of TKIP rsn_pairwise=CCMP
pi@nissanpi:~ $ sudo lsusb Bus 001 Device 006: ID 05ac:0256 Apple, Inc. Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10/100 Adapter / SMSC9512/9514 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub pi@nissanpi:~ $
sudo vi /etc/default/hostapd
Find the line
Don’t forget to remove the # in front to activate it!Then save the file
Finally we can test the access point host! Run
sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
To manually run hostapd with our configuration file. You should see it set up and use wlan0 then you can check with another wifi computer that you see your SSID show up. If so, you have successfully set up the access point.
Raspberry
if you copied our hostapd config), debug text will display on the Pi console but you won’t be able to connect through to the Ethernet connection yet.Cancel the test by typing Control-C in the Pi console to get back to the Pi command line
Finishing up!
OK now that we know it works, time to set it up as a ‘daemon’ – a program that will start when the Pi boots.
Run the following command
sudo service hostapd start
you can always check the status of the host AP server with
sudo service hostapd status
To start the daemon services. Verify that they start successfully (no ‘failure’ or ‘errors’)
Then to make it so it runs every time on boot
sudo update-rc.d hostapd enable