USB-to-Ethernet Relay

Simon Hobson dhcp1 at thehobsons.co.uk
Wed May 9 08:54:26 UTC 2007


Kaustuv De (w/PGDIT) wrote:

>  >>I would like to develop a USB-to-Ethernet relay.
>>>
>>>This system will require an internal DHCP client to
>>>configure the Ethernet interface. In particular it
>>>will need the following to operate in the network:
>>>+ its own IP address
>>>+ its subnet mask
>>>+ the gateway address
>>>To act as a relay, it will additionally require:
>>>+ the IP address of the m/c which will host the USB virtual
>>>    devices
>>>+ the port number through which it will connect to that host
>>>    to the USB virtual device server.
>>>
>>>Initially, I am to write a linux based dhcp client. After that
>>>I have to port that to a FPGA kit with both USB and
>>>Ethernet interfaces.
>>>Should I write a standrad dhcp client..can any body please give me some
>  >>idea, what will be ideal approach...

Thinking some more about this one I think I see what you are building here.

You have a 'device' with a network connection and a USB controller. 
You are going to attach 1 or more USB devices which will use IP to 
communicate with something else on the network. You need to configure 
the whole lot by DHCP.


Bear in mind that I'm far from being an expert ...
It seems that you have a choice, run your gateway as a bridge/router, 
or run it as a proxy.

As a bridge/router you have the task of building a network interface 
driver to run an IP network over USB. Once you've done this, you then 
use the normal network process to route packets. You can use the 
existing DHCP relay agent BUT will have to modify it to deal with the 
fact that your USB network probably won't support broadcasts. Clients 
will be responsible for making their own DHCP requests.


I would think that it's more likely you'll run the gateway as a 
proxy. It will have to listen on the ethernet interface for any 
addresses leased by the devices, encapsulate the packets received and 
pass them to the relevant device via USB. Similarly it will need to 
poll the devices, collect any outbound packets, and resend them via 
the ethernet interface.

I suspect you will have to make the gateway do the initial leasing of 
addresses for the devices - this can be done (and the device informed 
of it's address) as you enumerate and configure each device. It will 
vastly simplify things if you don't have to deal with devices that 
don't yet have an address ! It may even be best to let the gateway 
manage the addressing -it can keep track of the address to device-id 
mapping more easily than sniffing for DHCP packets. You could ask the 
device during initialisation what parameters it needs. Leasing of 
addresses should be possible with the standard client - just use 
different client-ids (combine gateway MAC and device serial no ?)


Having said all that, this isn't really a DHCP issue.


More information about the dhcp-users mailing list