Go Down

Topic: Is it possible to make an in-line repeater (or router) using Ethernet shields? (Read 133 times) previous topic - next topic

Mithra

What I would like to do is create an arduino-based device that sits in-line between an internet-ready device ( such as my workstation ) and my switch / router.

The goal is to be able to filter / modify / block packets between the client device and the server.  I am a software developer and I'm curious about whether I can build something like this to help me debug network code non-invasively.  I think it would also be a neat way to measure network volume on a particular connection.

In other words, I want to create a basic router with one downstream port.  One Ethernet shield will pull an IP address from the upstream router as per normal ( not a problem ), but somehow I need the other Ethernet shield to work like a port on a switch, assigning the downstream device an IP and acting as its gateway.



Can anyone tell me offhand if this is feasible?

Or is there a better way to go about doing this?  Even if it didn't function as a router but rather a pass-along mechanism, that would be adequate.  Although I suspect a router would be more straight forward.

I figure I can connect the Arduino to my laptop via USB, run the serial monitor and then be able to view incoming and outgoing data on the wire.

I'm afraid someone is going to tell me this will require massive driver rewrites for the Ethernet shield OR that despite the fact the 8P8C connector fits, the shield circuitry is not designed to act as a port.

But then again, maybe both NICs can just pull a separate IP easily enough, and I can configure the PC in question to refer to one of them as its gateway?  Then it would be a matter of sending data received out the other NIC?  Scratching my head on this one.

SurferTim

Use another device. The Arduino/Ethernet shield does not have the speed to do what you want. You will probably find the SPI bus is the limiting factor. 1M transfer is about as good as you will get using one ethernet shield. If you are relaying from one to another, it will be limited to about 500K.

Mithra

Use another device.
Ugh.  So if we forgo the idea of measuring bandwidth with a vampirically slow device, do you think it COULD work, albeit throttled?  Latency wouldn't be a problem.  I don't expect to be downloading files or streaming video, but rather debugging exceedingly tiny requests and responses.

SurferTim

You might be able to get it to work. It will take some doing. I helped one other user connect two ethernet shields to the same Arduino. It requires a mod to the ethernet library and some pin jumpering and bending on the shields.

edit: Here is that thread. Maybe it will help you.
http://forum.arduino.cc/index.php?topic=294124.5

Mithra

You might be able to get it to work.
Haha well that's the encouragement I needed :D  I'm excited!

Thank you for the link!

Mithra

I am wondering if I'm over-engineering this...

If my goal is simply to capture and manipulate traffic between my workstation and the Internet, would it be more advisable, rather than invoke the use of two shields, to simply use ONE, let it pull its own IP address from my router in the standard DHCP manner, and then have my workstation configured to point to the arduinos IP as its gateway?

I think what I want can be done over the one connection.  But I think my biggest hurdle would be programming the arduino to sit in between and manage that traffic.

PaulS

Quote
But I think my biggest hurdle would be programming the arduino to sit in between and manage that traffic.
The Arduino would have to be both client and server. The server part would be accepting requests from you.The client part would be making (or not) requests on your behalf.

That alone would severely limit the amount of traffic through your internet connection.

There are firewall applications and proxy server applications for the PC that would do what I think you are trying to do, with far less impact to overall performance. There are network monitoring applications, too, that interfere far less than the Arduino would.

Mithra

That's true PaulS, but let's assume bandwidth wasn't an issue ( the device won't be a permanent gateway ) and we're dealing with another internet appliance that isn't a PC and doesn't lend to software installation of any sort.  Then the device would have some utility I think.  I'm just using my PC as an example.

I think I might need to ask about this under Gigs and Collaboration.  I would pay for code tutoring on the matter.

PaulS

Quote
but let's assume bandwidth wasn't an issue
I'm fine with your throttled bandwidth. I'll type real slow for you.

Quote
and we're dealing with another internet appliance that isn't a PC
What is controlling it? Is it a client or a server?

Quote
Then the device would have some utility I think.
I'm not convinced that a far faster PC wouldn't be a better choice, but don't let me stop you.

Mithra

I'm fine with your throttled bandwidth. I'll type real slow for you.
What is controlling it? Is it a client or a server?
I'm not convinced that a far faster PC wouldn't be a better choice, but don't let me stop you.
Fair enough.  So I should just install a VPN service or proxy server on Windows, figure out how to inject a dll into the running service, then hook winsock so my app can scrape the packet data, analyze and manipulate it.

Or I can learn how to make a dead-slow arduino gateway that serially outputs what I want to see and change via USB.

Honestly I can't say a single thing from a practical standpoint I've ever made with an arduino hasn't been already made, faster, cheaper and out of the box ready from China.  I'm hardware hacking for fun and hobby.  I spent the past year building an 11 pound meter wide hexapod that won't justify the time or expense, and by God I want to build a crappy, slow, packet sniffing ethernet gateway :D  I do appreciate the feedback really!  I just want to learn How, have fun and not get stuck on the Why.

Go Up