Skip to content

RaspberryPi wifi AP mode setup

Michael Pounders edited this page May 19, 2020 · 3 revisions

I am working from this setup guide

Before you start

Run:

pi@RCHourGlass:~ $ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
  • Make sure your LAN IP does not start with 192.168.4 If it does you will have to change the IP address that start with 192.168.4 to 192.168.1 in the static wlan section and the /etc/dnsmasq.conf file.
  • Your LAN IP address could also start with 10. or 172.16. no need to change anything below

Update RPI

sudo apt update
sudo apt full-upgrade

Install WIFI AP software

sudo apt install hostapd

Enable WIFI AP software

sudo systemctl unmask hostapd
sudo systemctl enable hostapd

Install (DNS/DHCP) software for the wireless clients

sudo apt install dnsmasq

Set wlan0 to use a static IP

sudo nano /etc/dhcpcd.conf

Go to the end of the file and add the following then save it:

interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant

Configure the DHCP and DNS services for the wireless network

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf

Add the following to the file and save it:

interface=wlan0 # Listening interface
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
                # Pool of IP addresses served via DHCP
domain=wlan     # Local wireless DNS domain
address=/gw.wlan/192.168.4.1
                # Alias for this router

Configure the AP software

sudo nano /etc/hostapd/hostapd.conf

Add the following to the file and save it:

country_code=US
interface=wlan0
ssid=RCHourGlass
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=raspberry
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Notes:

  • Please use the right country_code for your area. Country Codes
  • RCHourGlass should show up in your phone as a connectable AP when done.
  • The password will be raspberry unless you change it.

Reboot and see if you can access the RPI AP

sudo systemctl reboot