RPI3 has build-in WiFi, RPI2 can be easily extended with WiFi adapter. Such adapter can be configured to connect to access point or act as access point itself.
There is the good instruction on the Raspberry Pi website on how to create access point. Just in case it would not work, there is an extended version with troubleshooting.
Before configuring the device, make sure that you have latest software and packages:
$ sudo apt-get update $ sudo apt-get dist-upgrade
Install required software packages:
- dnsmasq - package that provides DHCP server and DNS cache
- hostapd - authenticates wireless clients
$ sudo apt-get install dnsmasq hostapd
The packages are started automatically, but as they are not configured yet, it is better to turn them off:
sudo systemctl stop dnsmasq sudo systemctl stop hostapd
The wireless interface is need to be configured. By convention, there are a few networks devoted to private use, among them 192.168.x.x. In fixed networks, where the assumption can be made about the network structure, the network addresses can be specified statically. For that make sure that corresponding wlan interface settings are configured in the file
allow-hotplug wlan1 iface wlan1 inet static metric 100 address 192.168.5.1 netmask 255.255.255.0 network 192.168.5.0
wlan1 is the wireless interface (second adapter) I would like to connect. In case of only one adapter installed, the interface name is
192.168.5.1 is the address and
192.168.5.0/255.255.255.0 defines the address space of the network.
Now rename the existing dnsmasq configuration:
$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
and create the new one that specifies the interface and the IP address range:
Normally, DHCP client gets the settings and reconfigures the interface IP address and other properties. This is need to be avoided (as DHCP serviec will be provided by the interface itself) by adding to the file
Preparation is done so now the access point itself can be configured. For this create the file
/etc/hostapd/hostapd.conf with the following configuration settings:
interface=wlan0 ssid=VISIBLE_ACCESS_POINT_NAME_CHANGE_PLS hw_mode=g channel=7 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=SECTRET_PASSWORD_CHANGE_PLS wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Set the option DAEMON_CONF in the file
/etc/default/hostapd. Uncomment it if necessary. Strangely enough, it does not with quoted path, as set in the official guide.
Now start the services:
$ sudo service hostapd start $ sudo service dnsmasq start
The access point should appear in the list of available WiFi networks and connecting to it with the specified password should be successful.
SETTING UP A RASPBERRY PI AS AN ACCESS POINT IN A STANDALONE NETWORK, https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md ↩︎
IPV4 PRIVATE ADDRESS SPACE AND FILTERING, https://www.arin.net/knowledge/address_filters.html ↩︎