Using OcPoc as a WAP

Instructions for configuring your OcPoc to function as a Wireless Access Point

Before completing the following steps, please go through two other tutorials, Connecting OcPoc to WiFi and Connecting over SSH.

This first step requires the OcPoc to be connected to the internet because you need to download new packages. From the OcPoc shell, execute:

apt-get update
apt-get upgrade
apt-get install hostapd udhcpd

If there are any errors or failures, please resolve those before continuing.

Now, create the file /etc/hostapd/hostapd.conf

nano /etc/hostapd/hostapd.conf

and edit it to contain the following

interface=wlan0
ssid=ocpoctest
channel=1
wmm_enabled=0
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=aerotenna
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0

To save and close the file in nano do:

Ctrl + x
y
'Enter'

In the same manner, open and edit the file /etc/network/interfaces. You should already have a file that will let you access the internet. Instead of deleting these lines, just comment them out (using '#' at the beginning of the line). This will allow you to go back and forth between using the OcPoc to access the internet or act as a WAP simply by editing this file.
The file should look like this:

auto lo
iface lo inet loopback

# primary network interface
#auto eth0
iface eth0 inet dhcp

## wireless network interface, uncomment next 4 lines for internet access
#allow-hotplug wlan0
#iface wlan0 inet dhcp
#   wpa-ssid "network-name-here"
#   wpa-psk  "network-password-here"

##uncomment next 4 lines for WAP
auto wlan0
iface wlan0 inet static
address 192.168.23.1
netmask 255.255.255.0

Now open and edit the file /etc/udhcpd.conf
The default file will have many lines that are commented out and meant to show possible configuration settings. You can delete all of these or keep them commented, but the only lines that should be uncommented are the following:

start 192.168.23.2 #range of IPs that the hostspot will give to client devices.
end 192.168.23.20
interface wlan0 # The device uDHCP listens on.
remaining yes
opt domain local
opt subnet 255.255.255.0
opt router 192.168.23.1 # The Pi's IP address on wlan0 which we have set up.
opt lease 864000 # 10 day DHCP lease time in seconds

Next edit the file /etc/default/udhcpd to comment out the line:

#DHCPD_ENABLED="no"

Finally, edit the file /etc/default/hostapd to uncomment and change the line:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Now reboot the OcPoc and use the command 'ifconfig' to check that it is hosting a network at the router address you set for it. You can use a phone or another computer to test the connection.