Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I re-framed my question for better clarity

http://serverfault.com/questions/110835/automatic-allocation-on-windows-dhcp-server

Is there a way to configure dhcp server to give same ip address to NIC cards. i am not asking for static IP. i am fine with any ip being allocated to any NIC but once it is assigned it should assign same ip all the time.

i am looking for a solution where i would not have to add an entry every time i attach a new machine to the subnet. is there a configuration which would make dhcp server remember what ip address was allocated to the NIC for the first time and automatically reserve that IP address for all the times.

Why i need this?

I need to get IP address associated with the MAC address, which i already know. Now one way of doing it is send a broacast ping to the LAN, and then from the ARP table fetch the ip address. however between the time i send a broadcast ping, and read the ARP entry there is a possibility of some machine restarting and getting assigned new IP address.

My objective is to keep everything dynamic with no user intervention, and also robust to prevent swapping of ip addresses.

share|improve this question
    
Most DHCP servers will do this by default. Are you using a Windows Server for DHCP? –  Cory J Feb 6 '10 at 1:48
1  
I don't think the Windows one does, I think it prefers the lowest (or highest, but I think it is lowest) currently unassigned pool IP for the pending lease. –  David Mackintosh Feb 6 '10 at 5:17
    
I'm more interested in why you need to do this. I suspect that if there is an underlying reason why which could be worked around or circumvented entirely, it may be a more viable approach. –  Darth Satan Feb 6 '10 at 21:48
    
i answered your question, in the edit –  Kazoom Feb 8 '10 at 18:32

3 Answers 3

up vote 4 down vote accepted

Perhaps the best way to achieve the results you want is to set a very long lease time on the DHCP leases.

share|improve this answer

Sure - what you want is called a DHCP reservation. The mechanics of creating the reservation differs depending on what DHCP server you're running. In any case, you will need to give the DHCP server the MAC address of the target network card and then tell it what IP address you want it to hand out to that device.

share|improve this answer
    
yeah i am aware of that, but i am looking for a solution where i would not have to add an entry every time i attach a new machine to the subnet. is there a configuration which would make dhcp server remember what ip address was allocated to the NIC for the first time and automatically reserve that IP address for all the times. –  Kazoom Feb 6 '10 at 1:54
3  
You could probably script something with powershell to monitor for new leases and then create a reservation for it. Short of that, though, about the best you can do is just set a really long lease time for your scope. –  EEAA Feb 6 '10 at 1:58

Depends on the DHCP server.

The ISC dhcpd server (which comes with most Linux distributions) seems to keep track of what MACs have been assigned what IPs, and only scavenges from previously-but-not-currently-assigned when there's no other choice.

I don't believe the Microsoft-provided DHCP server does that, you end up having to do reservations or have ridiculously long lease times and risk running out of available addresses.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.