Building a router with the Banana Pi R1 — part 2

Operating System installation

This is the sec­ond part of the arti­cle series Build­ing a router with the Banana Pi R1. To view the first part, click here.

What options do I have?

The Banana Pi R1, as stat­ed in part 1, is based on the All­win­ner A20 SoC (Sys­tem on a Chip), which is based on the ARMv7 archi­tec­ture. As such, it is com­pat­i­ble with all exist­ing oper­at­ing sys­tems for this platform:

  • Android
  • Lin­ux
  • FreeB­SD
  • OpenB­SD
  • NetB­SD
  • Open­WRT

Ini­tial­ly, I thought of using one of the BSDs. Soo I found out that there was no sup­port for the BCM53125 chip, which is the Eth­er­net switch used in the Pi R1. The Banana Pi R1, hence­forth men­tioned BPi-R1, like many com­mer­cial­ly avail­able home routers has only one Eth­er­net con­troller and a VLAN-enabled Eth­er­net switch. Although phys­i­cal­ly dis­tin­guish­able the WAN and 4 LAN ports all share the same con­troller. Log­i­cal­ly, the dis­tinc­tion is done with VLANs.

No oper­at­ing sys­tem, oth­er than Open­WRT (this onde is, of course, also based on the Lin­ux ker­nel) or the Lin­ux dis­tri­b­u­tions have a dri­ver for the BCM53125. Because I want­ed a broad­er use oper­at­ing sys­tem, I decid­ed against using Open­WRT. I already have anoth­er router that uses Toma­toUSB, which is very sim­i­lar to OpenWRT.

Available Linux kernel based distributions

There are sev­er­al Lin­ux based oper­at­ing sys­tems avail­able for down­load: (http://www.bananapi.com/Download/6/):

  • Ubun­tu MATE 16.04
  • KANO OS 3.3.0 beta
  • Rasp­bian (based on Debian Jessie)
  • Rasp­bian Lite
  • Ubun­tu minimal
  • Android 4.4
  • Open­WRT 4.0
  • Snap­py Ubun­tu Core
  • Banan­ian
  • Arch Lin­ux
  • Lubun­tu
  • Open­SUSE
  • Fedo­ra

The BPi-R1 is also sold as the Lam­obo R1. In this man­u­fac­tur­er’s web site one can down­load Arm­bian, which is a Debian dis­tri­b­u­tion opti­mized for ARM archi­tec­tures (https://dl.armbian.com/lamobo-r1/). Ubun­tu Lin­ux can also be down­loaded from this site.

After some research I decid­ed to go for Arm­bian with ker­nel ver­sion 3.4.113. The direct link for down­load I used is https://dl.armbian.com/lamobo-r1/archive/Armbian_5.25_Lamobo-r1_Debian_jessie_default_3.4.113.7z.

After down­load­ing that file, it has to be decom­pressed using 7zip.

We’ll end up with a 1.3GB file, which is the oper­at­ing sys­tem image, as well as a text file with some infor­ma­tion about the release and a file named sha256sum.sha, which is a con­trol file for check­ing the image’s SHA256 check­sum, in order to ver­i­fy the down­load is not cor­rupt. You can check this check­sum using the sha256sum util­i­ty or some like it.

Next, I “trans­fered” the image file to an emp­ty microSD card; this microSD card must have a capac­i­ty of 2GB or more.

On UNIX®, BSD and Lin­ux sys­tems, one can use the dd util­i­ty to do this. In Win­dows, the best tool for this job is Rufus (avail­able at https://rufus.akeo.ie/).

The com­mand I used in my Lin­ux com­put­er 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 accel­er­ate the transfer.

Next, I used the gpart­ed util­i­ty ar any oth­er with sim­i­lar func­tion­al­i­ties to expand the par­ti­tion cre­at­ed on the microSD card in order to fill it. Lat­er I found out that there is an util­i­ty installed on the microSD card to do that, as part of the Armbian’s post-instal­la­tion procedures.

We are ready to pow­er up the BPi-R1 for the first time. Because we still haven’t con­fig­ured net­work con­nec­tiv­i­ty, we have to plug the BPi-R1 to an HDMI port of either a TV or a com­put­er mon­i­tor and an USB key­board. I used my Apple USB Keyboard.

Basic configuration

The first time we pow­er the BPi-R1, we’ll have to login using the root user. The default pass­word is bananapi. We are then asked to do some post-instal­la­tion configuration:

  • Chang­ing the root user’s password;
  • Cre­at­ing a non-root user.

Arm­bian for the BPi-R1 is pre-loaded with some pre-defined net­work con­fig­u­ra­tion files.

In order to be able to access the BPi-R1 via SSH and auto­mat­i­cal­ly con­fig­ure the net­work inter­faces for rout­ing, 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 inter­face and anoth­er for the LAN inter­faces and WLAN. These last two are aggre­gat­ed in a bridge (br0). This file also con­fig­ures the WAN inter­face to get its IPv4 address by DHCP, which is the most com­mon method in today’s broad­band cabled con­nec­tions in Por­tu­gal; The inter­nal net­work 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 con­fig­ured the WLAN inter­face, we have to plug an eth­er­net cable to the WAN inter­face and to my cur­rent LAN.

In part 3, I’ll talk about the con­fig­u­ra­tion of sev­er­al ser­vices com­mon to a home/small office router (DHCP, DNS and firewall).

This entry was posted in Administration, Configuration, Operating Systems. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.