Friday, August 18, 2017

Banana Pi R1 as a router: Instructions step by step

At a chair of the University of Shenzen, a project called Banana Pi, which largely retained the board layout of the Raspberry Pi and its interface arrangement, was developed, but with a GByte RAM, a two-core CPU, Gigabit Ethernet and SATA promises more freedom. We have in the meantime interested in the now good software support especially the router variant.


Two interesting operating systems: OpenWRT and Bananian


The configuration of this Banana-Pi router board corresponds largely to the classic Banana Pi. Additional hardware is a Realtek 8192CU Ethernet chip, which is connected via the USB interface. The five Ethernet ports are provided by a Broadcom Managed Switch, which requires some attention, and later on.


Start with OpenWRT


Comparing the hardware of the Banana Pi R1 with typical DSL routers of the price class from 60 to 100 euros, immediately massive differences are noticed. As a CPU, most of the classic routers use MIPS processors, which are usually clocked between 400 and 600 MHz - with a two-core ARMv7, the Banana PI is a multiple flotter on the road. The memory of typical DSL routers is between 64 and 128 MByte - some devices must even get along with 32 MByte. If the 1.024 MB of the Banana Pi is not enough, it is also possible to use swap space on SD card or better SATA.


More Power with Debian


The Banana Pi also has a lot to offer in mass storage: the μSD card takes up to 32 GB, with typical routers already 32 MByte luxury. In addition, there is the advantage of the removable memory card: If you have mistakenly configured a configuration, you take the memory card and edit the faulty configuration file on the PC. An advantage for debugging is the possibility to connect a monitor via HDMI and a keyboard via USB. The initial setup of the router is thus still possible without a network.


Potential in home automation


Another advantage of the Banana Pi over the Raspberry Pi is the use of the ARMv7 processor, which many Linux distributions now support because it serves as a bridge for porting to tablets and sparse servers. Programmers who want to port an existing Linux to Banana Pi simply have to adapt the bootloader and build a customized kernel. The porting requirement is significantly lower than for the ARMv6, where all existing packages must be recompiled.


The number of distributions available for Banana Pi is now correspondingly large. Because of the lack of support for the managed switch, we do not recommend trying out any distribution for the regular Banana Pi on the router board.


Currently there are three official systems for the router board. The first is an Android. Hardly anyone but a router to the TV to configure, the number of routerapps and their range of functions is very limited. The porting of OpenWRT, a Linux focused on use on routers and access points, which already provides 32 MB of RAM and 4 MB of typical Flash functionality, including Web front end, is a more interesting experience for the home


Bananian also has a Debian-based Linux distribution. In contrast to Raspbian for the Raspberry Pi, Bananian uses the package repositories of the Debian project and keeps the differences to the regular Debian system as low as necessary with its own kernel and basic configuration.


Which of the two systems you should use ultimately depends on two factors: How fast should the router functionality be available? And what extensions are planned? If only one DSL router with WLAN access point and basic NAS or printer pooling function is to be set up, OpenWRT leads the fastest to the goal. In the medium term, it is also planned to use GPIO pins (General Purpose Input Output), for example to control radio sockets, to Bananian. In doubt, a second μSD card costs only a few euros and allows OpenWRT to be used productively and tinkered to Debian.


For initial experiments we recommend the image of OpenWRT available under bananapi.com. The editorial version of January 13, 2017, which had already been configured for the hardware of the R1 together with the switch and the access point, was available at the editorial office. As a result, a comfortable web interface is possible, more complex tasks can be set via SSH. In order to install the 70 MB image, you use a USB-SD adapter - unfortunately the internal SD-slots of many notebooks do not work - and the software Win32DiskImager, Linuxer access the command line



Dd if = openwrt.im of = / dev / sdxsync


After the installation, the SD card contains a boot and a system partition, only the first 70 MByte is used. The SD card is now plugged into the SD slot of the R1, which should be connected to a PC via FTDI adapter (see box). The green LED will now indicate the boot process. After about one minute (on the first start the SSH keys are created) a WLAN called OpenWRT should appear. If you connect your computer to this WLAN, you can then access http://10.0.1.1/ and log in as root with the root password


Since OpenWRT also starts the DHCP server on the LAN interface (four port switch), you can also establish a direct connection between PC and R1 via Ethernet. If this is not possible, the temporary allocation of a static IP address from the same network (for example, 10.0.1.2, netmask 255.255.255.0) helps to access the routerboard.


You may also be interested in the


For the post-installation of packages, please proceed as described in the release notes linked to the download page.


Another house number with regard to package scope, functionality, but also configuration effort is Debian in the form of Bananian. The image is unpacked two gigabytes large. If you downloaded Bananian from bananian.org, it is necessary to enter the line
after the first start in /etc/network/if-pre-up.d/swconfig


Conclusion


Exit 0


And / etc / network / interfaces so that the two virtual interfaces eth0.101 and eth0.102 provided by the switch are configured via DHCP or with a static IP address. Both configuration files can be found on issue DVD (5/2015) and in the author's GitHub archive. If you are using the bananian image that we have included on the staple DVD, this adjustment is omitted: We have assigned the static IP address 192.168.3.1 on the four port switch (network mask 255.255.255.0) and on the WAN port the DHCP Client is activated. After finding the R1 in the local network, you can start with


Bananian-hardware


The default hardware on Lamobo R1 and after a restart with


Apt-get update


Update the package lists and, for example,


Apt-get install hostapd


The access point functionality. Our network configuration is a usable output configuration for an access point with NAS and media server, for the full DSL router functionality you have to install pppoe and isc-dhcp-server. Thanks to the HDMI port, even graphical applications are available, not a must on a DSL router, but a nice little thing to do in a comfortable environment.


The selection, installation and configuration of the correct Linux can only be a first step. With its 26 GPIO pins and foil plugs for camera and display, the Banana Pi R1 offers enormous possibilities of expansion. For example, the display connector can be used to connect a 800x480 pixel LCD for status information. The GPIO pins are even more versatile. How about a traffic light from LEDs, which shows the status of the current Internet connection: green for all OK, yellow for connection, but is slow and red for No connection, perhaps a servo-executed analog display, with a pointer the current Used bandwidth.


Beyond these gimmicks, however, there is also quite firm potential. The I²C bus makes it possible to communicate with an Arduino or other microcontrollers and, for example, switch radio outlets, read sensors distributed in the house, or send an e-mail when the last Bluetooth smartphone has just left the house A window is still open


The Banana Pi R1 is undoubtedly an interesting product with a great potential. The hardware is balanced, even if the USB-connected and not ac-capable WLAN card is not the wisdom of the end. Unfortunately, the software is currently lagging behind: OpenWRT is still usable despite developer release Chaos Chalmer, but still lack the support of an HDMI console. And it is not foreseeable whether OpenWRT will support the GPIO interface. If you simply want to set up a router with a fast NAS and a lot of configuration possibilities, this works well.


If the full potential is to be exhausted, the grip on Debian / Bananian is inevitable. Anyone who is willing to see the router as a project and expand the functionality gradually will have a lot of fun and find new ideas.

No comments:

Post a Comment