Linux/dhcpd

From Omnia
Jump to navigation Jump to search

dnsmasq

See dnsmasq

udhcpd

# Ubuntu 16 and 20 - udhcpd
apt install dhcpd

/etc/udhcpd.conf

start           10.0.0.10
end             10.0.0.20
interface       eth0

opt     dns     10.0.0.1 10.0.0.2
option  subnet  255.255.255.0
opt     router  10.0.0.1
#option dns     10.0.0.3   # appened to above DNS servers for a total of 3
option  domain  lab
option  lease   864000          # 10 days of seconds

# PXE
siaddr          10.0.0.1
boot_file       boot.pxe

Enable it here:

/etc/default/udhcpd

# Comment the following line to enable
DHCPD_ENABLED="yes"

# Options to pass to busybox' udhcpd.
#
# -S    Log to syslog
# -f    run in foreground

DHCPD_OPTS="-S"

Default /etc/udhcpd.conf:

start           192.168.0.20    #default: 192.168.0.20
end             192.168.0.254   #default: 192.168.0.254
interface       eth0            #default: eth0
opt     dns     192.168.10.2 192.168.10.10
option  subnet  255.255.255.0
opt     router  192.168.10.2
opt     wins    192.168.10.10
option  dns     129.219.13.81   # appened to above DNS servers for a total of 3
option  domain  local
option  lease   864000          # 10 days of seconds

PXE

/etc/udhcpd.conf:

start           192.168.0.20
end             192.168.0.254
interface       eno2

siaddr          192.168.0.2
boot_file       ipxe

opt     dns     192.168.0.2
option  subnet  255.255.255.0
opt     router  192.168.0.2
option  domain  local
option  lease   864000
service udhcpd stop
service udhcpd start
service udhcpd status

Watch log /var/log/syslog

Sample logs:

pxeserver  udhcpd[14595]: Sending OFFER of 192.168.0.31
pxeserver  udhcpd[14595]: Sending ACK to 192.168.0.31
pxeserver  in.tftpd[24396]: remap: input: ipxe
pxeserver  in.tftpd[24396]: remap: done
pxeserver  in.tftpd[24396]: RRQ from 192.168.0.31 filename ipxe
pxeserver  in.tftpd[24396]: tftp: client does not accept options
pxeserver  in.tftpd[24397]: remap: input: ipxe
pxeserver  in.tftpd[24397]: remap: done
pxeserver  in.tftpd[24397]: RRQ from 192.168.0.31 filename ipxe
pxeserver  udhcpd[14595]: Sending OFFER of 192.168.0.31

EFI PXE

keywords