Isc-dhcp-server--error: No subnet declaration (no IPv4 addresses).

来自三线的随记

Environment informations:

root@devBoard:/etc/default# cat /etc/issue && uname -a && cat /proc/version 
Ubuntu 16.04.3 LTS \n \l

Linux devBoard 3.10.65 #55 SMP PREEMPT Fri Nov 18 16:17:28 CST 2016 aarch64 aarch64 aarch64 GNU/Linux
Linux version 3.10.65 (orange@orange-All-Series) (gcc version 4.9.3 20150113 (prerelease) (Linaro GCC 4.9-2015.01-3) ) #55 SMP PREEMPT Fri Nov 18 16:17:28 CST 2016


error logs:

Jan 30 18:39:14 devBoard systemd[1]: Started ISC DHCP IPv4 server.
Jan 30 18:39:14 devBoard dhcpd[12973]: Internet Systems Consortium DHCP Server 4.3.3
Jan 30 18:39:14 devBoard sh[12973]: Internet Systems Consortium DHCP Server 4.3.3
Jan 30 18:39:14 devBoard dhcpd[12973]: Copyright 2004-2015 Internet Systems Consortium.
Jan 30 18:39:14 devBoard dhcpd[12973]: All rights reserved.
Jan 30 18:39:14 devBoard sh[12973]: Copyright 2004-2015 Internet Systems Consortium.
Jan 30 18:39:14 devBoard sh[12973]: All rights reserved.
Jan 30 18:39:14 devBoard sh[12973]: For info, please visit https://www.isc.org/software/dhcp/
Jan 30 18:39:14 devBoard dhcpd[12973]: For info, please visit https://www.isc.org/software/dhcp/
Jan 30 18:39:14 devBoard dhcpd[12973]: Config file: /etc/dhcp/dhcpd.conf
Jan 30 18:39:14 devBoard sh[12973]: Config file: /etc/dhcp/dhcpd.conf
Jan 30 18:39:14 devBoard sh[12973]: Database file: /var/lib/dhcp/dhcpd.leases
Jan 30 18:39:14 devBoard sh[12973]: PID file: /run/dhcp-server/dhcpd.pid
Jan 30 18:39:14 devBoard dhcpd[12973]: Database file: /var/lib/dhcp/dhcpd.leases
Jan 30 18:39:14 devBoard sh[12973]: Wrote 5 leases to leases file.
Jan 30 18:39:14 devBoard dhcpd[12973]: PID file: /run/dhcp-server/dhcpd.pid
Jan 30 18:39:14 devBoard dhcpd[12973]: Internet Systems Consortium DHCP Server 4.3.3
Jan 30 18:39:14 devBoard dhcpd[12973]: Copyright 2004-2015 Internet Systems Consortium.
Jan 30 18:39:14 devBoard dhcpd[12973]: All rights reserved.
Jan 30 18:39:14 devBoard dhcpd[12973]: For info, please visit https://www.isc.org/software/dhcp/
Jan 30 18:39:14 devBoard dhcpd[12973]: Wrote 5 leases to leases file.
Jan 30 18:39:14 devBoard dhcpd[12973]: 
Jan 30 18:39:14 devBoard dhcpd[12973]: No subnet declaration for enx00e04c36033d (no IPv4 addresses).
Jan 30 18:39:14 devBoard sh[12973]: No subnet declaration for enx00e04c36033d (no IPv4 addresses).
Jan 30 18:39:14 devBoard sh[12973]: ** Ignoring requests on enx00e04c36033d.  If this is not what
Jan 30 18:39:14 devBoard sh[12973]:    you want, please write a subnet declaration
Jan 30 18:39:14 devBoard sh[12973]:    in your dhcpd.conf file for the network segment
Jan 30 18:39:14 devBoard sh[12973]:    to which interface enx00e04c36033d is attached. **
Jan 30 18:39:14 devBoard sh[12973]: Not configured to listen on any interfaces!
Jan 30 18:39:14 devBoard sh[12973]: If you think you have received this message due to a bug rather
Jan 30 18:39:14 devBoard sh[12973]: than a configuration issue please read the section on submitting
Jan 30 18:39:14 devBoard sh[12973]: bugs on either our web page at www.isc.org or in the README file
Jan 30 18:39:14 devBoard sh[12973]: before submitting a bug.  These pages explain the proper
Jan 30 18:39:14 devBoard sh[12973]: process and the information we find helpful for debugging..
Jan 30 18:39:14 devBoard sh[12973]: exiting.
Jan 30 18:39:14 devBoard dhcpd[12973]: ** Ignoring requests on enx00e04c36033d.  If this is not what
Jan 30 18:39:14 devBoard systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
Jan 30 18:39:14 devBoard dhcpd[12973]:    you want, please write a subnet declaration
Jan 30 18:39:14 devBoard systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Jan 30 18:39:14 devBoard dhcpd[12973]:    in your dhcpd.conf file for the network segment
Jan 30 18:39:14 devBoard systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Jan 30 18:39:14 devBoard dhcpd[12973]:    to which interface enx00e04c36033d is attached. **
Jan 30 18:39:14 devBoard dhcpd[12973]: 
Jan 30 18:39:14 devBoard dhcpd[12973]: 
Jan 30 18:39:14 devBoard dhcpd[12973]: Not configured to listen on any interfaces!
Jan 30 18:39:14 devBoard dhcpd[12973]: 
Jan 30 18:39:14 devBoard dhcpd[12973]: If you think you have received this message due to a bug rather
Jan 30 18:39:14 devBoard dhcpd[12973]: than a configuration issue please read the section on submitting
Jan 30 18:39:14 devBoard dhcpd[12973]: bugs on either our web page at www.isc.org or in the README file
Jan 30 18:39:14 devBoard dhcpd[12973]: before submitting a bug.  These pages explain the proper
Jan 30 18:39:14 devBoard dhcpd[12973]: process and the information we find helpful for debugging..
Jan 30 18:39:14 devBoard dhcpd[12973]: 
Jan 30 18:39:14 devBoard dhcpd[12973]: exiting.


Key informations:

 No subnet declaration for enx00e04c36033d (no IPv4 addresses).


reason

root@devBoard:/etc/default# cat isc-dhcp-server 
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid

# Additional options to start dhcpd with.
#	Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#	Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="enx00e04c36033d"


复盘

root@devBoard:/etc/default# cat /lib/systemd/system/isc-dhcp-server.service 
[Unit]
Description=ISC DHCP IPv4 server
Documentation=man:dhcpd(8)
Wants=network-online.target
After=network-online.target
After=time-sync.target
ConditionPathExists=/etc/default/isc-dhcp-server
ConditionPathExists=|/etc/ltsp/dhcpd.conf
ConditionPathExists=|/etc/dhcp/dhcpd.conf

[Service]
EnvironmentFile=/etc/default/isc-dhcp-server
RuntimeDirectory=dhcp-server
# The leases files need to be root:dhcpd even when dropping privileges
ExecStart=/bin/sh -ec '\
    CONFIG_FILE=/etc/dhcp/dhcpd.conf; \
    if [ -f /etc/ltsp/dhcpd.conf ]; then CONFIG_FILE=/etc/ltsp/dhcpd.conf; fi; \
    [ -e /var/lib/dhcp/dhcpd.leases ] || touch /var/lib/dhcp/dhcpd.leases; \
    chown root:dhcpd /var/lib/dhcp /var/lib/dhcp/dhcpd.leases; \
    chmod 775 /var/lib/dhcp ; chmod 664 /var/lib/dhcp/dhcpd.leases; \
    exec dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf $CONFIG_FILE $INTERFACES'

[Install]
WantedBy=multi-user.target


可以看到 ConditionPathExists 配置项