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 have OpenBSD 4.8 serving as Gateway & DHCP Server.

By mistake, when reinstalling one of the workstations (it is Windows 7) it gets the same name as it was before (i.e workstation-PC). So now I have in my /var/db/dhcpd.leases file two records with different IPs and same MAC address.

lease 172.32.100.185 {
starts 2 2012/11/06 13:10:58;
ends 4 2012/12/06 13:10:58;
hardware ethernet 00:1d:7d:00:54:ef;
uid 01:00:1d:7d:00:54:ef;
client-hostname "workstation-PC";
 }

And the old one workstation:

 lease 172.32.100.92 {
starts 2 2012/11/06 13:10:58;
ends 4 2012/12/06 13:10:58;
hardware ethernet 00:1d:7d:00:54:ef;
uid 01:00:1d:7d:00:54:ef;
client-hostname "workstation-PC";
 }

And I have that warning in /var/log/messages:

   dhcpd[12370]: client 00:1d:7d:00:54:ef has duplicate leases on LOCAL-NETWORK

I do not want to delete dhcpd.leases file and renew it because of one wrong settings, since that all other (Servers & workstations) will have changed (all are settled as dynamic not static addresses lease) IP and most of my colleagues will have to change a lot of settings in their local workstations.

My question is: Can I just simply delete faulty record, save & exit dhcpd.leases file or it will made some problems?

Or, is there any other method which I can use to remove faulty records without changing anything else?

Thanks in advance

share|improve this question
1  
Zoran, you've asked 7 questions, of which 4 have at least one anwer, yet you've accepted the answer to none of them. You accept an answer by clicking on the "tick" outline you see next to it, and that drives the SF reputation system both for you and the author the answer you think is best. Might I ask you to review some of your old questions, while you're waiting for an answer to this one? –  MadHatter Nov 6 '12 at 14:53
    
Sorry, for that. I just look at the answers. I will fix immediately. Soory again –  Zoran Nov 7 '12 at 6:17
    
It would be nice if you show the real records as I am not sure if what you show is real. –  cstamas Nov 7 '12 at 6:34
1  
Zoran: much better - thank you! –  MadHatter Nov 7 '12 at 7:19
    
Thanks, sorry again for mistake. –  Zoran Nov 7 '12 at 8:04
add comment

2 Answers 2

up vote 2 down vote accepted

I just wouldn't touch that file.

If you really want to do it then you can. Just don't edit it in place. At least stop the DHCP server when you edit the file. (and backup the file in advance).

On the other hand if you want DHCP handling out static addresses then you should do that in the config file. Then you can guarantee that each client gets the same address every time.

share|improve this answer
    
Thanks, I will do that. –  Zoran Nov 7 '12 at 7:46
add comment

If you want to store persistent dhcp leases configuration. Put this snippet configuration in /etc/dhcpd.conf

host workstation-PC {
    hardware ethernet 0:1d:7d:00:54:ef;
    fixed-address 172.32.100.185;
}

You can put this configuration for all Devices you want to do an IP reservation.

Next step is remove dhcp.leases file and restart dhcpd daemon. So, you can make that things happen wihout problems. If made, carefully, with the correct knownledge. For more information see dhcpd manpages.

share|improve this answer
add comment

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.