Re: NetReg: Deleting Leases

New Message Reply Date view Thread view Subject view Author view Attachment view

From: valianp@southwestern.edu
Date: Thu Jul 08 2004 - 16:32:07 CDT


Jeff...I fail to see the point of your script. The dhcpd.leases is just for the
dhcp server to remember what IP it gave to whom. Deleting anything from this
file just makes the server forget what IP it assigned the last time that MAC
requested an IP.

If you don't remove the MAC from the dhcpd.conf file (actually the
dhcpd.conf.new file) then the dhcp server will continue to grant the MAC an IP
the next time it asks for one as it did before but since it doesn't remember
what it gave before (because that MAC isn't in its leases file) it will just
give it the next free IP (I believe it goes from highest in the range to
lowest...supposedly pinging the address to make sure no rouge machine is
already using that address).

Most likely the client requesting the IP will get the same one it had last time
anyway (even if it is not in the leases file). I believe the client will
request the same IP it had last time and the dhcp server can NACK it and do its
own OFFER if its leases file shows that IP is already leased...if not, it'll
ACK on the request and OFFER the IP it wants.

Of course this is all the way I understand it is supposed to work...what it does
in the real world I can't attest to. I know that ISC made it clear in the
documentation that you should never alter the leases file (other than wiping it
completely out and only then after you have shutdown the server). And I have
to say I see no reason why you would even want to alter the leases file.

-p

Quoting "Jeff A. Earickson" <jaearick@colby.edu>:

> Hi,
> My perl script takes whatever input file you give it (the lease file
> you want to mess with) does its thing, and writes the output to another
> file that you define on the command line. The idea here is:
>
> * you can compare the output to the input, eg diff, to see that you
> got what you wanted.
>
> * you are NOT scribbling onto your real lease file. You are making
> a new file that you will move into place by hand.
>
> If you make the input file and the output file the same (especially if
> both are your real lease file) then you will trash your input in typical
> UNIX fashion. Don't do this...
>
> Once you are convinced that the output is what you want, then:
>
> 1) shut down dhcpd
> 2) run the script
> 3) move the old lease file out of the way and put the new lease file
> in place
> 4) restart dhcpd and use something like clease.pl to check.
>
> Jeff Earickson
> Colby College
>
> On Thu, 8 Jul 2004, Tim Tyler wrote:
>
> > Date: Thu, 08 Jul 2004 15:17:35 -0500
> > From: Tim Tyler <tyler@beloit.edu>
> > Reply-To: netreg@southwestern.edu
> > To: netreg@southwestern.edu
> > Subject: Re: NetReg: Deleting Leases
> >
> > Jeff,
> > Ok, I am interested in this topic as well. I used your script and it
> > seems that it may be working fine. I need a couple clarifications though.
> > 1. Removing leases is one thing, but forcing new registrations is
> > another. Do I need to manually delete entries at the bottom of dhcpd.conf
> > in order to force new registrations (dhcpd.conf.new,
> > dhcpd.conf.bak)? While your script seems to handle dhcpd.leases, its not
> > clear how one should handle dhcpd.conf.
> >
> > 2. While I presume that the input file is
> > /var/state/dhcp/dhcpd.leases what is the output file for? Is that what I
> > should use to over write dhcpd.leases?
> >
> > 3. Should dhcpd deamon be shut down while running this script?
> >
> > Thanks. -Tim
> >
> > At 08:17 AM 7/6/2004, you wrote:
> > >Hi,
> > > I wrote a perl script a while back that will clean the lease file.
> > >It writes output to a specified file elsewhere. Questions? Write back.
> > >Script is attached.
> > >
> > >Jeff Earickson
> > >Colby College
> > >
> > >On Tue, 6 Jul 2004, David Davis wrote:
> > >
> > > > Date: Tue, 6 Jul 2004 08:40:35 -0400
> > > > From: David Davis <dddavis@rmwc.edu>
> > > > Reply-To: netreg@southwestern.edu
> > > > To: netreg@southwestern.edu
> > > > Subject: NetReg: Deleting Leases
> > > >
> > > > Morning,
> > > >
> > > > Is there any easy way to delete all of the leases on NetReg? Can I
> just
> > > > clear the dhcpd entries and force new registrations on the system?
> > > >
> > > > D. David Davis III
> > > > Network Manager
> > > > Information Technology Department
> > > > Randolph-Macon Woman's College
> > > > dddavis@rmwc.edu
> > > >
> > > >
> >
> > Tim Tyler
> > Network Engineer - Beloit College
> > tyler@beloit.edu
> >
> > **********************************************************************
> > To unsubscribe from this list, send an e-mail message to
> > majordomo@southwestern.edu containing a single line with the words:
> > unsubscribe netreg
> > Send requests for assistance to: owner-netreg@southwestern.edu
> > **********************************************************************
> >
> **********************************************************************
> To unsubscribe from this list, send an e-mail message to
> majordomo@southwestern.edu containing a single line with the words:
> unsubscribe netreg
> Send requests for assistance to: owner-netreg@southwestern.edu
> **********************************************************************
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg
Send requests for assistance to: owner-netreg@southwestern.edu
**********************************************************************


New Message Reply Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:46 CDT