Koozali.org: home of the SME Server

Greedy Windows/PXE grabbing all the DHCP leases

Offline misnerspace

  • *
  • 58
  • +0/-0
Greedy Windows/PXE grabbing all the DHCP leases
« on: February 20, 2010, 01:43:14 AM »
Hi All,

Recently I have come across a but of a problem involving DHCP leases to Windows and PXE.

Presently most of my workstations boot up using PXE; the DHCP server responds to the DHCPDISCOVER message by giving the workstation (via PXE) an IP address.

The workstation then proceeds to boot up into Windows, windows then sends a DHCPDISCOVER message and the DHCP server gives the workstation  a new IP address thinking that it is a new workstation, although it has the same MAC address.

Here's a little snippet from the dhcp.leases file which illustrates the problem.

Code: [Select]
lease 192.168.1.82 {
  starts 5 2010/02/19 07:48:20;
  ends 6 2010/02/20 07:48:20;
  binding state active;
  next binding state free;
  hardware ethernet e0:cb:4e:b4:5f:c8;
}

lease 192.168.1.164 {
  starts 5 2010/02/19 08:02:43;
  ends 6 2010/02/20 08:02:43;
  binding state active;
  next binding state free;
  hardware ethernet e0:cb:4e:b4:5f:c8;
  uid "\001\340\313N\264_\310";
  client-hostname "COM-05";
}

Note that the same MAC address has two different IP addresses, I assume one was given to PXE and one to Windows on the same workstation.

I thought of trying the following workaround as outlined in the contribs Wiki http://wiki.contribs.org/Dhcpd_lease_time

But, I assume this will substantially increase network chatter if I change the default-lease-time to a much lower number (so as to free up the IPs allocated via PXE to the workstations once they have booted up.

I found out that there is a
Code: [Select]
deny duplicates keyword which can be used in your dhcpd.conf file.

Quote
Host declarations can match client messages based on the DHCP Client Identifier option or based on the client's network hardware type and MAC address. If the MAC address is used, the host declaration will match any client with that MAC address - even clients with different client identifiers. This doesn't normally happen, but is possible when one computer has more than one operating system installed on it - for example, Microsoft Windows and NetBSD or Linux.

The duplicates flag tells the DHCP server that if a request is received from a client that matches the MAC address of a host declaration, any other leases matching that MAC address should be discarded by the server, even if the UID is not the same. This is a violation of the DHCP protocol, but can prevent clients whose client identifiers change regularly from holding many leases at the same time. By default, duplicates are allowed.

I checked mine and there is no such option, although I'm not sure if it will help if it was included.

Code: [Select]
#------------------------------------------------------------
#        !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------


# Addresses from 192.168.1.250 to 192.168.1.250 taken for PPTP sessions


authoritative;
ddns-update-style none;
option wpad-url code 252 = text;

subnet 192.168.1.0 netmask 255.255.255.0
{
    option broadcast-address    192.168.1.255;
allow bootp;
    option domain-name "xxxxxxxxxxxxxxx";
    option domain-name-servers 192.168.1.1;
    default-lease-time          86400;
    max-lease-time              604800;
    option netbios-dd-server    192.168.1.1;
    option netbios-name-servers 192.168.1.1;
    option netbios-node-type    8;
    option subnet-mask          255.255.255.0;
    range    192.168.1.65 192.168.1.249;
    option routers 192.168.1.1;
    option wpad-url            "http://wpad.xxxxxxxxxxxxx/wpad.dat";

    next-server 192.168.1.xxx;
    filename "/pxelinux.0";
}

So I have 3 options:

  • Do nothing
  • Change the lease time to a small number (noisy network)
  • Screw around with the dhcpd.conf file (I'm really not comfortable with this)

Any top tips/workaroundx would be most helpful as IP addresses are a premium on my network at the moment as in effect I have only about 255/2.

Thanks!

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Greedy Windows/PXE grabbing all the DHCP leases
« Reply #1 on: February 20, 2010, 04:25:26 PM »
Did you configure your server for hostname based DHCP handling? IMHO if MAC based was used (which should be the normal case IIRC), the same IP should apply for PXE boot as well as for assignment when in Windows.

Are you sure the assumption of one being PXE an the other windows assigned IP addresses? Are you sure boot time takes nearly 15 min?

I would not bother too much on the network chatter if you reduce your lease time. This is a relatively small part of traffic on the network.

As a workaround, a forth option is to choose a wider range for DHCP assigned IP addresses. If you already use a full subnet, you should choose a 'wider' subnet combined with extening the DHCP IP range and you should be fine again, but I think you should try and find out why so much leases are handed out.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Greedy Windows/PXE grabbing all the DHCP leases
« Reply #2 on: February 20, 2010, 05:34:31 PM »
maybe you could use LAT to insert all your mac addresses into "hostnames and adresses" table.. in this way 1 mac = 1 ip address

maybe .. :-)

Offline misnerspace

  • *
  • 58
  • +0/-0
Re: Greedy Windows/PXE grabbing all the DHCP leases
« Reply #3 on: February 21, 2010, 10:41:23 AM »
Hi Cactus and Stefano,

Thanks for getting back to me. I think the time delay between PXE and Windows XP is because quite often I use FOG to re image the computers. PXE gets an IP address, the transfers the control to FOG which reimages the computer and then reboots it into XP. It is only an assumption though, it seems to be all the computers with PXE that are gobbling up IP addresses

Is there a way of rebuilding the dhcp.leases file? i.e. reset the whole thing so it rebuilds an upto date list?

In terms of configuring the server, I used the defaults. If I wanted to extend the range of IP addresses would it be as simple as entering say 192.168.2.250 in the end of DHCP host number range in the admin console? (My range starts from 192.168.1.65)

thanks!

Offline johnp

  • *****
  • 312
  • +0/-0
Re: Greedy Windows/PXE grabbing all the DHCP leases
« Reply #4 on: February 21, 2010, 03:20:01 PM »
The subnet mask determines the amount of hosts on your network. In your case /24 i.e. 255.255.255.0 gives you the network of 192.168.1.0 with hosts from 1 to 254. By changing to /23 i.e. 255.255.254.0 your network would become 192.168.0.0 with hosts ranging from 192.168.0.1-192.168.1.254.

So the answer is, in your case it may require a bit more work.