I'm working on a project where I want to redirect ethernet traffic through another interface. The setup is as follow:
I have a computer with a working internet connection. I also have a MBED LPC1768 board which I can connect by USB with my computer. I can upload a binary file to this device and run it. For example, I can let it act as a keyboard and send key strokes to the computer. I can also let the device act as a mouse and send mouse events.
Now I want the device to act as an ethernet interface. Since the device is connected using USB, I was thinking about an ethernet-over-USB protocol. I've chosen for the USBCDC-ECM protocol which works on Linux and OS X. When plugging in the device, the device is correctly identified as an ethernet interface. Moreover, I run a DHCP server on the embedded device so the computer gets assigned an IP address. Note that the device does not have a working internet connection to the outside world (the computer does have one).
So the embedded device can capture internet traffic from the computer. When the device gets an packet, I want to analyze the packet, send it back to the computer and have it redirected through the working interface.
So for example, I have a laptop and a working connection on interface wlan0
. Now I plug in the device. It gets assigned to interface eth0
. eth0
is my preferred interface on the computer so all traffic goes to eth0
. I capture this traffic on the device and now I want to send the traffic back to the computer and route it over wlan0
(or any other working interface). So basically, I want to create a device that captures data and send it back to the computer, acting like a middleware USB device for internet traffic.
Is this possible to do? I prefer to not modify settings on the OS and let the device manage it. My primary OS is Ubuntu 14.04 so I do not care about Windows or OS X at the moment. Also, are there any alternatives to do this? Maybe USBCDC-ECM is not the best choice for this.
Any help would be highly appreciated.