View Issue Details

IDProjectCategoryView StatusLast Update
0003633Kali LinuxGeneral Bugpublic2016-10-11 20:33
ReporterHarbinger Assigned Tog0tmi1k  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionwon't fix 
Product Version2016.2 
Summary0003633: The file '/var/lib/dhcp/dhcpd.leases' does not exist by default upon installation of isc-dhcp-server
Description

Upon running: 'apt-get install isc-dhcp-server', the file at /var/lib/dhcp/dhcpd.leases does not exist.

Steps To Reproduce

apt-get install isc-dhcp-server
dhcpd -cf /etc/dhcp/dhcpd.conf at0

Activities

Harbinger

Harbinger

2016-09-27 20:28

reporter   ~0006000

Last edited: 2016-09-27 22:08

===============
Operating System: Kali Rolling 2016.2 i686, PWK VM with VMware Fusion

===============
Purpose: Set up DHCP server in Kali

===============
Reference: https://www.offensive-security.com/metasploit-unleashed/karmetasploit-configuration/

===============
Steps to Reproduce:

  1. Acquire karma.txt file
    root@kali:~# wget https://www.offensive-security.com/wp-content/uploads/2015/04/karma.rc_.txt
    --2016-09-27 14:54:22-- https://www.offensive-security.com/wp-content/uploads/2015/04/karma.rc_.txt
    Resolving www.offensive-security.com (www.offensive-security.com)
    ... snip ...

  2. Install DHCP server
    root@kali:~# apt-get install isc-dhcp-server
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    ... snip ...

  3. Edit /etc/dhcp/dhcp.conf as follows
    root@kali:~# cat /etc/dhcp/dhcpd.conf

    dhcpd.conf

    #

    Sample configuration file for ISC dhcpd

    #

option domain-name-servers 10.0.0.1;

default-lease-time 60;
max-lease-time 72;

ddns-update-style none;

authoritative;

log-facility local7;

subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.254;
option routers 10.0.0.1;
option domain-name-servers 10.0.0.1;
}

  1. Install required ruby gems
    root@kali:~# gem install activerecord sqlite3
    Successfully installed activerecord-5.0.0.1
    Parsing documentation for activerecord-5.0.0.1
    Done installing documentation for activerecord after 5 seconds
    ... snip ...
    note: the guide above says to install sqlite3-ruby, which has since been renamed.

  2. Start airmon-ng
    root@kali:~# airmon-ng start wlan0
    PHY Interface Driver Chipset
    phy0 wlan0 ath9k_htc Atheros Communications, Inc. AR9271 802.11n
    (mac80211 monitor mode vif enabled for [phy0]wlan0 on [phy0]wlan0mon)
    (mac80211 station mode vif disabled for [phy0]wlan0)

  3. Start airbase-ng
    root@kali:~# airbase-ng -P -C 30 -e "U R PWND" -v wlan0mon
    15:11:21 Created tap interface at0
    15:11:21 Trying to set MTU on at0 to 1500
    15:11:21 Trying to set MTU on wlan0mon to 1800
    ... snip ...

  4. Put up at0 interface
    root@kali:~# ifconfig at0 up 10.0.0.1 netmask 255.255.255.0

  5. Try to start dhcpd (FAILURE)
    root@kali:~# dhcpd -cf /etc/dhcp/dhcpd.conf at0
    Internet Systems Consortium DHCP Server 4.3.4
    Copyright 2004-2016 Internet Systems Consortium.
    All rights reserved.
    For info, please visit https://www.isc.org/software/dhcp/
    Config file: /etc/dhcp/dhcpd.conf
    Database file: /var/lib/dhcp/dhcpd.leases
    PID file: /var/run/dhcpd.pid
    Can't open lease database /var/lib/dhcp/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 think you have received this message due to a bug rather
    than a configuration issue please read the section on submitting
    bugs on either our web page at www.isc.org or in the README file
    before submitting a bug. These pages explain the proper
    process and the information we find helpful for debugging..
    exiting.

  6. Create required file
    root@kali:~# touch /var/lib/dhcp/dhcpd.leases

  7. Start dhcpd (SUCCESS)
    root@kali:~# dhcpd -cf /etc/dhcp/dhcpd.conf at0
    Internet Systems Consortium DHCP Server 4.3.4
    Copyright 2004-2016 Internet Systems Consortium.
    All rights reserved.
    For info, please visit https://www.isc.org/software/dhcp/
    Config file: /etc/dhcp/dhcpd.conf
    Database file: /var/lib/dhcp/dhcpd.leases
    PID file: /var/run/dhcpd.pid
    Wrote 0 leases to leases file.
    Listening on LPF/at0/00:c0:ca:82:d9:63/10.0.0.0/24
    Sending on LPF/at0/00:c0:ca:82:d9:63/10.0.0.0/24
    Sending on Socket/fallback/fallback-net

  8. Check running processes
    root@kali:~# ps aux |grep dhcpd
    root 3486 0.0 0.2 13904 5884 ? Ss 15:12 0:00 dhcpd -cf /etc/dhcp/dhcpd.conf at0
    root 3489 0.0 0.0 4636 788 pts/2 S+ 15:12 0:00 grep dhcpd

g0tmi1k

g0tmi1k

2016-10-11 20:33

administrator   ~0006054

Closing as this is by design.

In step 8, with the error:
"""
Can't open lease database /var/lib/dhcp/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.
""

Man page: https://linux.die.net/man/5/dhcpd.leases

"""
When dhcpd is first installed, there is no lease database. However, dhcpd requires that a lease database be present before it will start. To make the initial lease database, just create an empty file called /var/lib/dhcpd/dhcpd.leases. You can do this with:

touch /var/lib/dhcpd/dhcpd.leases

"""

Issue History

Date Modified Username Field Change
2016-09-27 16:30 Harbinger New Issue
2016-09-27 20:28 Harbinger Note Added: 0006000
2016-09-27 22:08 Harbinger Note Edited: 0006000
2016-10-11 20:33 g0tmi1k Note Added: 0006054
2016-10-11 20:33 g0tmi1k Status new => closed
2016-10-11 20:33 g0tmi1k Assigned To => g0tmi1k
2016-10-11 20:33 g0tmi1k Resolution open => won't fix