Two IPs on one NIC
jharan at Brocade.COM
Wed Sep 16 18:12:35 UTC 2009
> -----Original Message-----
> From: dhcp-users-bounces at lists.isc.org
> [mailto:dhcp-users-bounces at lists.isc.org] On Behalf Of Simon Hobson
> Sent: Wednesday, September 16, 2009 8:31 AM
> To: Users of ISC DHCP
> Subject: Re: Two IPs on one NIC
> Alan Buxey wrote:
> >does any DHCP client handle being given 2 addresses by DHCP?
> >I thought the original request asked for DHCP from 2 ranges
> to be given..
> >2 addresses can be handed out (and more!) from DHCPD but as
> far as I'm aware
> >the client will check which address is valid for the link its on and
> >then use it.... so unless its a case of 1 DHCP address and
> one static, then
> >cant see this working
> Wrong. Until the device is configured, it has no way of knowing what
> address/subnet might be valid - that's what DHCP is for. It is the
> server that will check which of several possible addresses are valid
> for the clients network and offer something appropriate.
> The problem is that the server could offer two different leases (but
> not in one offer message) - the client would simply pick one and
> ignore the other. There are two problems to be addressed - both need
> doing at the client and that means you might as well just manually
> configure the client !
> 1) The client need to make two requests, using different <something>
> so the server will treat them as <different> and offer two different
> leases. With the ISC server, the <something> would be client-id -
> either two different values, or one value and not-present.
> 2) having got two leases, the client would need to configure both
> addresses - that's going to require some significant hacking of the
> code to cope with all the permutations
> Simon Hobson
Just an FYI, I was able to run two dhcpcd client instances on the same linux machine (custom Brocade hardware platform) to accomplish this. Each client instance had to be passed a unique client ID on it's command line and likewise one was started up to service an interface name while the other was started up to service an interface alias, e.g. eth0 and eth0:0. The only other things that I can recall were to make sure each client instance locate it's data files in a separate directory, but that was just a command line option in the script that started them, and to modify the way the client generated it's XID so that each XID was unique. The unmodified dhcpcd client code generated it's XID using a hash of the MAC address and time(), which meant that each client generated the same XID which confused the servers big time. I just added the pid of the client process to what got hashed to make sure each client got it's own XID.
It turned out that this solution never shipped as product, but that was for other reasons. It seemed to work fine in the testing I did.
More information about the dhcp-users