NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: dhcpd(8) and unused or old MAC addresses



rockyhotas%firemail.cc@localhost writes:

> II{R,U}C, dhcpd(8) actually uses a pseudo-static IP assigment policy:
> it tries to relate the same MAC address always to the same IP address.
> I have a NetBSD 9.0 machine which acts as DHCP server and it seems to
> behave exactly this way.

This is true.

> However, there are some MAC addresses (which "reserve" an IP address in
> the dhcp IP range) that are no more present in my local network: for
> example, some devices that are no more used, or some other devices that
> (after a software update: sometimes it happens, at least with mobile
> phones) changed the MAC address of their NICs.

True.

> Is there a way to "free" their entries, to let dhcpd(8) forget about
> them, so that the relative IP addresses are re-usable? Each device
> which receives an IP address is recorded in /var/db/dhcpd.leases. Is it
> enough to manually delete its entry in that database file, or some
> other operation is needed?

This works and I do it all the time.

Edit the file and delete the specific lease.  Then restart dhcpd.
However, I am unclear on when it writes the lease file and if it reads
it other than at startup.   I think it reads it on startup, and then the
working copy in RAM is what counts and it writes it when it issues a
lease.   So if you write/restart without a lease renewal, this works.

Best practice is surely to stop the daemon, edit, and restart.


But basically you shouldn't care, unless you want your IP address space
tidy.  If that's what you want, then you probably should configure your
dhcpd:

  a range of only part fo your network, e.g. for /24 only put 128-254 in
  the pool

  statically assign (NOT in the pool!) in dhcpcd addresses to specific
  devices based on IP address or client-id (you can steal these lines
  from the lease file) organized in some way that makes senes to you,
  like a block of 8 or 10 for one persons phone-type devices, a block
  for accees points, etc.

  periodically review what's in the lease file and assign static or hunt
  it down and disconnect it


The basic expression is

  host foo {
    hardware ethernet bar;
    fixed-address 192.168.100.11;
  }


My dhcpd.conf is large, but it's not really complicated.

After you edit and restart, make sure it's running because it will fail
to start on syntax error and you will notice hours later when devices
can't get leases.


Home | Main Index | Thread Index | Old Index