Martijn Braam's Unusual Ethernet Switch Has One Reversed Port — for Linux Management Experiments

Designed with experimentation in mind, this custom four-and-one port Ethernet switch offers low-level Linux control.

Martijn Braam has designed a custom gigabit Ethernet switch with management capabilities — and, for reasons that will become apparent, one of its five ports facing the wrong way.

"Making my own network switch can't be that hard right? Those things are available for the price of a cup of coffee and are most likely highly integrated to reach that price point," Braam explains by way of his background thinking prior to launching the project. Since I don't see any homemade switches around on the internet I guess the chips for those must be pretty hard to get… Nope, very easy to get. There's even a datasheet available for these. So I created a new KiCad project and started creating some footprints and symbols."

When you want to play with low-level switch management in Linux, what can you do but build your own? (📷: Martijn Braam)

Braam's reason for going custom rather than buying an off-the-shelf managed switch is simple: a desire to experiment with managing a switch from within Linux, using a system normally only found within consumer-grade routers and rarely made available externally. "Controlling your standard off-the-shelf switch using this system simply isn't possible," Braam explains, "because the required connections of the switch chip aren't exposed for this."

Braam's custom switch, by contrast, aims to make this kind of low-level management easy to access, building around the Realtek RTL8367S five-port Ethernet chip. "It's actually not a five-port chip," the maker explains. "It's a seven port switch chip where five ports have an integrated PHY and two are for CPU connections. My plan is different though, while there are these CPU ports available there is actually nothing in the Linux switchdev subsystem that requires the CPU connection to be to those ports. Instead I'll be connecting to port 0 on the switch with a network cable and as far as the switchdev driver knows there's no Ethernet PHY in between."

The resulting device is unusual in its layout: four of the five PHY-equipped Ethernet ports available on the switch chip are brought out externally, as you'd expect — but the fifth port is found on the other side of the board, facing in the opposite direction. Power is provided over a 0.1"-spaced pin header, or through a USB Type-C connector — not populated in Braam's initial prototype.

The switch is managed as though it were a series of Ethernet ports connected to the controlling system directly. (📷: Martijn Braam)

In testing on a PINE64 single-board computer with a custom-built kernel, Braam found the switch fully-operational and manageable from within Linux itself — though with caveats. "It's not really possible to use this system on regular computers/servers since you need device trees to configure the kernel for this," Braam admits. "As far as I can find there's also no way to use this with a network port on the computer side that's not fixed, USB network interfaces don't have a device tree node handle to refer to to set the conduit port."

Braam's full write-up is available on his blog.

ghalfacree

Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.

Latest Articles