A reminder on how to configure a Raspberry Pi 3 (Debian Jessie) as a Wi-Fi Access Point
Instructions for the macOS platform, little trick to find the raspberry pi ip-address while connected through ethernet.
Connect the Raspberry Pi with an ethernet cable
$ ifconfig
Then look for the bridge100
interface, and get the inet ipaddress (for me 192.168.2.1
).
You can use nmap to scan for all ips and guess the raspberry pi one.
$ brew install nmap
$ nmap -n -sP 192.168.2.1/24
$ ssh pi@<ip-address>
pi@raspberrypi:~ $ sudo apt-get install hostapd dnsmasq
Configure a static ip profile for the wlan0
interface. In Debian Jessie, it's done in the /etc/dhcpcd.conf
configuration file.
pi@raspberrypi:~ $ cat <<EOT >> /etc/dhcpcd.conf
# define static profile
interface wlan0
static ip_address=192.168.1.23/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
EOT
Configure the Dnsmasq service on the wlan0 interface
pi@raspberrypi:~ $ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
pi@raspberrypi:~ $ sudo touch /etc/dnsmasq.conf
pi@raspberrypi:~ $ sudo tee <<EOT /etc/dnsmasq.conf >/dev/null
interface=wlan0
domain-needed
bogus-priv
dhcp-range=192.168.1.24,192.168.1.250,12h
EOT
pi@raspberrypi:~ $ sudo tee <<EOT /etc/hostadp/hostadp.conf >/dev/null
# Interface Settings
interface=wlan0
driver=nl80211
# Wifi AP Settings
ssid=BlackHat
wpa_passphrase=DontTryMe
hw_mode=g
channel=6
ieee80211n=1
# Encryption Settings
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# Accept all MAC addresses
macaddr_acl=0
# Require clients to know the network name
#ignore_broadcast_ssid=0
# Enable WMM (QoS)
wmm_enabled=0
EOT
pi@raspberrypi:~ $ sudo touch /etc/sysctl.d/50-hostapd.conf
pi@raspberrypi:~ $ sudo tee <<EOT /etc/sysctl.d/50-hostapd.conf >/dev/null
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
EOT
For an unknown reason (yet), restarting the services is not enough, you should reboot your Raspberry Pi in order to make it work with our new configuration.
pi@raspberrypi:~ $ sudo reboot
Then once it's up and running, you need to check if all services are loaded and running too.
pi@raspberrypi:~ $ sudo systemctl status dhcpcd.service
pi@raspberrypi:~ $ sudo systemctl status dnsmasq.service
pi@raspberrypi:~ $ sudo systemctl status hostapd.service
Hi,
Maybe you need to apply the sysctl settings (sysctl -p filename), see https://superuser.com/a/625852