I've been following this tutorial from Ubuntu to set up a DHCP server on my machine, but I just can't get it work. When I run
sudo systemctl restart isc-dhcp-server.service
sudo systemctl status isc-dhcp-server.service
it gives me the error status failed
, and the following output in /var/log/syslog
:
systemd[1303]: gnome-launched-code.desktop-6211.scope: Succeeded.
Apr 20 18:51:20 dragonfly systemd[1]: Started ISC DHCP IPv4 server.
Apr 20 18:51:20 dragonfly dhcpd[6757]: Internet Systems Consortium DHCP Server 4.4.1
Apr 20 18:51:20 dragonfly sh[6757]: Internet Systems Consortium DHCP Server 4.4.1
Apr 20 18:51:20 dragonfly sh[6757]: Copyright 2004-2018 Internet Systems Consortium.
Apr 20 18:51:20 dragonfly sh[6757]: All rights reserved.
Apr 20 18:51:20 dragonfly sh[6757]: For info, please visit https://www.isc.org/software/dhcp/
Apr 20 18:51:20 dragonfly dhcpd[6757]: Copyright 2004-2018 Internet Systems Consortium.
Apr 20 18:51:20 dragonfly dhcpd[6757]: All rights reserved.
Apr 20 18:51:20 dragonfly dhcpd[6757]: For info, please visit https://www.isc.org/software/dhcp/
Apr 20 18:51:20 dragonfly dhcpd[6757]: Config file: /etc/dhcp/dhcpd.conf
Apr 20 18:51:20 dragonfly sh[6757]: Config file: /etc/dhcp/dhcpd.conf
Apr 20 18:51:20 dragonfly sh[6757]: Database file: /var/lib/dhcp/dhcpd.leases
Apr 20 18:51:20 dragonfly sh[6757]: PID file: /run/dhcp-server/dhcpd.pid
Apr 20 18:51:20 dragonfly dhcpd[6757]: Database file: /var/lib/dhcp/dhcpd.leases
Apr 20 18:51:20 dragonfly sh[6757]: Wrote 0 leases to leases file.
Apr 20 18:51:20 dragonfly dhcpd[6757]: PID file: /run/dhcp-server/dhcpd.pid
Apr 20 18:51:20 dragonfly dhcpd[6757]: Wrote 0 leases to leases file.
Apr 20 18:51:20 dragonfly dhcpd[6757]:
Apr 20 18:51:20 dragonfly sh[6757]: No subnet declaration for eth4 (no IPv4 addresses).
Apr 20 18:51:20 dragonfly sh[6757]: ** Ignoring requests on eth4. If this is not what
Apr 20 18:51:20 dragonfly sh[6757]: you want, please write a subnet declaration
Apr 20 18:51:20 dragonfly sh[6757]: in your dhcpd.conf file for the network segment
Apr 20 18:51:20 dragonfly sh[6757]: to which interface eth4 is attached. **
Apr 20 18:51:20 dragonfly sh[6757]: Not configured to listen on any interfaces!
Apr 20 18:51:20 dragonfly sh[6757]: If you think you have received this message due to a bug rather
Apr 20 18:51:20 dragonfly sh[6757]: than a configuration issue please read the section on submitting
Apr 20 18:51:20 dragonfly sh[6757]: bugs on either our web page at www.isc.org or in the README file
Apr 20 18:51:20 dragonfly sh[6757]: before submitting a bug. These pages explain the proper
Apr 20 18:51:20 dragonfly sh[6757]: process and the information we find helpful for debugging.
Apr 20 18:51:20 dragonfly sh[6757]: exiting.
Apr 20 18:51:20 dragonfly dhcpd[6757]: No subnet declaration for eth4 (no IPv4 addresses).
Apr 20 18:51:20 dragonfly dhcpd[6757]: ** Ignoring requests on eth4. If this is not what
Apr 20 18:51:20 dragonfly dhcpd[6757]: you want, please write a subnet declaration
Apr 20 18:51:20 dragonfly dhcpd[6757]: in your dhcpd.conf file for the network segment
Apr 20 18:51:20 dragonfly dhcpd[6757]: to which interface eth4 is attached. **
Apr 20 18:51:20 dragonfly dhcpd[6757]:
Apr 20 18:51:20 dragonfly dhcpd[6757]:
Apr 20 18:51:20 dragonfly dhcpd[6757]: Not configured to listen on any interfaces!
Apr 20 18:51:20 dragonfly dhcpd[6757]:
Apr 20 18:51:20 dragonfly dhcpd[6757]: If you think you have received this message due to a bug rather
Apr 20 18:51:20 dragonfly dhcpd[6757]: than a configuration issue please read the section on submitting
Apr 20 18:51:20 dragonfly dhcpd[6757]: bugs on either our web page at www.isc.org or in the README file
Apr 20 18:51:20 dragonfly dhcpd[6757]: before submitting a bug. These pages explain the proper
Apr 20 18:51:20 dragonfly dhcpd[6757]: process and the information we find helpful for debugging.
Apr 20 18:51:20 dragonfly dhcpd[6757]:
Apr 20 18:51:20 dragonfly dhcpd[6757]: exiting.
Apr 20 18:51:20 dragonfly systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 20 18:51:20 dragonfly systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Apr 20 18:52:39 dragonfly PackageKit: daemon quit
Apr 20 18:52:39 dragonfly systemd[1]: packagekit.service: Succeeded.
I guess the relevant part of the error code is this:
No subnet declaration for eth4 (no IPv4 addresses).
Ignoring requests on eth4. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface eth4 is attached.
Does anyone know what to do with this?
I also found this related question, but it is quite old, and I am still confused.
Edit:
/etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.150 192.168.1.200;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example";
}
/etc/default/isc-dhcp-server
INTERFACESv4="eth4"
Output of ip addr
:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether f0:2f:74:dd:bb:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.240/24 brd 192.168.0.255 scope global dynamic noprefixroute enp4s0
valid_lft 4978sec preferred_lft 4978sec
inet6 fe80::8452:bb97:94cd:6ea6/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlo1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 7c:50:79:76:23:f2 brd ff:ff:ff:ff:ff:ff
altname wlp0s20f3