We help IT Professionals succeed at work.

Simple Design for a Controllable Ethernet Switch / Router

Fred Marshall
Fred Marshall asked
on
I want to be able to interrupt an Ethernet link with controllable-length interruptions of perhaps 1msec to a few seconds.  The objective is to get an empirical measure of what interruptions do to various communication links.

I suppose one could do this with a couple of quad 2-input AND gates and a one-shot.  But that seems too clunky and not very flexible should other ideas for applications come to mind.

It occurs to me that an ethernet switch or a router (which includes a switching function of course) might be an ideal platform.  Maybe the interruption control could be from a laptop.  Then the entire implementation might be in software.  

I don't really want to mess with the hardware too much and I probably can't write the code either in any reasonable amount of time.  So, I'm looking for clever ideas that might work and that aren't too demanding of time and energy.  But, of course, a WRT54G with suitably modified DD-WRT does come to mind - but I've never worked on the code even to the point of doing a build.  So, the learning curve seems more demanding than I'd like to invest.

Or maybe a dual NIC PC?  Now, I *can* write batch files.

Ideas?  Maybe a good student project?
Comment
Watch Question

Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
The NAND gate idea won't work at all.  Network interfaces are much more complicated than that.  There are however, manual switches for network cables.  This Amazon search brings up a few:  http://www.amazon.com/s/ref=nb_sb_ss_i_1_15?url=search-alias%3Dcomputers&field-keywords=manual+network+switch&sprefix=manual+network+%2Caps%2C271
If you want to interrupt for just a millisecond and want it to be reliable, a software-only implementation running on a laptop probably won't do (but it depends on your requirements).

If you get a bit of hardware into the mix, you could put an FPGA on a board with two (or more) Ethernet ports and an RS-232 or USB link for commands and firmware updates, and have that handle your interruptions...
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
Network interfaces for common networks using RJ45 connectors and CAT5 cabling are basically modems.  A 100Mbps connection runs at 25MHz with 4-bit symbols per cycle.  The network cards have to encode and decode these signals.  This page describes the signalling:  http://en.wikipedia.org/wiki/Ethernet_physical_layer   I couldn't find a picture to describe it at the moment.

Author

Commented:
My assumption regarding the symbols was bogus.  Thanks.

So an array of 8 analog switches then I suppose would do the trick.  Then it wouldn't matter what the symbols are like.  That is if one wanted to go in that direction....

I don't care so much about getting down to 1msec but 10msec maybe.  I have no idea what results might look like and what times are critical.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
The network signals are transformer isolated (to prevent ground loops) and expecting a defined impedance, 100 ohms I believe.  The signal level is +-2.5V but that is floating, not ground referenced.  The hardware for passing and blocking a 25MHz signal is non-trivial.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
This article although it is 18 years old (so is 100-BaseT networking), has some good info.

Author

Commented:
Well my diagonal pliers will do it but the time span control is poor.  :-)

But decent analog switches don't fall off from -60dB until one hits 100MHz.  I'm not sure that this application demands even that good of a switch.  Maybe -20dB would be good enough in the OFF or OPEN state.

What article is that?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:

Author

Commented:
I'd still like to have an idea how one might use a PC for an interruptor (with 2 NICs)
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
What about building an interrupter switch inside an inexpensive Ethernet switch (along the lines of what blytkerchan was suggesting).

I would worry about discontinuities caused by analog switches. Ethernet signals are fast enough that they work like transmission lines.

So then if you could trap an inbound signal in software in the switch and have the signal (or lack of it) out an outbound port, that might work.

So Ethernet in LAN 1 and Ethernet out LAN 2 and a digital switch inside (additional circuit board) to turn the signal off and on.

If you are willing, get a copy of Comm View (tamosoft.net) and look at the packet retransmissions that go on at the best of times.
DavidPresident
Top Expert 2010
Commented:
Something like a $29 raspberry pi would be an ideal way to do this.  Here is an article about how to add a precision timer with 30 microsecond precision that includes the code to do it. Since the pi has an Ethernet port and runs Linux you can Use it in a variety of ways to deal with this problem.   Heck the pic can take its own Ethernet offline or inject frames, whatever
Director, SD-WAN Solutions
Commented:
If you want to mess with the network, dummynet does a lot in Linux. Pfsense and monowall both play nice with dummynet to make a router. Only downside to a pi is one nic so you would need a Usb nic or something.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
The problem with any of these approaches that uses a NIC is that the NIC sends and receives complete packets in hardware where you can't interrupt them  You might be able to stop the transmissions in between packets... but modern NICs also have buffer memory to speed up the network so it might be difficult to even do that.  I also can't find any Ethernet test equipment that will interrupt the signals.  They are usually trying to make sure they're not interrupted.
DavidPresident
Top Expert 2010

Commented:
Use the pi as a precision switch that disconnects one half of the tx and rx twisted pairs at the desired intervals.  There are plenty of I/o lines that can do this.

Author

Commented:
dlethe: article?
DavidPresident
Top Expert 2010

Commented:
Sorry on the road now just google "raspbery pi precision timer" and you'll find numerous how-to articles.
DavidPresident
Top Expert 2010
Commented:
check out the ethos switch for the pi.   Looks like this is what you want.  Here is a video.    This may be more of a turnkey for you because it should be programmable via the realtime precision timer capability so you can turn ports on/off at 100ms intervals.  Call them.   the website is gadgetsmyth.com

https://www.youtube.com/watch?v=yVmD66hDRmQ
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
".... but modern NICs also have buffer memory to speed up the network so it might be difficult to even do that....."

I also think, if you open the circuit, that the signals will double back (reflection at the impedance change) leaving unpredictable results.

If you try interrupting at the PC once received in the PC, that is the same as a failed acknowledgement. Maybe that is what you are trying to do.

Author

Commented:
Aaron Tomosky:
Pfsense and monowall both play nice with dummynet to make a router.
Well, I guess this will mean my next 3-5 year foray into Linux.  Always before it's been "too much work to do simple things".  Maybe it's better now.  I don't want to spend all my time making the OS and the tools work - which is what seemed to happen in the past.  But, the idea is intriguing.
What distribution would you recommend for those tools?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
Since more and more is being integrated into the hardware, you may find it progressively more difficult to get to low level functions.
Aaron TomoskyDirector, SD-WAN Solutions

Commented:

Author

Commented:
Aaron:  OK.  I've got it running.  Now all I have to do is figure out how to use dummynet.  It appears it's not in the packages with pfsense....

In the mean time, I also have Ethernet dumb switches and routers lying around.  
I looked at a couple of the switches and can figure out what the chips are in one of them.  
But the switches don't have a software interface - so even if I can figure out how to use one of the controls, getting to those controls in a convenient way is going to be tough I think.  e.g. PowerDown per port looks like a good candidate.

But, I also have DD-WRT compatible routers.  Maybe I could control the switch inside a router (like WRT54G) with software and one of the management interfaces?
Aaron TomoskyDirector, SD-WAN Solutions
Commented:
From what I can read it is already installed and you use it with ipfw rules
http://info.iet.unipi.it/~luigi/dummynet/

Most people use it anytime they do rate limiting in the gui
http://www.squidworks.net/2012/08/pfsense-2-0-limiting-users-upload-and-download-speeds-by-limiting-bandwidth/

Author

Commented:
A little patience please.  It takes a few days to get back and try things....

Author

Commented:
On reflection, it appears that my best bet it to configure pfsense on a computer with 3 NICs.
One NIC for general purposes.
Two NICs for passthrough and introducing packet drops.

I have pfsense running but I'm unclear as to how to proceed with the implementation for packet dropping.
A bit of help would be appreciated on this part.

Author

Commented:
Thanks all!