Low Orbit Flux Builds a Raspberry Pi Router with a Compute Module 4 and DFRobot's IoT Carrier Board
Using the Compute Module's PCI Express lane, it's possible to pack two full-speed gigabit Ethernet ports into a very compact IoT router.
Pseudonymous maker "Low Orbit Flux" has posted a guide to turning a Raspberry Pi into a firewall and router — getting around the device's usual lack of a second Ethernet port by adding a DFRobot dual-Ethernet carrier board to a Raspberry Pi Compute Module 4.
"The first [router] that I built was using the original Raspberry Pi with a USB NIC [Network Interface Card], so I had the onboard NIC and a USB NIC," Flux explains. "That was kind of suboptimal because it was limited by the speed of the USB controller, and that was kind of a bottleneck. So, my new Raspberry Pi firewall router is going to use the Raspberry Pi Compute Module 4 together with this dual gigabit NIC expansion board here."
All standard models of Raspberry Pi, from the original Model B to the latest Raspberry Pi 4, come with either a single gigabit Ethernet port or no Ethernet at all — making them unsuitable for use as a router, which requires one port for the local area network and another for the wide area network. The Raspberry Pi Compute Module 4 falls into the category of having no Ethernet ports at all — but does expose a PCI Express lane, making it easy to design a carrier board with as many Ethernet ports as you like.
DFRobot's IoT Router Mini Carrier Board is pretty simple: It accepts a Raspberry Pi Compute Module 4 and breaks out a micro-SD slot, USB Type-C for power and another for data, 26 pins of the usual 40-pin general-purpose input/output (GPIO) header, and uses the PCIe lane to drive an Realtek RTL8111 Ethernet chip — giving the board two Ethernet ports, with one linked to the Realtek chip and the other to the CM4's own Ethernet PHY.
"I initially attempted to use Raspberry Pi OS," Flux writes of his progress. "It was able to recognize the first NIC but not the second. It looked like setting up the driver might require [a] significant amount of effort (it might not) so I decided to try Ubuntu instead."
Using Ubuntu Server, Flux was able to configure both network ports and then set the device up as a low-power, ultra-compact router — though, for the purposes of the tutorial, stops short of configuring it to do anything beyond forward traffic from one port to the other.
Flux's project write-up is available on the Low Orbit Flux website, with a companion video on YouTube.