How can I configure a DHCP server to assign addresses based on the OS that is running

Marc Chamberlin marc at marcchamberlin.com
Thu May 20 21:41:34 UTC 2010


Thanks Glenn for your reply, I am glad to hear you like "interesting" 
questions! Please bear with me, I am struggling to learn as I go along....

I inserted the line -

myvendor = option vendor-class-identifier;

near the top of my dhcpd.conf file and then took a close look at the 
dhcpd.leases file, but I am not seeing that it is producing anything 
different, and I got to admit I am confused about something else... The 
only info in the dhcpd.leases files seem to be just reports/info 
regarding dynamic dhcp IP address assignments. I do not see anything in 
the lease file that has any info regarding those systems to which I 
specify a static IP address. Is this correct? If so is there any way to 
query the dhcpd server and ask it what IP address and other info 
regarding assignments it has made? Or can this info be found somewhere 
else..

There is, for some systems but not all, a field called "client-hostname" 
that is reported for some of the leases for dynamic IP addresses that 
are assigned, but I have seen those reported before I added this new 
line to retrieve the vendor-class-identifier. If the "client-hostname" 
is what is supposed to be reported for the vendor-class-identifier then 
I am really confused!

I reconfigured the logging of the dhcpd server so as to send all its log 
output to a separate file, which seems to be working fine, and is much 
easier to use than sifting through the messages log file from the syslog 
daemon. But I am not seeing anything really useful in the log messages 
either regarding a vendor-class-identifier...


I read about, (didn't fully comprehend) the deny duplicates directive 
and added it to my dhcpd.conf file. But have not tested it yet so cannot 
say whether it is working or not.. Tricky trying to do some of this 
without disrupting our network and some of the servers...

     Marc...




On 5/19/2010 6:02 PM, Glenn Satchell wrote:
> Hi Marc
>
> Check out option vendor-class-identifier. You can see the values 
> returned by each client by adding something like this to dhcpd.conf, 
> then having a look at the values in dhcpd.leases for the value of 
> myvendor within each lease.
>
> myvendor = option vendor-class-identifier;
>
> You can use it to set membership of a class, or perhaps in a host 
> statement or group statement.
>
> class "MSFT" {
>   match if substring(option vendor-class-identifier, 0, 4) = "MSFT";
>   ...
> }
>
> host foo {
>   hardware ethernet a:b:c:d:e:f;
>   if substring(option vendor-class-identifier, 0, 4) = "MSFT" {
>     fixed-address 192.168.2.10;
>   } else {
>     fixed-address 192.168.2.15;
>   }
> }
>
> if substring(option vendor-class-identifier, 0, 4) = "MSFT" {
>   host foo-win-eth {
>     ...
>   }
>   host foo-win-wl {
>     ...
>   }
> } else {
>   host foo-linux-eth {
>     ...
>   }
>   host fpp-linux-wl {
>     ...
>   }
> }
>
> I haven't tested this out, but hopefully gives you some ideas to work 
> with.
>
> To get around the problem of switching between wired and wireless and 
> not releasing the old lease you can use the
>
> deny duplicates;
>
> statement, which is designed for this exact situation.
>
> Please let us know how you go, we love interesting questions like this!
>
> regards,
> -glenn
>
> On 05/20/10 07:49, Marc Chamberlin wrote:
>> I have a need to be able to assign fixed IP addresses to various
>> computers based on the operating system that is running, not based on
>> MAC addresses... The purpose of this is so that our backup server, which
>> automatically backs up files from each system, and can only work with
>> static IP addresses, has the ability to change it's behavior based on
>> which IP address/OS is used/running, when it connects to a particular
>> system. Our systems, are all dual boot, Linux and Windows (Vista or XP).
>> Laptops in particular are a problem because they can be connected
>> wirelessly or wired to our network, and it is unpredictable as to which
>> way they will be connected, or what operating system is in use, when the
>> backup occurs (usually late at night)....
>>
>> I am running a dhcp server on a Linux (SuSE11.2) system, - Internet
>> Systems Consortium DHCP Server V3.1.2p1
>>
>> So here is what I am after - For a given OS (Windows or Linux) running
>> on a client, I want the DHCP server to assign a particular IP address to
>> that client, regardless of which interface that client is using - wired
>> or wireless. But I want a different IP address assigned to that client
>> for each OS. For example, if the laptop is running Windows I want to
>> give the laptop the address of 192.168.2.15 regardless of whether it is
>> connected wirelessly or wired. If the laptop is running Linux I want to
>> give the laptop the address of 192.168.2.10, again regardless of how it
>> is connected to the network.
>>
>> I understand that I can configure the dhcpd.conf file so as to assign
>> the same IP address to a client, for each MAC address that it has, i.e.
>> as follows -
>>
>> host laptop_Vista_wireless {
>> hardware ethernet 00:1A:73:55:7D:0F;
>> fixed-address 192.168.2.15;
>> }
>>
>> host laptop_Vista_ethernet {
>> hardware ethernet 00:1B:24:3C:88:3E;
>> fixed-address 192.168.2.15;
>> }
>>
>> But that won't work for Linux since it will be using the same interfaces
>> with the same MAC addresses, and I need a different IP addressed assign
>> to that system when it is running Linux.
>>
>> With Linux I can set the dhcp client identifier, but I have never been
>> able to figure out how to do so in Windows XP or Vista. I have
>> discovered, by monitoring the dhcpd.leases file however, that there is
>> indeed a client identifier for each of the network interface cards when
>> running under Windows. Unfortunately it is not the same identifier for
>> both interfaces, nor is it human readable. But I can cut and paste it so
>> I have tried to configure the dhcpd.conf file as follows -
>>
>>
>> host laptop_Linux {
>> option dhcp-client-identifier "\000Linux-laptop";
>> fixed-address 192.168.2.10;
>> }
>>
>> host laptop_Vista_wireless {
>> option dhcp-client-identifier "\001\000\032sU}\017";
>> fixed-address 192.168.2.15;
>> }
>>
>> host laptop_Vista_ethernet {
>> option dhcp-client-identifier "\001\000\0266\302e\244";
>> fixed-address 192.168.2.15;
>> }
>>
>> And that gets me close but there is still a problem. If the user of the
>> laptop switches from using one of the interfaces to the other, the dhcp
>> server recognizes that there is still a lease on the IP address that it
>> assigned to the initial interface, used by the laptop, and it fails to
>> reassign that IP address to the new interface that the user switched to.
>> So some default IP address is assigned instead, which results in my
>> backup server failing to back up that system.
>>
>> I realize that there is an interesting question about what happens if a
>> user has both interfaces active when he/she connects to a network. I see
>> from log files that Linux will try and have the dhcp server assign an IP
>> address to each interface when it is activated/initialized. Since
>> Windows hides everything, I am not sure what it does or how it
>> prioritizes the usage of multiple interfaces. So I would appreciate some
>> insight here as well, if anyone really understands the behavior of these
>> operating systems.. But what I really want is that I have the ability to
>> assign a fixed IP address to whichever interface the OS will decide to
>> use.... And if I can assign the same IP address to each interface, then
>> it should not matter in the final analysis, since I would guess the OS
>> is only going to use one of the interfaces. (At least that is what it
>> appears Windows does, not so sure about Linux)
>>
>> I have tried to read the documentation and man pages, and fooled around
>> a bit with the conditional expressions but could never get that to work.
>> The documentation is pretty difficult and obtuse to understand so I give
>> up and decided to simply ask... So can some kind guru help me out and
>> show me how to configure dhcpd.conf so I can achieve what I am after?
>> Much appreciate it and many thanks in advance..
>>
>> Marc..
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20100520/8774f198/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6464 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20100520/8774f198/attachment.bin>


More information about the dhcp-users mailing list