3

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

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Zoran
  • 161
  • 3
  • 10
  • 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 06 '12 at 14:53
  • Sorry, for that. I just look at the answers. I will fix immediately. Soory again – Zoran Nov 07 '12 at 06:17
  • It would be nice if you show the real records as I am not sure if what you show is real. – cstamas Nov 07 '12 at 06:34

2 Answers2

2

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.

cstamas
  • 6,707
  • 25
  • 42
1

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.

  • I'm not convinced that dhcpd will start without a dhcpd.leases file. I've read that you need to "touch dhcpd.leases" to create it and there may be times when you need to "sudo touch dhcpd.leases" so that the owner is root rather than yourself. – Michael Blankenship Sep 29 '15 at 17:56