Removing an entry from dhcp.leases

A couple of days ago I removed a hostname/ip for a mac address from
foreman, then created a new host name and entry with that mac address in
foreman.

Centos 6 Foreman 1.7.1 running dhcp server for my flat IPv4 address space.

However when I look into my dhcp.leases file this morning I see that the
old hostname is still there and is assigning the old IP/Hostname to that
MAC.

How is that foreman generates this file and can it be forced to remove an
entry?

When I use hammer I cannot see the old hostname for that mac, only the new
one.

Thanks,

On further investigation I am wondering if my new hosts are not being added
to the dhcp.leases file at all. That is whatever mechanism that foreman
uses to update dhcp does not seem to be working. None of the hosts I added
yesterday have been added to the leases file, nor as above has that older
host been removed.

These issues started happening when I upgraded from 1.4 so perhaps there is
something that I am not running now that I need to?

Apparently my dhcp.yml file got reverted to not manage it, or at least that
is what appears to be the case.

··· --- # Enable DHCP management :enabled: true # valid vendors: # - isc # - native_ms (Microsoft native implementation) # - virsh (simple implementation for libvirt) # The vendor can be either isc or native_ms :dhcp_vendor: isc # dhcp_subnets is a Native MS implementation setting. It restricts the subnets queried to a # subset, so as to reduce the query time. #:dhcp_subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128] # Settings for Ubuntu ISC #:dhcp_config: /etc/dhcp3/dhcpd.conf #:dhcp_leases: /var/lib/dhcp3/dhcpd.leases # Settings for Redhat ISC :dhcp_config: /etc/dhcpd.conf :dhcp_leases: /var/lib/dhcpd/dhcpd.leases

Hopefully I will see updates to the leases file now.

Just to followup, I am not getting any new hosts that I create to appear in
my dhcpd.leases file. However any existing systems, if they are not already
there, are not being created in the file.

Is there a way to force the creation of these entries without recreating
all of my hosts?

Sorry that is NOW getting any new hosts that I create to appear.

··· On Friday, January 9, 2015 at 2:12:52 PM UTC-8, Terrence Martin wrote: > > > Just to followup, I am now getting any new hosts that I create to appear > in my dhcpd.leases file. However any existing systems, if they are not > already there, are not being created in the file. > > Is there a way to force the creation of these entries without recreating > all of my hosts? >

>
> Just to followup, I am not getting any new hosts that I create to appear
> in my dhcpd.leases file. However any existing systems, if they are not
> already there, are not being created in the file.
>
> Is there a way to force the creation of these entries without recreating
> all of my hosts?
>

Ohad

··· On Sat, Jan 10, 2015 at 12:12 AM, Terrence Martin wrote:


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

> Sorry that is NOW getting any new hosts that I create to appear.

Hello,

are you aware how ISC DHCP manages data in the leases file? It only
appends to the file, it never modifies existing entries. Read the
dhcpd.leases man page for more info.

··· -- Later, Lukas #lzap Zapletal

Actually that is not really accurate. The leases file can get entries that
remove the previous entry and on the next update the old one is removed. I
have seen this first hand while fiddling.

I took advantage of this by changing and then changing back the IP mapping
of all of my new hosts so that they then appeared correctly in the file.

From the man page

  In order to prevent the lease database from growing without bound,

the file is rewritten from time to time.

Terrence

··· On Tue, Jan 13, 2015 at 4:35 AM, Lukas Zapletal wrote:

Sorry that is NOW getting any new hosts that I create to appear.

Hello,

are you aware how ISC DHCP manages data in the leases file? It only
appends to the file, it never modifies existing entries. Read the
dhcpd.leases man page for more info.


Later,
Lukas #lzap Zapletal


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/aS-fL1rO08Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

> In order to prevent the lease database from growing without bound,
> the file is rewritten from time to time.

What I said is really correct. It never modifies, it only appends.

What you have here is the rewrite scenario when it reads the old file
dropping all the unnecessary records and creating (appending) a new
(temp) file which is then renamed back. This is for data consistency.

But this is really nitpicking. It does this every start, so you can
really modify what you want and restart the server to get the desired
behavior. Then it happens every hour or something.

··· -- Later, Lukas #lzap Zapletal