[Dnsmasq-discuss] [Fwd: Re: Dnsmasq and host with 2 network interfaces]

Simon Kelley simon@thekelleys.org.uk
Sun, 12 Dec 2004 18:04:40 +0000


A private conversation which I'm posting to the mailing list with the 
permission of all involved for future reference.

Cheers,

Simon.

-------- Original Message --------
Subject: Re: Dnsmasq and host with 2 network interfaces
Date: Thu,  9 Dec 2004 08:04:07 +0100
From: Clemens Ender <ender@sbox.tugraz.at>
To: Simon Kelley <simon@thekelleys.org.uk>
References: <20041207233208.vin4jugxhc8ws0c0@webmail.tugraz.at> 
<41B630B2.2040804@thekelleys.org.uk>

Quoting Simon Kelley <simon@thekelleys.org.uk>:

> Clemens Ender wrote:
>> Hi,
>>
>> I'm trying to setup a dnsmasq for my LAN. It's a very nice piece of 
>> software and
>> it works very well, however I'm stuck with a little detail. I have a 
>> notebook
>> which has a ethernet- and a wifi-card builtin. Usually I connect to 
>> my LAN via
>> the wireless card, but sometimes I wanna connect it via the ethernet 
>> card. Is
>> it possible to have the IP and/or hostname "follow" the notebook.
>>
>> Thanks for your help in advance!
>>
>> Cheers,
>>   Clemens Ender
>>
>>
>>
>>
>>
>
> It should be possible: the key is something called a "client-id" which
> is what the DHCP server uses to identify a machine.
>
> Normally the client-id set to be the same as the MAC address by the DHCP
> client, or not set at all, in which case the DHCP server falls back to
> using the MAC address. This gives the familiar effect where an DHCP
> lease and IP get bound to the MAC address.
>
> Most DHCP clients (on Linux/Unix, anyway) have a way to set the
> client-ID. Dhcpcd, for instance, uses the -I flag.
>
> You can bind a hostname/IP to a client-ID in dnsmasq.conf like this:
>
> dhcp-host=id:<client-id>,1.2.3.4,<hostname>
>
> The client-ID can be given either as hex bytes, like a MAC address, or
> as a string.
>

Hi Somon,

Thanks a lot for your ultra-quick response! Of course I immediately tried it
out, and after some attempts it finally worked. The actual problem was 
Windows
XP (should have mentioned, that my Notebook is a dual-boot "WindowsXP vs.
Debian" machine). I had to do some hard googling to find out that there is a
registry-tweak to set the DHCP client identifier being sent to the DHCP 
server
when issuing a DHCP request.

There has to be a registry key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\<NIC
GUID>\DhcpClientIdentifier

which is a REG_DWORD value specifiying the client ID. It's sent in reverse
byte-order, meaning that the value 0x01020304 is sent as "04:03:02:01".

(also see: http://www.jsiinc.com/SUBF/TIP2800/rh2845.htm)

Now I just have to try to "emulate" this behaviour with a dhcp-client
for Debian
and hope that it can be integrated into ifup/ifdown mechanism.

Thanks for your help,
   Clemens