3

I am building a little network lab. I want to turn one of my Raspberry Pi 4 into a switch.

I already have a network manufacturer docker image to run on it.

Still, I have only one RJ45 port. How to add more? (at least 3).

I read that it wasn't possible for older RPi versions. Is it still the case?

  • 3
    Buy a switch - it will be cheaper, more reliable and work better. PS "RJ45" is a telephone jack. – Milliways Feb 28 at 22:07
  • 1
    I do have a switch already. But for knowledge purpose, I want to emulate a small cloud fabric. I need to have a switch with an manufacturer OS running on it. I already have the software, I juste need extra ports. Are you suggesting I could use some dumb switch and use the RPi as a controller for it ? – Gane D. Geoffrey Feb 28 at 22:21
  • 2
    In other words you DO NOT want to turn one of my Raspberry Pi 4 into a switch. You can add Ethernet ports with USB dongles, there may be Ethernet HATs. – Milliways Feb 28 at 22:25
  • an RJ45 port is not necessarily an ethernet port – jsotola Feb 29 at 3:58
  • Adding RJ45 ports doesn't help you one bit. You need to add network adapters. – Jörg W Mittag Feb 29 at 10:47
4

You can add two Ethernet ports to your raspberry pi with EthernetBerry Dual ETHERBERRY. Check this link out:

EtherCAT® Shield for Raspberry PI – EtherBerry

You want to add at least 3 different port. So, one another can be a USB Ethernet port which you would connect to your raspberry pi by one of the USB ports.

You can add more USB Ethernet port but you should take note that they will be work on the USB clock. As an example, if the USB port speed is 50Mbit (400MB) at the high situation and if you plug 3 different USB Ethernet port which are transmitting/receiving data over the port, each one can transmitting/receiving data with the speed of 17Mbit (133MB). I mean, the speed would be divided/shared between ports.

| improve this answer | |
4

The Raspberry Pi is not a good candidate for such an experiment. Raspbian is a general-purpose OS based on Debian Linux. Instead, buy, perhaps second-hand, a device intended to be a router that has multiple Ethernet ports and probably a wireless access point. Load one of the open-source firmware releases, DD-WRT, OpenWRT, Tomato, or perhaps something else. OpenWRT, in particular, has QoS support and access to some of the low-level functions without modifying source code.

Of course, many of the distributions you could load on such a device are also based on Linux, but the heavy lifting of dealing with the communications fabric has at least mostly already been done. That leaves you free to experiment with the interesting bits.

| improve this answer | |
3

I would comment on @m-rostami's post but I don't have sufficient reputation yet.

The EtherCAT shields are very expensive, but adding USB->Ethernet adapters will work just fine. Yes, the performance will be very poor, but you probably don't care about that because you are running this as a learning experiment.

Remember that the Raspberry Pi model 3 and earlier only supports USB-2 and your network performance will be poor anyway because you will have lots of adapters sharing the same USB bus, so there is no point buying more expensive USB3 or GbE adpaters if you're on a model 3. Just buy the cheapest. I've used lots of different versions for various reasons and they all work fine if you install the drivers. That having been said, the older USB2->100 BaseT adapters are getting harder to find now because people have moved over to USB3->GbE.

Adapters that I can recommend as I personally tried them and found them to work well are:

Manufacturer    Model               Style            Driver
Anker           AK-A7610011         USB3->GbE        r8152
Belkin          B2B048              USB3->GbE        r8152
CableMatters    202023-BLK          USB2->10/100     r8152, smsc95xx
CableMatters    202013-BLK          UBS3->GbE        r8152
Linksys         USB3GIG-EJ          USB3->GbE        r8152
Trendnet        TU3-ETG             USB3->GbE        ax88179_178a

Just remember that they all need power so get a big power supply for your Pi or, better still, use a powered external USB hub. The power supply design in the Pi is very "cost optimised" and doesn't work well if you load it up with lots of power-hungry peripherals, and USB->Ethernet adapters (especially GbE ones) can draw quite a bit of power. Using a powered external USB hub completely solves the power issues.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.