Awasu » Banana Pi gateway: Getting online
Tuesday 1st March 2016 9:19 PM []

My internet access is via wifi, so to get online, I need to get this working.

I use a Banana Pi Pro, which has on-board wifi[1]If you have a Banana Pi and you want to use wifi, you will need to use a USB adapter., so all I have to do is load the wifi driver, by adding ap6210 to the end of /etc/modules.

Reboot the system and run lsmod to check that the driver was loaded:

Don't forget to attach the ariel!


We now want to configure the bPi to automatically start the wifi interface and get an IP address.

Edit /etc/network/interfaces and add a new entry for the wlan0 interface:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid "YOUR NETWORK SSID"
wpa-psk "NETWORK PASSWORD"


Reboot the bPi, and when it comes back up, ifconfig should show an IP address, and we should be able reach the internet.

Updating the system

Now we're online, the first thing we should do is update the system.

First, update the index of available system packages:

root@bananapi:~# apt-get update

Then update the installed packages:

root@bananapi:~# apt-get upgrade

Go get a coffee, it will take some time to run...

When the system has finished upgrading, we can install sudo:

root@bananapi:~# apt-get install sudo

And then give the user account we created in the previous section sudo privileges[2]We do this by adding the user to the sudo group.:

root@bananapi:~# adduser taka sudo


Connecting to wifi using wpa_supplicant

If you only ever connect to one wifi network, configuring it in /etc/network/interfaces should be OK, but running wpa_supplicant gives you more flexibility when connecting to wifi e.g. it can remember multiple networks, they can be prioritized, it can connect to networks with hidden SSID's.

To set this up, first install wpa_supplicant[3]Note that there is no underscore in the package name.:

root@bananapi:~# apt-get install wpasupplicant

Then change the wlan0 configuration in /etc/network/interfaces:

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp


Each wifi network is configured in /etc/wpa_supplicant/wpa_supplicant.conf, and you should find the settings for the wifi network you connected to previously already there. If not, create this file and configure your network e.g.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="...NETWORK SSID..."
        psk="...NETWORK PASSWORD"
}

Reboot the machine and check if it is still online. If not, you may need to add some settings[4]More information about these settings can be found here. to the network section of the wpa_supplicant.conf file e.g.

  • key_mgmt is probably WPA-PSK, but could be WPA-EAP (for enterprise networks)
  • proto could be either RSN (WPA2) or WPA (WPA1).
  • pairwise could be either CCMP (WPA2) or TKIP (WPA1)
« Installing Bananian Linux

Tutorial index

Setting up the gateway »

   [ + ]

1. If you have a Banana Pi and you want to use wifi, you will need to use a USB adapter.
2. We do this by adding the user to the sudo group.
3. Note that there is no underscore in the package name.
4. More information about these settings can be found here.
Have your say