Setting up DHCPD

pxe tftpd dhcpd advanced client identifier http

requirements

    dhcpd --version
    ifconfig | grep inet

setup

debian/ubuntu

    ls -lF /usr/share/doc/isc-dhcp-server/examples/dhcpd.conf.example
    mv -i /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.dist
    vi /etc/dhcp/dhcpd.conf # new file

slackware

    ls -lF /etc/dhcpd.conf.example
    mv -i /etc/dhcpd.conf /etc/dhcpd.conf.dist
    vi /etc/dhcpd.conf # new file

netbsd

    cp -pi /usr/share/examples/dhcp/dhcpd.conf /etc/dhcpd.conf.dist
    grep -vE '^#|^$' /etc/dhcpd.conf.dist > /etc/dhcpd.conf
    vi /etc/dhcpd.conf

shared MWE

default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
log-facility local7;

subnet UNUSED-IP netmask UNUNSED-NETMASK {
}

subnet 192.168.0.0 netmask 255.255.255.0 {
    range 192.168.0.50 192.168.0.99;
}

option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
# 208.67.222.222, 208.67.222.220;
#option domain-search "example.local", "nethence.com";
#option smtp-server x.x.x.x;
#option ntp-servers x.x.x.x;

next-server 192.168.0.x;
filename "pxelinux.0";

ready to go

debian/ubuntu

    dhcpd -t -cf /etc/dhcp/dhcpd.conf

    #ls -lF /var/lib/dhcp/dhcpd.leases
    #touch /var/lib/dhcp/dhcpd.leases

    #ln -s ../usr.sbin.dhcpd /etc/apparmor.d/disable/usr.sbin.dhcpd
    #systemctl restart apparmor

    systemctl status isc-dhcp-server6 # enabled
    systemctl stop isc-dhcp-server6
    systemctl disable isc-dhcp-server6

    systemctl status isc-dhcp-server # enabled
    systemctl restart isc-dhcp-server

slackware

check

    dhcpd -t -cf /etc/dhcpd.conf

start

    dhcpd -q eth0
    # -q NIC1 NIC2

status

    pgrep -a dhcpd

stop

    pkill dhcpd

rhel

    systemctl restart dhcpd

netbsd

    vi /etc/rc.conf

    dhcpd=yes
    dhcpd_flags="-q xennet1"

    /etc/rc.d/dhcpd start

additional notes

pools

tested on slackware

    grep ^lease /var/state/dhcp/dhcpd.leases | sort -V

    sbopkg -i uthash

    git clone git://git.code.sf.net/p/dhcpd-pools/code dhcpd-pools
    cd dhcpd-pools/
    ./bootstrap
    ./configure
    echo $MAKEFLAGS
    make
    make install

as cron job

    crontab -e

    0 12 * * * /usr/local/bin/dhcpd-pools --config=/etc/dhcpd.conf --leases=/var/state/dhcp/dhcpd.leases --color=never --format=text
    #--color=always

more options

    #server-name "DHCPserver";
    #server-identifier 10.1.1.253;
    #max-lease-time 7200;
    #default-lease-time 120;
    #max-lease-time 120;

    #option subnet-mask 255.255.255.0;

#option domain-name "example.local";

troubleshooting

wireshark filter

    !arp && !dns && !tcp && !icmp && !ntp

resources

dhcpd: any way to check dhcp pool status? https://unix.stackexchange.com/questions/39431/dhcpd-any-way-to-check-dhcp-pool-status

Command to list assigned dhcp addresses https://unix.stackexchange.com/questions/91799/command-to-list-assigned-dhcp-addresses/247514#247514

How do I show active dhcp leases https://askubuntu.com/questions/219609/how-do-i-show-active-dhcp-leases

ISC dhcpd lease analysis and reporting http://dhcpd-pools.sourceforge.net/

How do you have dhcpd reload its configuration file? https://kb.isc.org/docs/aa-00335

ISC dhcpd lease analysis and reporting http://dhcpd-pools.sourceforge.net/

options

dhcp-options - Dynamic Host Configuration Protocol options https://netbsd.gw.com/cgi-bin/man-cgi?dhcp-options+5

Options https://wiki.syslinux.org/wiki/index.php?title=PXELINUX#Options

Dynamic Host Configuration Protocol (DHCP) https://help.ubuntu.com/community/isc-dhcp-server

32.8. Diskless Operation with PXE https://docs.freebsd.org/en/books/handbook/network-diskless.html

syslinux

DHCP options https://wiki.syslinux.org/wiki/index.php?title=PXELINUX#DHCP_options

efi64

PXELINUX-Multi-Arch https://wiki.syslinux.org/wiki/index.php?title=PXELINUX-Multi-Arch

BIOS and UEFI Co-Existence https://wiki.fogproject.org/wiki/index.php/BIOS_and_UEFI_Co-Existence

[syslinux] RE: DHCP option 93 for UEFI https://www.syslinux.org/archives/2014-October/022683.html

Dynamic Host Configuration Protocol (DHCP) Options for the Intel Preboot eXecution Environment (PXE https://tools.ietf.org/html/rfc4578

DHCP boot options https://community.meraki.com/t5/Security-SD-WAN/DHCP-boot-options/td-p/44536

UEFI Mode PXE Booting Doesn’t Work https://superuser.com/questions/1182862/uefi-mode-pxe-booting-doesnt-work


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun