Operating System installation
This is the second part of the article series Building a router with the Banana Pi R1. To view the first part, click here.
What options do I have?
The Banana Pi R1, as stated in part 1, is based on the Allwinner A20 SoC (System on a Chip), which is based on the ARMv7 architecture. As such, it is compatible with all existing operating systems for this platform:
- Android
- Linux
- FreeBSD
- OpenBSD
- NetBSD
- OpenWRT
Initially, I thought of using one of the BSDs. Soo I found out that there was no support for the BCM53125 chip, which is the Ethernet switch used in the Pi R1. The Banana Pi R1, henceforth mentioned BPi-R1, like many commercially available home routers has only one Ethernet controller and a VLAN-enabled Ethernet switch. Although physically distinguishable the WAN and 4 LAN ports all share the same controller. Logically, the distinction is done with VLANs.
No operating system, other than OpenWRT (this onde is, of course, also based on the Linux kernel) or the Linux distributions have a driver for the BCM53125. Because I wanted a broader use operating system, I decided against using OpenWRT. I already have another router that uses TomatoUSB, which is very similar to OpenWRT.
Available Linux kernel based distributions
There are several Linux based operating systems available for download: (http://www.bananapi.com/Download/6/):
- Ubuntu MATE 16.04
- KANO OS 3.3.0 beta
- Raspbian (based on Debian Jessie)
- Raspbian Lite
- Ubuntu minimal
- Android 4.4
- OpenWRT 4.0
- Snappy Ubuntu Core
- Bananian
- Arch Linux
- Lubuntu
- OpenSUSE
- Fedora
The BPi-R1 is also sold as the Lamobo R1. In this manufacturer’s web site one can download Armbian, which is a Debian distribution optimized for ARM architectures (https://dl.armbian.com/lamobo-r1/). Ubuntu Linux can also be downloaded from this site.
After some research I decided to go for Armbian with kernel version 3.4.113. The direct link for download I used is https://dl.armbian.com/lamobo-r1/archive/Armbian_5.25_Lamobo-r1_Debian_jessie_default_3.4.113.7z.
After downloading that file, it has to be decompressed using 7zip.
We’ll end up with a 1.3GB file, which is the operating system image, as well as a text file with some information about the release and a file named sha256sum.sha, which is a control file for checking the image’s SHA256 checksum, in order to verify the download is not corrupt. You can check this checksum using the sha256sum utility or some like it.
Next, I “transfered” the image file to an empty microSD card; this microSD card must have a capacity of 2GB or more.
On UNIX®, BSD and Linux systems, one can use the dd utility to do this. In Windows, the best tool for this job is Rufus (available at https://rufus.akeo.ie/).
The command I used in my Linux computer was:
dd if=Armbian_5.25_Lamobo-r1_Debian_jessie_default_3.4.113.img of=/dev/mmcblk0 bs=128k
The bs=128k option is to accelerate the transfer.
Next, I used the gparted utility ar any other with similar functionalities to expand the partition created on the microSD card in order to fill it. Later I found out that there is an utility installed on the microSD card to do that, as part of the Armbian’s post-installation procedures.
We are ready to power up the BPi-R1 for the first time. Because we still haven’t configured network connectivity, we have to plug the BPi-R1 to an HDMI port of either a TV or a computer monitor and an USB keyboard. I used my Apple USB Keyboard.
Basic configuration
The first time we power the BPi-R1, we’ll have to login using the root user. The default password is bananapi. We are then asked to do some post-installation configuration:
- Changing the root user’s password;
- Creating a non-root user.
Armbian for the BPi-R1 is pre-loaded with some pre-defined network configuration files.
In order to be able to access the BPi-R1 via SSH and automatically configure the network interfaces for routing, the file /etc/network/interfaces.r1router must be renamed to /etc/network/interfaces. Of course, this has to be done with the root user.
This change allows for two VLANs being defined, one for the WAN interface and another for the LAN interfaces and WLAN. These last two are aggregated in a bridge (br0). This file also configures the WAN interface to get its IPv4 address by DHCP, which is the most common method in today’s broadband cabled connections in Portugal; The internal network gets the address range 192.168.2.0/24.
From now on, we can access the BPi-R1 via SSH. For that, because we haven’t yet configured the WLAN interface, we have to plug an ethernet cable to the WAN interface and to my current LAN.
In part 3, I’ll talk about the configuration of several services common to a home/small office router (DHCP, DNS and firewall).