BananaPro/Pi:WiFi configuration

From BananaPro/Pi
Jump to: navigation, search

On Banana Pro, there is onboard AP6181 WiFi module, you can use it directly. On Banana Pi, you need use a USB wifi dongle instead.


The Banana Pi's portability is an incredible asset to the tiny Soc,allowing people tp put it anywhere around the house,or indeed in any project that needs some computer power.

Use WiFi as the station mode

Most people will use the onboard WiFi to connect the router, so it is station mode.
Step 1:Load the WiFi driver
On Banana Pro, you need load the WiFi driver. Although we use AP6181, but the wifi driver is the same of the AP6210, so the driver name is called AP6210. You can use the command in the below to enable the function of the WiFi:

sudo modprobe ap6210

You can see if the driver has been loaded by:


If you want to auto load the WiFi driver when you boot the system. you can add "ap6210" into the /etc/modules file:

sudo nano /etc/modules

And then add the "ap6210" below the file, save and exit.
Step 2:Use the WiFi
On the Raspbian system, you can connect to the WiFi hot spot by using the WiFi Config application, as follows:
Raspbian wifi sta.jpg

On the Lubuntu system, you can connect to the WiFi hot spot by clicking the button which is at the right bottom corner of the desktop, as follows:
Lubuntu wifi sta.png

3.Linux without Desktop
If you use the Linux-like system without desktop, and recommend you to use wpa_supplicant tool to connect the WiFi hot spot, An example of the Debian as follows.
Install wpa_supplicant.

sudo apt-get install wpasupplicant

Edit the wpa_supplicant.conf

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the content below into the wpa_supplicant.conf:

ap_scan=1  # use the wpa_supplicant to scan and choose the AP  

If the wpa_supplicant.conf is not exist, you need create one. ssid: the WiFi hot spot id name, psk: the password of the WiFi hot spot. Edit the /etc/network/interfaces

sudo nano /etc/network/interfaces

Edit the wlan part of the interfaces file:

auto wlanx
iface wlanx inet dhcp
pre-up wpa_supplicant -B -i wlanx -c/etc/wpa_supplicant
pre-down killall -q wpa_supplicant

Note: wlanx represent wlan0,wlan1 ...

Full networking example
This example configures eth0 with both dhcp and a static address and it also configures the wifi. For the wifi it uses wpa_roam so that you can configure multiple wifi networks which are automatically managed.

With this configuration you can:

  • take your pi anywhere and have it automatically connect to the wifi (if you have configured the username/password ofcourse ;-)
  • connect your pi to a wired network that has a DHCP server
  • connect your pi directly to your computer (wired) without a need for a DHCP server (you have to configure the ethernet port of your computer for a fixed IP address for this)

The /etc/network/interfaces file:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth0:1
iface eth0:1 inet static
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
  wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

The /etc/wpa_supplicant/wpa_supplicant.conf file (the network specific options may differ for your wifi networks ofcourse):

  ssid="<SSID1 here>"
  identity="<username1 here>"
  password="<password1 here>"
  ssid="<SSID2 here>"
  psk="<password2 here>"

WiFi Access Point mode

If you want to use the AccessPoint(abbreviation:AP) mode of the AP6181 WiFi module on the Banana Pro, you can refer to the instructions below.
Setp 1:Edit the /etc/modules
Edit the /etc/modules file, and add the content below into the file:

ap6210 op_mode=2

Setp 2:Download and compile the hostapd

git clone git://
sudo apt-get install libnl-dev
sudo apt-get install openssl
sudo apt-get install libssl-dev
cd hostap/hostapd
cp defconfig .config
sudo cp hostapd /usr/local/bin

Setp 3:Create and edit the hostapd.conf

sudo mkdir -p /etc/hostapd
sudo nano /etc/hostapd/hostapd.conf

Add the content below into the hostapd.conf file:


You can change the ssid and wpa_passphrase.

Setp 4:Edit the network interfaces

sudo nano /etc/network/interfaces

Replace the content below:

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlanx
iface wlanx inet static

Setp 5:Enable the DHCP server
Install the DHCP server

sudo apt-get install udhcpd

Edit the udhcpd.conf

nano /etc/udhcpd.conf

Add the content below into the file:

#The start and end of the IP lease block
start    #default:
end   #default:
#The interface that udhcpd will use
interface   wlanx     #default: eth0
option  subnet
opt     router
opt     wins
option  dns
option  domain  local
option  lease   864000

Setp 6:Reboot and restart the server
Run the DHCP server:

udhcpd /etc/udhcpd.conf

Run the hostapd:

hostapd -B /etc/hostapd/hostapd.conf

And then you can check the result: