从源代码构建 DHCP 并尝试运行 DHCP 服务器时,出现错误。您知道问题可能出在哪里吗?建造从源还是缺少其他东西?如果从包中安装 DHCP 服务器 (sudo apt-get install isc-dhcp-server),则不会出现问题。
错误:
Jun 09 20:02:16 dhcpd[1531]: Unknown command -user
Jun 09 20:02:16 dhcpd[1531]: Usage: dhcpd [-p <UDP port #>] [-f] [-d] [-q] [-t|-T]
[-4|-6] [-cf config-file] [-lf lease-file]
[-tf trace-output-file]
[-play trace-input-file]
[-pf pid-file] [--no-pid] [-s server]
[if0 [...ifN]]
dhcpd {--version|--help|-h}
Jun 09 20:02:16 dhcpd[1531]:
Jun 09 20:02:16 dhcpd[1531]: If you think you have received this message due to a bug rather
Jun 09 20:02:16 dhcpd[1531]: than a configuration issue please read the section on submitting
Jun 09 20:02:16 dhcpd[1531]: bugs on either our web page at www.isc.org or in the README file
Jun 09 20:02:16 dhcpd[1531]: before submitting a bug. These pages explain the proper
Jun 09 20:02:16 dhcpd[1531]: process and the information we find helpful for debugging.
Jun 09 20:02:16 dhcpd[1531]:
Jun 09 20:02:16 dhcpd[1531]: exiting.
细节:
Ubuntu:16.04.6 LTS(Xenial Xerus)
从源构建 DHCP 的脚本:
#!/usr/bin/env bash
# Define variable
DHCP_VER="v4_4_2"
# Install libary for build DHCP server
sudo apt update && sudo apt -y full-upgrade
sudo apt -y install libtool build-essential autoconf automake g++
# Preparation
if ! [ -d ~/build ]; then
mkdir ~/build
fi
cd ~/build
git clone https://gitlab.isc.org/isc-projects/dhcp.git -b ${DHCP_VER}
cd ~/build/dhcp
autoreconf -i
CFLAGS="-D_PATH_DHCLIENT_SCRIPT='\"/sbin/dhclient-script\"' \
-D_PATH_DHCPD_CONF='\"/etc/dhcp/dhcpd.conf\"' \
-D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"'"
./configure --prefix=/usr \
--sysconfdir=/etc/dhcp \
--localstatedir=/var \
--with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
--with-srv6-lease-file=/var/lib/dhcpd/dhcpd6.leases \
--with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
--with-cli6-lease-file=/var/lib/dhclient/dhclient6.leases
# Make and install DHCP
make >make.out 2>&1
make install
exit 0
答案1
缺少配置属性。请添加启用偏执到配置标志。
./configure --enable-paranoia
--prefix=/usr \
--sysconfdir=/etc/dhcp \
--localstatedir=/var \
--with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
--with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
--with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
--with-cli6-lease-file=/var/lib/dhclient/dhclient6.leases