July 3rd, 2024

Making a Linux-managed network switch

Martijn Braam developed a custom 5-port gigabit switch using RTL8367S chip, simplifying design by connecting power nets and regulators. Integration with Linux involved kernel adjustments and device tree modifications, showcasing the feasibility of custom network switch creation.

Read original articleLink Icon
Making a Linux-managed network switch

Network switches are typically managed through web interfaces, but some consumer routers contain Linux-based switches internally. Martijn Braam decided to create a custom 5-port gigabit switch using the RTL8367S chip. Despite initial complexities in chip implementation, Martijn simplified the design by connecting power nets and regulators. The switch chip has CPU ports, but Martijn connected to port 0 for Linux compatibility. Configuring the switch chip involved understanding various communication interfaces and pins. Martijn's design included a USB Type-C connector for power. Integrating the switch with Linux required kernel module adjustments and device tree modifications. By linking the switch ports to the A64-lts board, Martijn successfully created a functional switch with multiple Ethernet interfaces. Despite challenges in chip configuration and board design, Martijn's project demonstrates the feasibility of creating a custom network switch using readily available components and open-source software.

Link Icon 9 comments
By @gerdesj - 4 months
"Network switches are simple devices, packets go in, packets go out. Luckily people have figured out how to make it complicated instead and invented managed switches."

Expensive switches involve some pretty fancy ASICs. For example I have a pair of fairly elderly Dell OS9 switches with 48 x 10Gb/s ports and four x 40Gb/s QSFP+ fibre ports. These are "old skool" stacked jobbies. Each switch can shuffle up to 1.28Tb/s (1). That's quite a lot. You can get those for £1800 including VAT (2) these days and they will last nearly forever.

I love to see efforts like this but do bear in mind that say Netgear will do a eight port 1Gb switch with Power over Ethernet on all ports for about £125.

If you cost your time at somewhere between £20-50 per hour when evaluating whether a project is financially viable, then an off the shelf box might be indicated. However, if the actual purpose is the project itself then sod the price!

(1) https://i.dell.com/sites/doccontent/shared-content/data-shee... (2) https://www.etb-tech.com/dell-force10-s4820t-10gbe-switch-os...

By @buccal - 4 months
Interesting project.

For simpler use you can get an OpenWRT capable router which in most cases uses a managed switch chip. OpenWRT provides a nice interface to configure VLANs and other options.

By @stragies - 4 months
Nice article, Thank you for the write-up.

First time I saw somebody 'creatively using' an RTL83something switch was https://spritesmods.com/?art=rtl8366sb, and there were others since then, but yours was the first 'build my own managed switch', instead of 'adding an external brain to an unmanaged switch'

By @thelastparadise - 4 months
What's the advantage of doing this over plugging multiple gigabit adapters into a linux machine and adding them all to a bridge?

I'm guessing performance might be better with the hardware, but I don't know --has anyone done tests to show the difference?

By @wesapien - 3 months
What ever happened to Openflow? Wouldn't this be a perfect device for it? Setting up a lab for it was almost impossible thats why I lost interest.
By @shmerl - 3 months
From what I've read, it's very hard to make a 10 Gbps switch without relying on some blobs since those accelerator chip makers don't have any open drivers support.

And you supposedly need those chips since switching it on the CPU is very taxing.

By @teddyh - 4 months
Does it support rSTP?
By @nicholasbraker - 3 months
The first paragraph reads as if it's taken directly from The Hitchhikers Guide To The Galaxy.
By @protocolture - 3 months
No offense intended, I may have misunderstood something here.

You use a routerboard block diagram as your model to demonstrate how a hardware switch is connected to the rest of the system. But then you go on to claim that they are impossible/difficult to work with.

Did you source a routerboard at any point here? Fairly sure that OpenWRT can be built for most routerboards, and the 2011 should be a fairly common device on the second hand market.

Maybe this is a better question. Was the goal always to build from scratch? Or did you discard the concept of using someone elses hardware for a particular reason?