Switch – How to programmatically, physically connect ethernet ports

ethernetlayer1switch

I want to plug and unplug two ethernet cables from a little test script. I thought a fancy managed switch would have this capability but it turns out to only allow me to create VLANs and optionally tag certain ports with those VLAD IDs.

Am I looking for a a layer 1/physical switch?

http://thenetworksherpa.com/what-is-a-physical-layer-switch/

http://www.digital-loggers.com/lpc.html

Best Answer

If you need to electrically disconnect a port via command line (doing electrically the same thing as physically removing the cable from the port) you'll need a Layer 1 switch, which is a very expensive device (since it can connect any port to any other port). If you only need to stop the port communicating, then you might be able to do it with a cheaper managed switch by issuing interface disable/enable commands.

Depending on what you're doing, you could also manufacture a device that does it, for example by putting 8 Mosfets between the pins of two outlets, and then trigger those with the I/O of a Raspberry Pi. This won't satisfy the requirements for Ethernet when it comes to shielding and frequency attenuation, but for test purposes it might work. If you're only using FastEthernet, then you can get away with only doing it on 2 pairs of the cable as well.