Posted on

BananaPro WiFi Access Point

The BananaPro has built-in WiFi which you can use as a WiFi Client or as a WiFi Access Point. Having spent a lot of time working with Raspberry Pi systems that operate as access points, I thought I would try to do the same with the BananaPro. I faced similar challenges with the compatibility between the wifi driver and the hostapd application when using the Bananian operating system as I had with the Raspberry Pi with the Raspbian O/S. The good news is that after a number of attempts, I was able to make the BananaPro work as an Access Point with repeatable success.

The information I was able to find on the Internet was always incomplete and left me with a system that would not run as expected. I tried a number of suggestions and got very close. Either the BananaPro would not load the hostapd module at boot time, or I could see the ESSID and not connect with the proper password. Then I remembered the guidance from Dave Conroy. He compiled hostapd from source, backed up the binary hostapd, and linked the new hostapd application to the /usr/sbin/ folder where the binary normally installs. That little linking trick saved my bacon from even more hours of tearing out my hair.

The following are the steps I took to create a working BananaPro Wireless Access Point with the built-in Wifi adapter and the hostapd module.

The Hardware

My B-Pro came with an external antenna, which you must use to have any chance of any WiFi client connecting. It is a very small and fragile connector. I purchased a BananaPro Kit from Eleduino that included a simple plastic case, and I had to enlarge the slot for the antenna to pass through so I could connect it without feeding the connector through the side panel of the case. I also used a 5v 2A power supply to ensure there is plenty of power available for all the goodies on this board.

Setting up the SD Card with the Bananian O/S

Start by downloading the latest version of Bananian (which was January 11, 2015). I selected an 8GB micro SD card, formatted it and used Win32DiskImager to write the Bananian distro to the card. Install the SD card in the BananaPro, connect a monitor and keyboard, and power it up.

At the prompt log in as “root” with the password “pi”. Next, run the bananian-config script and set up the unit to your liking – but be sure to set the hardware configuration to “BananaPro”. This activates the WiFi hardware. Reboot the BananaPro to activate the changes you just made.

After logging in again, I ran the bananian-update script to see if there were any updates to the distro – and at the time of this writing there were none.

Load the WiFi Driver

Run the following command to load the WiFi driver at boot time.

root@bananapi ~ # nano /etc/modules
# add the wifi driver
ap6210 op_mode=2

Compiling and Installing hostapd

Since this distro is highly minimized you can’t compile applications without first installing a LOT of modules. So the first step is to install the modules needed to compile hostapd. Install all of the development tools required to compile hostapd.

apt-get install git build-essential u-boot-tools uboot-mkimage libusb-1.0-0-dev libncurses5-dev gcc libc6-dev libssl-dev libnl-dev make hostapd

I rebooted after installing this many modules, just to be sure there we no issues with the installations, and that all the modules would function after a reboot (trust issues, yeah).
Take the following steps to download and compile the source for hostapd:

git clone git://
cd hostap/hostapd
cp defconfig .config
cp hostapd /usr/local/sbin
cp hostapd_cli /usr/local/sbin
cp /usr/sbin/hostapd /usr/sbin/hostapd.old 
rm /usr/sbin/hostapd 
ln -s /usr/local/sbin/hostapd /usr/sbin/hostapd

hostapd requires a configuration file that you must create. Edit the /etc/hostapd/hostapd.conf file and paste in these contents. Change the SSID and the wpa-passphrase values to what you prefer.


For the hostapd module to use this configuration, edit the /etc/default/hostapd file and change the configuration of the DAEMON_CONF value to the following:


Lastly, you must edit your /etc/network/interfaces file to include these settings for your new WiFi interface. You can use a different network subnet if you wish.

allow-hotplug wlan0
iface wlan0 inet static

Installing the DHCP Server

I used isc-dhcp-server in my build. Install the server as follows:

apt-get install isc-dhcp-server

When it installs, you will see the startup fail, and thats ok because we have a couple things to add before it will work. First, edit the /etc/default/isc-dhcp-server file to add the “wlan0” interface:


Next, you need to add the subnet to the /etc/dhcp/dhcpd.conf so your WiFi clients will get an IP address.

shared-network banana {
  subnet netmask {
    option routers;
    option domain-name-servers,;

After rebooting you should have a working system that will broadcast a WiFi ESSID, and you should be able to connect a WiFi client and get an IP address.

Adding Internet Access

While your WiFi users can connect to your BananaPro, they can’t do much else except to run apps on the BananaPro. Assuming you have your eth0 port connected to a network that has internet access, you can give them access to the Internet. All it requires is enabling IPv4 forwarding to allow traffic to pass between the eth0 and wlan0 ports.

echo 1 > /proc/sys/net/ipv4/ip_forward

To make this permanent, edit the /etc/sysctl file and un-comment the line:

net.ipv4.ip_forward = 1

Next, set a NAT rule to translate the IP addresses of your WiFi users to the IP address of the eth0 ports IP address

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

This will let traffic pass through the BananaPro, but you should also set up some firewall rules. Here is the bare minimum you should use:

iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

This should get your BananaPro up and running as a WiFi access point and Internet gateway. To make sure your BananaPro iptable rules survive a reboot, save iptables rules to a file and reload them at boot time:

iptables-save > /etc/iptables.up.rules

Place this command at the end of the /etc/network/interfaces file to reinstate your firewall rules after the interfaces are established.

pre-up iptables-restore < /etc/iptables.up.rules