-
Notifications
You must be signed in to change notification settings - Fork 162
RPi as access point
Klaus edited this page Oct 13, 2019
·
1 revision
sudo apt install dnsmasq hostapdEdit /etc/dhcpcd.conf
sudo nano /etc/dhcpcd.confAdd to the end of the file
interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicantrestart dhcpcd
sudo systemctl restart dhcpcdsudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.confAdd the following
interface=wlan0 # Use the require wireless interface - usually wlan0
dhcp-range=192.168.4.2,192.168.4.200,255.255.255.0,24hReload dnsmasq
sudo systemctl reload dnsmasqsudo nano /etc/hostapd/hostapd.confAdd the following
interface=wlan0
driver=nl80211
ssid=photobooth
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=photobooth
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMPMake sure config gets loaded
sudo nano /etc/default/hostapdUncommend and update DAEMON_CONF
DAEMON_CONF="/etc/hostapd/hostapd.conf"Now enable and start hostapd
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapdEdit /etc/sysctl.conf
sudo nano /etc/sysctl.confand uncomment this line:
net.ipv4.ip_forward=1Reboot once
sudo rebootAdd a masquerade for outbound traffic on eth0:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADESave the iptables rule.
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"Edit /etc/rc.local
sudo nano /etc/rc.localand add this just above "exit 0" to install these rules on boot.
iptables-restore < /etc/iptables.ipv4.natSource: https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md