I would like to know if it is possible to make raspberry pi work as an Ethernet switch?

@jsotala. Thank you for the advice. Basically I am not considering using the readily made switch from the market since it is no applicable to what I ma trying to do. What I ma trying to create is an automation test tool for mobile device. One of the requirement is to disable the charge of the mobile device. I know that I can do this via Raspberry pi, (connecting the raspberry pi to the mobile device and then issue a shutdown command) but shutting down the raspberry bi will also shutdown the capability of the sending commands to the mobile device. So I am trying to check if it is possible to make raspberry device as a switch. Basically, I am trying to check if the below are feasible:

  1. Test Automation tool is connected to Raspberry PI
  2. Wifi router is also connected to Raspberry PI
  3. Mobile device / Android Device is connected to Raspberry PI
  4. If test requires power testing, Test Automation tool will control the android device through raspberry pi.
  5. If test does not require power testing, raspberry pi will cut the usb connection/power connection to the android device, then it will connect to the Wifi router so that test automation command will be send via WIFI router

Please see the image below:

enter image description here


2 Answers 2


You would obviously need more Ethernet ports to make an Ethernet switch, at least one. The only available interfaces are USB, even the Ethernet port on the board is connected to the USB controller internally. With USB2, you have about 30MB/s available bandwidth. Each packet passing from one side to the other has to pass the USB twice, on the way in and out. So you may achieve a bandwidth of 15MB/s.

On the other hand, you can have a cheap gigabit switch with five ports and 100MB/s bandwidth for less than 20$.

  • With the new RPi4 with 8GB of RAM we have 1 Gigabit ethernet port and, theorically speaking, 2 ports 5 Gigabit ports with usb dongles, right? Commented Oct 11, 2021 at 16:13

Yes it is possible to use a Raspberry Pi as an ethernet switch like any other linux box. Networking is one of the main usage of Unix. To make a switch you need at least a second USB to ethernet dongle so you have two interfaces you can bridge. And that is the keyword. You can use a bridge to make your box a switch. One of the most popular bridges is the kernel build in linux bridge. That you can manage with iproute2, bridge-utils, netctl, systemd-networkd or NetworkManager. To filter trafic on the linux bridge and make it more a switch you can use the package ebtables.

Another popular software is Open vSwitch that is available from the default Raspbian repository.

It was not asked to switch/bridge a wifi interface (wlan0) in client mode. This is not supported on Raspberry Pi and cannot be done with a real bridge on OSI layer 2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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