LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-26-2006, 02:54 PM   #1
dmellem
Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 42

Rep: Reputation: 15
dhcpd.conf overwritten. Can it be recovered?


Hi,

Someone accidentally overwrote our dhcpd.conf file so it's now 0 bytes long. The server is still running and DHCPD is still serving addresses. Is there any way to either recover the lost file from disk, or to dump the configuration from memory? It's running FC3.

Thanks a lot,

-Dan
 
Old 01-26-2006, 04:01 PM   #2
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
Why go through all that trouble ? Is it so hard to rewrite dchpd.conf ?
 
Old 01-26-2006, 04:12 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by dmellem
Hi,

Someone accidentally overwrote our dhcpd.conf file so it's now 0 bytes long. The server is still running and DHCPD is still serving addresses. Is there any way to either recover the lost file from disk, or to dump the configuration from memory? It's running FC3.

Thanks a lot,

-Dan
No, you can't do either. Just restore from a recent backup.


Cheers,
Tink
 
Old 01-26-2006, 04:25 PM   #4
dmellem
Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 42

Original Poster
Rep: Reputation: 15
We have a backup, but we've been making a lot of changes and backups have failed for a couple of weeks on this machine.

Quote:
Originally Posted by introuble
Why go through all that trouble ? Is it so hard to rewrite dchpd.conf ?
We have 10,000 nodes at 43 sites. There's quite a few printers and client machines with reserved addresses as well, plus we have special scopes for some of our VLANs.

-Dan
 
Old 01-26-2006, 04:56 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You should be able to extract data from the leases-file,
/var/state/dhcp/dhcpd.leases

Just be aware that there could be multiple entries for the
same MAC address, the closest to bottom one will be valid.

Good luck!


Cheers,
Tink
 
Old 01-26-2006, 05:25 PM   #6
dmellem
Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks, Tink. Unfortunately, the leases file doesn't keep track of reserved addresses, only those from the pools.

-Dan
 
Old 01-26-2006, 05:31 PM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Quote:
backups have failed for a couple of weeks on this machine.
I'd say off hand that you have some real problems in the making. Looks like you will need to make the file over unless you can restore from backup.
How did someone accidently delete that anyhow?
 
Old 01-26-2006, 05:43 PM   #8
dmellem
Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by homey
How did someone accidently delete that anyhow?
They were trying to copy the file off the machine and confused source and destination. (!)



One thing we're going to try, besides going back through our work logs, is to search the dhcpd log file for ACKs and then filtering out everything out of the pools. We'll then combine this with our old backup to find any reserved addresses that got lost. It's not perfect (we won't get the ones that haven't been on the network yet and we'll lose the comments) but should fill out anything else we've missed from the work requests.

Thanks,
-Dan
 
Old 01-26-2006, 06:07 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Another way of adding stuff with fixed-IPs (I've done that in
the past) is to resolve all hosts and filter out static ones
via script, then ping and arp to get their MAC addresses. I'm
quite anal about security, and only devices with known MACs got
a lease on that LAN. To create sections of a dhcpd.conf file from
the arp requests I used this:

Code:
less arp2dhcpd.awk 
#!/usr/bin/awk -f
{
  split( $1, chunks, ".")
  print "host " chunks[1] " {"
  print "       hardware ethernet " $3 " ;"
  print "       fixed-address " $1 " ;"
  print "}\n"

}
You get the idea ;}


Cheers,
Tink
 
Old 01-26-2006, 06:27 PM   #10
dmellem
Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 42

Original Poster
Rep: Reputation: 15
I like it. Thanks!

-Dan
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dhcpd subnet declaration problems in dhcpd.conf vcrispo Linux - Networking 6 07-15-2005 10:32 AM
/etc/resolv.conf being overwritten... detpenguin Slackware 4 04-12-2005 01:42 PM
Resolv.conf Overwritten jlcarmic Debian 2 05-27-2004 08:14 AM
resolv.conf overwritten LocHolmez Linux - Networking 2 09-22-2003 09:51 AM
dhcpd.master or dhcpd.conf rickg Linux - Networking 0 04-11-2002 03:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration