DHCP can't write to dhcpd.leases

Ok,

I am trying to set up a dhcp server with Suse 11.2 I have written my dhcpd.conf file to store leases at /var/log/dhcpd/dhcpd.leases.

When I run, service dhcpd restart, I get the following error:


mario:/etc/sysconfig # /sbin/service dhcpd start
Starting DHCP server Internet Systems Consortium DHCP Server V3.1.2p1
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Can't open lease database /var/log/dhcpd/dhcpd.leases: No such file or directory --
  check for failed database rewrite attempt!
Please read the dhcpd.leases manual page if you
don't know what to do about this.

If you did not get this software from ftp.isc.org, please
get the latest from ftp.isc.org and install that before
requesting help.

If you did get this software from ftp.isc.org and have not
yet read the README, please read it before requesting help.
If you intend to request help from the dhcp-server@isc.org
mailing list, please read the section on the README about
submitting bug reports and requests for help.

Please do not under any circumstances send requests for
help directly to the authors of this software - please
send them to the appropriate mailing list as described in
the README file.

exiting.
                                                                                                     failed

I ran touch var/log/dhcpd/dhcpd.leases to create the file and have verified that it is there. Here is a copy of my dhcpd.conf file:


#
#   DHCP Server Config File
#

ddns-update-style interim;
lease-file-name "/var/log/dhcpd/dhcpd.leases";
#log-facility local6; # log to /var/log/dhcpd.leases (see /etc/syslog.conf)
authoritative;


option domain-name                      "m.com";
default-lease-time                      86400;   # 24 hours
max-lease-time                          172800;  # 48 hours

subnet 172.20.254.0 netmask 255.255.255.0 {
        option routers                  172.20.254.1;
        option subnet-mask              255.255.255.0;
#        option broadcast-address        192.168.1.255;
        option domain-name-servers      172.20.254.1;
#        option ntp-servers              192.168.1.1;
#        option netbios-name-servers     192.168.1.1;
#        option netbios-node-type        8;
#        range   172.20.254.15   172.20.254.30;  #for non-mac's to connect
}

host woman {
  hardware ethernet 00:19:21:d4:4e:86;
  fixed-address 172.20.254.3;
  option host-name "woman.m.com";
}

host printer {
hardware ethernet 00:20:00:70:e4:95;
 fixed-address 172.20.254.5;
option host-name "printer.m.com";
}

host laptop {
hardware ethernet 00:24:d6:73:d1:0c;
 fixed-address 172.20.254.9;
 option host-name "laptop.m.com";
}



Any ideas on what I should try?

On Thu May 13 2010 10:56 pm, itsamemario wrote:

>
> Ok,
>
> I am trying to set up a dhcp server with Suse 11.2 I have written my
> dhcpd.conf file to store leases at /var/log/dhcpd/dhcpd.leases.
>
> When I run, service dhcpd restart, I get the following error:
>
>
> Code:
> --------------------
>
> mario:/etc/sysconfig # /sbin/service dhcpd start
> Starting DHCP server Internet Systems Consortium DHCP Server V3.1.2p1
> Copyright 2004-2009 Internet Systems Consortium.
> All rights reserved.
> For info, please visit http://www.isc.org/sw/dhcp/
> Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not
specified in the config file
> Can’t open lease database /var/log/dhcpd/dhcpd.leases: No such file or
directory –
> check for failed database rewrite attempt!
> Please read the dhcpd.leases manual page if you
> don’t know what to do about this.
>
> If you did not get this software from ftp.isc.org, please
> get the latest from ftp.isc.org and install that before
> requesting help.
>
> If you did get this software from ftp.isc.org and have not
> yet read the README, please read it before requesting help.
> If you intend to request help from the dhcp-server@isc.org
> mailing list, please read the section on the README about
> submitting bug reports and requests for help.
>
> Please do not under any circumstances send requests for
> help directly to the authors of this software - please
> send them to the appropriate mailing list as described in
> the README file.
>
> exiting.
> failed
>
> --------------------
>
>
> I ran touch var/log/dhcpd/dhcpd.leases to create the file and have
> verified that it is there. Here is a copy of my dhcpd.conf file:
>
>
> Code:
> --------------------
>
> #
> # DHCP Server Config File
> #
>
> ddns-update-style interim;
> lease-file-name “/var/log/dhcpd/dhcpd.leases”;
> #log-facility local6; # log to /var/log/dhcpd.leases
(see /etc/syslog.conf)
> authoritative;
<snip>
>
>
> Any ideas on what I should try?
>
itsamemario;

What happens if you just let it use the default location:

/var/lib/dhcp/db/dhcpd.leases

By default dhcpd runs in a non-root chroot jail in /var/lib/dhcp.
See:
/usr/share/doc/packages/dhcp-server/README.SuSE


P. V.
“We’re all in this together, I’m pulling for you.” Red Green

Yes, it’s probably like venzkep writes. Why do you want to change the lease file location? Besides /var/log is for log files, not for operational data like the lease file.

Ok, I changed the lease location and retried to start the service. I got this error message:

Can’t open lease database /var/lib/dhcp/db/dhcpd.leases: No such file or directory –

I ran /var/lib/dhcp/db/dhcp.leases. I just opened it and this is inside it:

The format of this file is documented in the dhcpd.leases(5) manual page.

This lease file was written by isc-dhcp-V3.1.2p1

Any ideas? I need to get this to work?

On Fri May 14 2010 01:26 pm, itsamemario wrote:

>
> Ok, I changed the lease location and retried to start the service. I got
> this error message:
>
> Can’t open lease database /var/lib/dhcp/db/dhcpd.leases: No such file
> or directory –
>
>
> I ran /var/lib/dhcp/db/dhcp.leases. I just opened it and this is inside
> it:
>
> # The format of this file is documented in the dhcpd.leases(5) manual
> page.
> # This lease file was written by isc-dhcp-V3.1.2p1
>
> Any ideas? I need to get this to work?
>
>
itsamemario;

When you changed the location did you specify “lease-file-name”
in /etc/dhcpd.conf? If so comment that out ( or remove it), you do not need
to specify this parameter. dhcpd will just default to
using /var/lib/dhcp/db/dhcpd.leases. Not sure why setting that parameter to
the default would harm, but just in case don’t specify it.

What are the permissions on: /var/lib/dhcp/db/
and /var/lib/dhcp/db/dhcpd.leases including owner and owning group?

Are you using apparmor? If so disable while testing this.

Have you changed permissions to secure or paranoid?

I also noted that the range statement in the /etc/dhcpd.conf you posted is
commented out. Do you really mean that?

It might help to look over the examples and information in:
/usr/share/doc/packages/dhcp-server


P. V.
“We’re all in this together, I’m pulling for you.” Red Green

Again, why do you want to specifically set it to that value? dhcpd has sensible defaults. You don’t have to specify this, it will use the default.

But the reason you are not able to create it is because dhcpd normally runs chrooted, so the real location would then be at /var/lib/dhcp/var/lib/dhcp/db/dhcp.leases.

Just remove your declaration and it will work. It’s not meant to be this hard.

Ok, I think I am making this to hard. Here is my dhcpd.conf


#
#   DHCP Server Config File
#

ddns-update-style interim;
#lease-file-name "/var/lib/dhcp/db/dhcpd.leases";
#log-facility local6; # log to /var/log/dhcpd.leases (see /etc/syslog.conf)
authoritative;


option domain-name                      "gonzales.com";
default-lease-time                      86400;   # 24 hours
max-lease-time                          172800;  # 48 hours

subnet 172.20.254.0 netmask 255.255.255.0 {
        option routers                  172.20.254.1;
        option subnet-mask              255.255.255.0;
#        option broadcast-address        192.168.1.255;
        option domain-name-servers      172.20.254.1;
#        option ntp-servers              192.168.1.1;
#        option netbios-name-servers     192.168.1.1;
#        option netbios-node-type        8;
#        range   172.20.254.15   172.20.254.30;  #for non-mac's to connect
}

host laura {
  hardware ethernet 00:19:21:d4:4e:86;
  fixed-address 172.20.254.3;
  option host-name "laura.gonzales.com";
}

host printer {
hardware ethernet 00:20:00:70:e4:95;
 fixed-address 172.20.254.5;
option host-name "printer.gonzales.com";
}

host laptop {
hardware ethernet 00:24:d6:73:d1:0c;
 fixed-address 172.20.254.9;
 option host-name "laptop.gonzales.com";
}




I commented out the lease file names and get this error message:

Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.

No subnet declaration for eth1 (0.0.0.0).
** Ignoring requests on eth1.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface eth1 is attached. **


Not configured to listen on any interfaces!

I am going to do more look but my inlaws are in. I do not uderstand why I only get this when the lease file location is not specified.

That’s because when you specify the leases file, that error is so serious that it doesn’t get a chance to get this far! So now that we have solved that problem you created yourself, the real problem is that your host declarations are not inside the subnet declaration. So move that closing } after the commented out range line to the end of the file.

Ok, I made changes to the dhcpd.conf file.


#   DHCP Server Config File


ddns-update-style interim;
default-lease-time                      86400;   # 24 hours
max-lease-time                          172800;  # 48 hours
authoritative;


subnet 172.20.254.0 netmask 255.255.255.0 {
         option routers                  172.20.254.1;
#        option subnet-mask              255.255.255.0;
#        option broadcast-address        192.168.1.255;
#        option domain-name-servers      172.20.254.1;
#        option ntp-servers              192.168.1.1;
#        option netbios-name-servers     192.168.1.1;
#        option netbios-node-type        8;
       range   172.20.254.3   172.20.254.30;  #for non-mac's to connect


host laura {
  hardware ethernet 00:19:21:d4:4e:86;
  fixed-address 172.20.254.3;
  option host-name "laura.gonzales.com";
}

host printer {
hardware ethernet 00:20:00:70:e4:95;
 fixed-address 172.20.254.5;
option host-name "printer.gonzales.com";
}

host laptop {
hardware ethernet 00:24:d6:73:d1:0c;
 fixed-address 172.20.254.9;
 option host-name "laptop.gonzales.com";
}

}

I am still getting the error message that says:


No subnet declaration for eth1 (0.0.0.0).
** Ignoring requests on eth1.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface eth1 is attached. **

I still have no idea what I am doing wrong. Eth0 is set to a static IP. What does eth1 need to be set to?

Which interface do you intend to serve DHCP on, eth1 or eth0? If eth0, then you should change the interface in /etc/sysconfig/dhcpd. And the IP range you want should be within the subnet of that interface.

You realise there is a YaST module for setting up DHCP server? It suffices for simple setups. The package needed is yast2-dhcp-server. You probably need to restore /etc/dhcpd.conf to the original if you decide to use this.