Someone named Jet writes:

Hi, I wonder how to install the ipk files in orbi (rbr50, latest firmware 2.2.1.210) , as no opkg tool in the system

The Orbi firmware is based on OpenWRT. OpenWRT uses the linux utility ‘opkg’ to install .ipk files into the system.

I cannot recommend OpenWRT enough. I love linux and I love being given enough rope to hang myself (uh…lol, I guess?). Netgear, however, has made the (very sane) decision to limit your ability to void your warranty. Most of the things you can put on the system will be wiped next reboot. The ‘opkg’ tool doesn’t exist on the Orbi firmware. Soooooo, if you want to add functionality to your router, you’ll have to work around the safety rails.

The Orbi version OpenWRT is compatible with the binaries you can find at https://archive.openwrt.org/chaos_calmer/15.05.1/bcm53xx/generic/packages/base/. For this post, I am going to use the program iftop, which gives me the ability to see which of my kids is killing my bandwidth with updating their Steam games.

The program I’m going to be installing is https://archive.openwrt.org/chaos_calmer/15.05.1/bcm53xx/generic/packages/base/iftop_1.0pre2-1_bcm53xx.ipk. I’m going to download this to a linux host, but I suppose it would work in the the linux environment you can install in Windows, or in OSX.

We are going to use the following unix/linux commands:

First, download the package:

wget https://archive.openwrt.org/chaos_calmer/15.05.1/bcm53xx/generic/packages/base/iftop_1.0pre2-1_bcm53xx.ipk

Next, unpack the binary program:

tar xvfz iftop_1.0pre2-1_bcm53xx.ipk

This unpacks three files: debian-binary, data.tar.gz, control.tar.gz. The thing we want is data.tar.gz.

tar xvfz data.tar.gz

This creates the folder ./usr/bin, which contains the program ‘iftop’. How are we going to transfer this to the Orbi?

netcat

Some of the netcat functionality is implemented in the busybox binary that is used to implement a lot of the Unix utilities in OpenWRT. It doesn’t have *all* the functionality, but it has enough.

There’s only a few places on the Orbi that can hold stuff that persists between reboots. For what it is worth, I use /tmp/device_tables.

If you’ve gotten this far, I’m assuming you have telnet enabled. Telnet in to your Orbi, and change the local directory to /tmp/device_tables.

On your linux/unix host, type:

nc -l -p 8000 < usr/bin/iftop

This assumes that you’re in the directory that you unpacked the data.tar.gz file in. ‘nc’ is the netcat program. You’re telling it to *listen* (‘-l’) on port 8000 (‘-p 8000’) for an incoming connection, and then read the contents of ./usr/bin/iftop from stdin (unix stuff, maybe don’t worry if you don’t know what that means) and push it across the network connection.

On the Orbi, type:

nc xxx.xxx.xxx.xxx 8000 > iftop (hint: 'xxx.xxx.xxx.xxx' is the IP address of your unix host)

This command connects to your computer’s IP address on port 800, reads the data coming across, and puts it into the file ‘iftop’ in your current working directory. After you hit return, go back to your unix/linux computer and type Ctrl-C to end the transfer. Now you’ll have a file called ‘iftop’ on your Orbi. Maybe you should’ve changed the current directory to /tmp/device_tables before you ran this command (‘cd /tmp/device_tables’). Otherwise, move it there now (‘mv iftop /tmp/device_tables’).

You’ll need to make the iftop file executable, so type:

chmod a+x iftop

Now, type:

root@RBR50:~/device_tables# ./iftop /tmp/device_tables/iftop: can't load library 'libm.so.0'

Dammit. Ok, this means the unix math library (‘libm’) can’t be found. When I did this in a prior version of the firmware, it worked. Now, it doesn’t. Ok, let’s see what’s going on here.

root@RBR50:~/device_tables# ls /lib/libm* /lib/libm-1.0.14.so /lib/libm.so.1

So, it looks like the Orbi firmware update bumped the version of the library. /lib/libm.so.1 is there, but libm.so.0 isn’t. Maybe the different version of the library doesn’t break the functionality we’re interested in. Do you feel lucky, punk? Let’s try and fool the linker by making a symbolic link to the (old) version the program is expecting. Oh, we’ll need to do the same for libc, too.

ln -s /lib/libm-1.0.14.so /lib/libm.so.0 ln -s /lib/libuClibc-1.0.14.so /lib/libc.so.0

Full disclosure: I previously did this the earlier version of the firmware. Before I didn’t have to create symlinks to libm and libc, but I *did* have to install libpcap, which is library of function to capture and analyze network traffic. It looks like we don’t have to do that with the new firmware. I poked around on the OpenWRT site for a bit to see if I could find an iftop version compiled against libm.so.1 and libc.so.1 but, so far, no luck. In a previous life I had set up a cross-compiler tool chain, so that I could compile a program for my old linksys wrt54g router on my desktop computer, but who got time for that these days? Not me.

Anyway, if you try running iftop now, you might get the complaint:

Error opening terminal: unknown.

I’m getting this because I’m telnetting in from a shell in the virtual Ubuntu environment running on a Windows laptop which , apparently, doesn’t correctly set the TERM environment, which unix text-mode programs rely on in order to know how do format the output correctly for your screen. You *might* need to set the TERM variable to xterm (or, perhaps, vt100), you *might* need to set the environmental variables LINES and COLUMNS to something appropriate.

The last thing you’ll need to do is to make sure you use the right network interface to monitor using the ‘-i’ command line switch. For the Orbi, the one you (probably) want is br0.

To put a bow on it, you’ll want to make a little shell script (iftop.sh) to make it a one-stop thing. My shell script looks like this:

#!/bin/sh export TERM=xterm ln -s /lib/libm-1.0.14.so /lib/libm.so.0 ln -s /lib/libuClibc-1.0.14.so /lib/libc.so.0 #ln -sf /tmp/device_tables/libpcap.so.1.3.0 /lib/libpcap.so.1.3 /tmp/device_tables/iftop -i br0

Don’t forget to make the script executable

chmod a+x iftop.sh

This gives me a nice little text interface that looks like this:

Not much is happening on my network right now, otherwise there’d be a little bandwidth bar underneath each network connection.

It would be nice if the Orbi included a tool like this in the base firmware. Since libpcap has appeared in this version of the firmware, I’m kinda expecting to find out that it is already in there but I just haven’t figured it out, yet. Well, even if a bandwidth monitoring tool made it into the latest firmware, the techniques of loading software into the Orbi are useful to know, and demonstrates how smart Netgear is for building their router on top of OpenWRT.