This turns your Raspberry Pi into an access point for wireless devices. This guide will make your Raspberry Pi 3B share its cabled Ethernet connection wirelessly as an access point with a new SSID.
Forked and edited from this guide: https://www.raspberrypi.org/documentation/configuration/wireless/access-point-bridged.md
Works on Raspberry Pi 3 model B.
First step is to set wifi location to your location with sudo raspi-config
under I4:
Localisation options -> Change WLAN Country
Install necessary packages:
$ sudo apt-get install -y bridge-utils hostapd
Uncomment #net.ipv4.ip_forward=1
in /etc/sysctl.conf
. This enables ip_forward in the kernel, which is necessary to make a bridge.
sudo nano /etc/sysctl.conf
#net.ipv4.ip_forward=1
-> net.ipv4.ip_forward=1
Configure the network settings to create a bridge with eth0
in /etc/network/interfaces
:
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
auto br0
iface br0 inet dhcp
bridge_ports eth0
Configure access point by editing the file /etc/hostapd/hostapd.conf
:
sudo nano /etc/hostapd/hostapd.conf
country_code=XX
interface=wlan0
driver=nl80211
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
ssid=<SSID_HERE>
wpa_passphrase=<PASSWORD_HERE>
bridge=br0
Where the XX
value of country_code
is your ISO 3166-1 alpha-2 (2-character) country code. (Think US
, GB
, DE
etc.).
Change desired SSID and password of your soon-to-be AP after ssid=<SSID_HERE>
and wpa_passphrase=<PASSWORD_HERE>
, without the < >
.
Tell hostapd to use the config set above. Edit /etc/default/hostapd
and set:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Get hostapd to work. Enter these commands consecutively:
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
Unblock wifi:
rfkill unblock all
Reboot:
sudo reboot
That should do it :)