< All postsTwitterRSS GitHub

Nov 8 2020

BGP Lego Bricks

Since I was 7 years old, I have wanted a LEGO Mindstorms robot. I will admit that in the later years it was mainly that I wanted to prove to myself that I got somewhere as it seemed so infinitely expensive back when I was younger…

LEGO Robot Inventor

Well I finally got one!

I knew this thing had some capability to run MicroPython since that was mentioned in the product description quite predominantly, which sounded like a pretty hackable platform.

However, shortly after opening the box, I realized that this wasn’t at all just an update to the Mindstorms EV3. Apparently the Robot Inventor was a slightly more expensive thing with less features and using a LiPo battery instead of AA cells.

Luckily I ordered it via the store’s website which means that by law I can return it within 14 days for any reason, and it allows me to open the box for inspection.

So after convincing some stubborn store employee that this is not a consumable product (which would remove my right to open the box), I got it returned and ordered the EV3.

Then two days later I finally had the thing which I have wanted for so long.

While I was waiting for the EV3, I was looking around at how it did MicroPython as it had this paragraph on the downloads page.

You can now use your EV3 Brick to unleash the power of Python programming using MicroPython. Simply install the EV3 MicroPython image onto any micro SD card and boot up your EV3 Brick from it to start programming straight away. 

After just a few minutes of searching I found ev3dev which is an open source community project that allows you to run Debian on it!

It appears to be really well made and apparently good enough for LEGO to provide official builds of it, which is what they use for MicroPython support.

So I just went ahead and downloaded and flashed the disk image to a microSD card with dd. I then plugged in the microSD card into the EV3 controller and turned it on…

EV3 kernel dmesg

To my surprise, after applying power I was pleased to see kernel dmesg output scrolling out on the LCD of the EV3 on the first try!

robot@ev3dev:~$ uname -a
Linux ev3dev 4.14.117-ev3dev-2.3.5-ev3 #1 PREEMPT Sat Mar 7 12:54:39 CST 2020 armv5tejl GNU/Linux

robot@ev3dev:~$ cat /etc/os-release 
PRETTY_NAME="ev3dev-stretch"
NAME="ev3dev-stretch"
ID=ev3dev
ID_LIKE=debian
HOME_URL="http://www.ev3dev.org"
SUPPORT_URL="http://www.ev3dev.org/support"
BUG_REPORT_URL="https://github.com/ev3dev/ev3dev/issues"

After playing around with it for about two minutes, I realized something… this thing runs Debian with a pretty damn complete package repository (it has ~64000 packages and normal amd64 Debian has ~66000 packages), can this thing run BIRD?

I assumed that if the ARM926EJ-S CPU can run Debian and stuff it can probably run a very minimal BIRD config, however I wasn’t so sure about the 56MB of RAM.

But well you won’t know if you don’t try :p

So I just went ahead and typed sudo apt install bird and pressed enter…

robot@ev3dev:~$ sudo apt install bird
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  bird-doc

(this was actually painfully slow as this thing doesn’t have a powerful CPU in the slightest)

As soon as I saw bird-doc I realized that yes it did at least have BIRD in the repo so that was a good first step.

I am only installing BIRD 1.6.3 here as it will probably use less resources than BIRD 2 if I only run the IPv6 daemon and disable the IPv4 daemon.

I then wrote a quick little bird config to let the EV3 (AS202314) announce 2a0d:1a45:666::/48 to my home router (AS210089), and the home router will then deal with the rest.

I applied that and wrote the other end of the config on my home router and applied that too.

Then I went to the NLNOG RING Looking Glass and I saw the /48 show up as announced by AS202314!

NLNOG RING Looking Glass

I then sent it to a friend who pointed out only about half of his sources could see the route, and well turns out I forgot to give AS202314 an RPKI ROA for the prefix, so I added that.

Then just for demo purposes I installed nginx which worked surprisingly well, so then I had a website I could access at http://[2a0d:1a45:666::]/ [1].

This was surprisingly easy to get working. Hats off to the ev3dev people for making this Debian derivative for the EV3.

While having the EV3 sitting there announcing a /48 of IPv6 is not useful in itself, this shows off how flexible the platform is. The fact that I can do this silly thing means that I can do much cooler things that don’t involve BGP on this, like running web servers and other things.


If this was to your liking then maybe you will find my other posts interesting, and you can also find my smaller projects and ramblings on twitter: @bitcynth.

Thank you to Ben Cox and Molly Miller for the help in editing this blog post.

[1]: no longer online