Let's say you're out in the field with a couple of fellow agents and you want to quickly put up a network for your computers, maybe even share an Internet connection together; your Pi equipped with a Wi-Fi dongle (or with just a Pi 3 with the built-in Wi-Fi) can easily be made into a makeshift access point.
Before setting up your wireless hotspot, ensure you have set up a static IP on your Pi, as per the previous section, then follow these steps to set up your hotspot:
pi@raspberrypi ~ $ sudo apt-get install hostapd bridge-
utils
/etc/network/interfaces
for editing:pi@raspberrypi ~ $ sudo nano /etc/network/interfaces
#
character in front of each line, like we've done here:#allow-hotplug wlan0 #iface wlan0 inet manual #wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf #iface default inet dhcp
auto br0 iface br0 inet dhcp bridge_ports eth0 wlan0
nano
, then reboot your Pi.hostapd
. In nano
, open/create the configuration file:pi@raspberrypi ~ $ sudo nano /etc/hostapd/hostapd.conf
interface=wlan0 bridge=br0 driver=nl80211 country_code=UK ssid=AGENT-PI hw_mode=g channel=6 auth_algs=1 wpa=2 wpa_passphrase=SecretAgent wpa_key_mgmt=WPA-PSK #Wireless N Settings ieee80211n=1 wmm_enabled=1
interface=wlan0
: This is the wireless interface you are using for the access point.bridge=br0
: Allows hostapd
to share the wired Internet connection by creating a bridge between the Ethernet and Wi-Fi interfaces. You can comment this out if you didn't create the bridge earlier.ssid
: Change this line to choose a name for your access point.auth_algs=1
: Supports WPA2 encryption that we're going to enable on our network.wpa=2
: Enable WPA2 encryption.wpa_passphrase
: The password (8 characters minimum) required to join your Wi-Fi network:
pi@raspberrypi ~ $ sudo hostapd -d
/etc/hostapd/hostapd.conf
hostapd
.
Attention Edimax EW-7811Un Wi-Fi dongle users
This popular tiny USB dongle, and possibly others like it based on the Realtek RTL8188CUS chipset, needs a special version of hostapd to work. Simply download and replace your installed hostapd binary using the following command:
pi@raspberrypi ~ $ sudo wget http://files.raspiplace.com/hostapd-rt -O /usr/sbin/hostapd
hostapd
automatically in the background on boot, we need to make a slight adjustment to a configuration file:pi@raspberrypi ~ $ sudo nano /etc/default/hostapd
DAEMON_CONF=""
and change it to point to your hostapd
configuration file:DAEMON_CONF="/etc/hostapd/hostapd.conf"
Then save and exit nano
. Your Pi will now become an access point on boot.
3.142.42.176