Go Down

Topic: Managing two ethernet ports (Read 2372 times) previous topic - next topic

jgeek

I need to do a project which contains two ethernet ports, it should forward the data packet one from the other by changing meta data of the packet. I have purchased Arduino MEGA2560 board and two ethernet modules. is it possible to connect and have two ethernet interfaces ? or if not, is it possible to use usb port to communicate with the pc (like a ethernet connection) ? what methods that I have to do in programming to use usb communication ? Thanks in advanced.

m_ri

#1
Jun 30, 2012, 10:31 am Last Edit: Jun 30, 2012, 11:49 am by m_ri Reason: 1
Can u tell us why do you need two ethernet connection?
do u need to connect ur arduino with two different network,or only with two pc?or do u need more than four sockets?
I maka these question because probably u don't need TWO ethernet connection..

jgeek

I want to connect two PCs. what I'm going to build is an anonymous communication (proxy). The communication can be between two PCs  or router to PC. (via Ethernet cable). The arduino device will be act as intermediate device.

SurferTim

You should be able to do that with one ethernet interface using two sockets. This is a ftp client sketch that uses two sockets on one ethernet shield.
http://arduino.cc/forum/index.php/topic,93502.msg707104.html#msg707104

You should be able to do that with a web server/client combination, rather than command and data ports (sockets).

pylon

I guess what you wanna to do is a transparent proxy. The Arduino will not be flexible and probably also not fast enough to do so. Choose an embedded linux platform to do such things, probably the cheapest are the Linksys WRT54GL boxes using an alternative firmware like OpenWRT. It's much more flexible and a lot more powerful.

SurferTim

pylon is right. If that is your intent, it is not enough. My slowest router is 300MHz with 32M SRAM memory.
I like Mikrotik, but I think that is just a matter of opinion.

jgeek

#6
Jun 30, 2012, 06:45 pm Last Edit: Jun 30, 2012, 06:50 pm by jgeek Reason: 1

You should be able to do that with one ethernet interface using two sockets. This is a ftp client sketch that uses two sockets on one ethernet shield.
http://arduino.cc/forum/index.php/topic,93502.msg707104.html#msg707104

You should be able to do that with a web server/client combination, rather than command and data ports (sockets).



In this solution, can you please explain how to connect two machines at the same time to the arduino device ?

pylon: yeah, it's a transparent proxy. Since I'm doing this for a project, I can't use any in built routers, aps or switches. I'm not worrying about the speed and performance. Is there a way to manage this with lowest functionality by using arduino ? all I need is to connect two machines and make a communication. As an alternative it's ok to use the usb port to connect one machine, but how can I make it possible ? please help

SurferTim

You should get a web server running, then a web client. The ethernet examples in the IDE should help you with each of those. Then combine them.

But I would be familiar with the workings of each before attempting the combination.

pylon

If it should be a transparent proxy (so no changes to the PC side programs) I guess you will fail with the Arduino solution. This is possible with any cheap Linux router but too much for a device like an Arduino with an Ethernet shield. You simply do not have enough control over the TCP/IP features for such a project from the Arduino.

SurferTim


The Arduino will not be flexible and probably also not fast enough to do so.


@pylon: You told him that. I told him that.
But don't you think it would be a great learning experience?  :D

jgeek


You should get a web server running, then a web client. The ethernet examples in the IDE should help you with each of those. Then combine them.

But I would be familiar with the workings of each before attempting the combination.



I think I should tryout this.

Pylon: apologies, I just went through a google search and realized what is the exact task of transparent proxy. I don't know exactly which proxy that I'm using on my project, (guess it's anonymous proxy) it forwards the packet by adding embedded system (arduino or what ever) IP address by hiding the source address (pc) and it should be able to block some main ports. 

SurferTim

Here are a couple links that may help you out.

The first is a web server that partially parses the request.
http://arduino.cc/forum/index.php/topic,94861.msg713125.html#msg713125

The second is a client. It loads the Google home page every 10 seconds.
http://arduino.cc/forum/index.php/topic,99629.msg754629.html#msg754629

When you get a request from a client on the server, you will need to parse the request and call the client function to get the page from the destination server as a client, then send it to the server client as a server.  :smiley-eek:


Go Up