A Banana Pi-based router

What Can You Do?

Because the router board descends from the standard Banana Pi, all of the operating system images adapted for that computer run on the modified board; however, insofar as these images do not support special hardware, the manufacturer refers users to three distributions [3]. These distros include a Linux version based on Android with special router tools, an OpenWrt version, and the Bananian distribution. The Bananian version from January 2015 serves as the foundation for this project [4].

We did not consider Android for a variety of reasons. OpenWrt has the advantage of being well equipped for use as an operating system on a router. The user planning to purchase an off-the-shelf router should definitely take a look at it. One disadvantage of OpenWrt is that it is still under development. Even though a number of versions are floating around on the Internet, OpenWrt has as yet no official images [5]. These unofficial versions can be found on the homepage of the manufacturer and other websites. The other issue relevant to this project is that OpenWrt support for WiFi functionality apparently remains unstable.

Bananian on the other hand involves a distribution that has been created with the A20 processor family in mind – particularly the CPU used on the BPi-R1. This distribution has nothing to do with the hardware manufacturer; instead, it was created by Nico Isenbeck from Hamburg, Germany. The advantage of Bananian over a system like Raspbian is that it is a dedicated server distribution.

Performance as a Switch

After you have used your PC to copy the image onto a microSD card by means of dd or Win32 Disk Imager, you should boot the R1 from the card and then log in as root with the password pi. The next step is to configure the device by means of bananian-hardware and then invoke bananian-config.

Thanks to the HDMI output and USB connection, you can work directly on the BPi-R1 as you would on the Rasp Pi. Alternatively, you could also connect the board to Ethernet and log in via SSH. If you choose this method, you might need to adapt the network configuration to local conditions by going into the /etc/network/interfaces file, located on the second partition of the microSD card, before booting. Normally, the R1 obtains its address by DHCP.

In its basic configuration, Bananian starts as a standalone computer on the R1. All computers connected by Ethernet can then communicate with the R1. To communicate among one another, all the ports first have to be consolidated in a shared VLAN. Consolidation is accomplished by entering the commands in Listing 1 into the /etc/network/if-pre-up.d/swconfig file. Listing 2 shows an interface configuration in /etc/network/interfaces.

Listing 1

Consolidating Ports

ifconfig eth0 up
swconfig dev eth0 set reset
swconfig dev eth0 set enable_vlan 1
swconfig dev eth0 vlan 1 set ports '4 0 1 2 3 8t'
swconfig dev eth0 set apply
exit 0

Listing 2

Interface Configuration

auto lo
iface lo inet loopback
auto eth0.1
iface eth0.1 inet static

The BPi-R1 now has a single IP address, and all of the ports have equal rights. At this point, the switch chip in the hardware assumes the switching function, and the CPU load will not increase, even with heavy throughput. The throughput in my tests, as measured with iperf, stayed in the range of 110Mbps between two computers connected to the switch and to the R1 as the destination device. This is enough throughput, even though in practice only a portion of the throughput remains.

The board consumes around 3W when idling; when working in switch mode, that value increases to 5W. For comparison, a "dumb" switch in a household setting consumes power at a constant rate of 3W, whether in use or not, and the TP Link WDR4900, a very powerful SOHO router, needs 5 to 7W.

The dumb switch only appears to be more efficient, however. In practice, such a switch used with a Raspberry Pi would need more power than when used with the R1. The R1 becomes interesting as a combination only if you want an additional, quasi-parallel server.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content