2

I'm trying to set up an ethernet DHCP server on a Raspberry Pi to connect one device via eth0 and give it an ip address, but I cannot for the life of me get the service to start.

This won't be an internet connected network so DNS and default gateway don't really matter but I don't know if DHCP needs these parameters to run.

Here are my setup files:

/etc/dhcp/dhcpd.conf

default-lease-time 600;
max-lease-time 7200;

option domain-name "submarine";
option domain-name-servers 8.8.8.8;

authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.10 192.168.1.100;
  option routers 192.168.1.120;
}

/etc/network/interfaces

#interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d #this file is empty

iface eth0 inet static
address 192.168.1.120
netmask 255.255.255.0
gateway 192.168.1.120

/etc/default/isc-dhcp-server

# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

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

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.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".
INTERFACESv4="eth0"
INTERFACESv6="eth0"

When I run sudo systemctl start isc-dhcp-server.service I get the following:

Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.

systemctl status isc-dhcp-server.service gives:

● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-07-24 22:21:19 CEST; 34s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2778 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

Jul 24 22:21:16 submarine systemd[1]: Starting LSB: DHCP server...
Jul 24 22:21:16 submarine isc-dhcp-server[2778]: Launching IPv4 server only.
Jul 24 22:21:17 submarine dhcpd[2790]: Wrote 0 leases to leases file.
Jul 24 22:21:19 submarine isc-dhcp-server[2778]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Jul 24 22:21:19 submarine isc-dhcp-server[2778]:  failed!
Jul 24 22:21:19 submarine systemd[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
Jul 24 22:21:19 submarine systemd[1]: Failed to start LSB: DHCP server.
Jul 24 22:21:19 submarine systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Jul 24 22:21:19 submarine systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.

journalctl -xe gives:

Jul 24 22:13:12 submarine dhcpd[2319]: 
Jul 24 22:13:12 submarine dhcpd[2319]: If you think you have received this message due to a bug rather
Jul 24 22:13:12 submarine dhcpd[2319]: than a configuration issue please read the section on submitting
Jul 24 22:13:12 submarine dhcpd[2319]: bugs on either our web page at www.isc.org or in the README file
Jul 24 22:13:12 submarine dhcpd[2319]: before submitting a bug.  These pages explain the proper
Jul 24 22:13:12 submarine dhcpd[2319]: process and the information we find helpful for debugging..
Jul 24 22:13:12 submarine dhcpd[2319]: 
Jul 24 22:13:12 submarine dhcpd[2319]: exiting.
Jul 24 22:13:14 submarine isc-dhcp-server[2307]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Jul 24 22:13:14 submarine isc-dhcp-server[2307]:  failed!
Jul 24 22:13:14 submarine systemd[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
Jul 24 22:13:14 submarine systemd[1]: Failed to start LSB: DHCP server.
-- Subject: Unit isc-dhcp-server.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit isc-dhcp-server.service has failed.
-- 
-- The result is failed.
Jul 24 22:13:14 submarine systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Jul 24 22:13:14 submarine systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Jul 24 22:13:14 submarine sudo[2301]: pam_unix(sudo:session): session closed for user root
Jul 24 22:13:52 submarine sudo[2355]:       pi : TTY=pts/0 ; PWD=/etc/network ; USER=root ; COMMAND=/bin/nano /etc/dhcp/dhcpd.conf
Jul 24 22:13:52 submarine sudo[2355]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 24 22:14:57 submarine sudo[2355]: pam_unix(sudo:session): session closed for user root
Jul 24 22:15:08 submarine sudo[2417]:       pi : TTY=pts/0 ; PWD=/etc/network ; USER=root ; COMMAND=/bin/systemctl start isc-dhcp-server.service
Jul 24 22:15:08 submarine sudo[2417]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 24 22:15:09 submarine systemd[1]: Starting LSB: DHCP server...
-- Subject: Unit isc-dhcp-server.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit isc-dhcp-server.service has begun starting up.
Jul 24 22:15:09 submarine isc-dhcp-server[2423]: Launching IPv4 server only.
Jul 24 22:15:09 submarine dhcpd[2435]: Wrote 0 leases to leases file.
Jul 24 22:15:09 submarine dhcpd[2435]: Can't bind to dhcp address: Address already in use
Jul 24 22:15:09 submarine dhcpd[2435]: Please make sure there is no other dhcp server
Jul 24 22:15:09 submarine dhcpd[2435]: running and that there's no entry for dhcp or
Jul 24 22:15:09 submarine dhcpd[2435]: bootp in /etc/inetd.conf.   Also make sure you
Jul 24 22:15:09 submarine dhcpd[2435]: are not running HP JetAdmin software, which
Jul 24 22:15:09 submarine dhcpd[2435]: includes a bootp server.
Jul 24 22:15:09 submarine dhcpd[2435]: 
Jul 24 22:15:09 submarine dhcpd[2435]: If you think you have received this message due to a bug rather
Jul 24 22:15:09 submarine dhcpd[2435]: than a configuration issue please read the section on submitting
Jul 24 22:15:09 submarine dhcpd[2435]: bugs on either our web page at www.isc.org or in the README file
Jul 24 22:15:09 submarine dhcpd[2435]: before submitting a bug.  These pages explain the proper
Jul 24 22:15:09 submarine dhcpd[2435]: process and the information we find helpful for debugging..
Jul 24 22:15:09 submarine dhcpd[2435]: 
Jul 24 22:15:09 submarine dhcpd[2435]: exiting.
Jul 24 22:15:09 submarine kernel: i2c-bcm2835 3f804000.i2c: i2c transfer timed out
Jul 24 22:15:11 submarine isc-dhcp-server[2423]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Jul 24 22:15:11 submarine isc-dhcp-server[2423]:  failed!
Jul 24 22:15:11 submarine systemd[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
Jul 24 22:15:11 submarine systemd[1]: Failed to start LSB: DHCP server.
-- Subject: Unit isc-dhcp-server.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit isc-dhcp-server.service has failed.
-- 
-- The result is failed.
Jul 24 22:15:11 submarine systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Jul 24 22:15:11 submarine systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Jul 24 22:15:11 submarine sudo[2417]: pam_unix(sudo:session): session closed for user root
Jul 24 22:15:12 submarine kernel: i2c-bcm2835 3f804000.i2c: i2c transfer timed out

The mentioned /etc/inetd.conf file does not exist and I am not running HP JetAdmin software. There shouldn't be any other DHCP services running but I don't really know how to check. They certainly aren't giving out any IP addresses that's for sure.

And lastly, ipconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.120  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::8783:fe04:df10:98e3  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:1d:79:7b  txqueuelen 1000  (Ethernet)
        RX packets 4  bytes 1060 (1.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1264  bytes 71378 (69.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2688  bytes 223552 (218.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2688  bytes 223552 (218.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

This has been driving me nuts for like two days, I've run down 5 or 6 DHCP tutorials with no luck. Any help would be greatly appreciated. Thanks!

15
  • For checking for DHCP service, just check the listen IPv4 and the associated DHCP server port : 67. sudo ss -ln|grep ":67", if the output is empty then no server is listenning on this address and port , else , you got the address already in use message.
    – Ephemeral
    Commented Jul 25, 2019 at 11:52
  • before running your dhcp server, try: sudo systemctl stop networking, sudo kill -9 $(pidof dhcpd) and then start your server service isc-dhcp-server.service
    – Ephemeral
    Commented Jul 25, 2019 at 11:56
  • Thanks, tried the ss command it but it returns empty. Tried so stop networking and kill dhcpd but it didn't make any difference. Oddly enough I cannot find dhcpd on the list of services at all with service --status-all. The only related service is dhcpcd and it's disabled. Commented Jul 25, 2019 at 11:59
  • You're welcome , maybe try to disable Ipv6 : sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 ?
    – Ephemeral
    Commented Jul 25, 2019 at 12:01
  • Tried to disable ipv6, seems like it gives me an additional error of i2c transfer timed out. Commented Jul 25, 2019 at 12:06

1 Answer 1

4

If you have dnsmasq installed you can verify with:

sudo netstat -laputeno|grep 67

If it is the case:

sudo systemctl disable dnsmasq
sudo systemctl stop dnsmasq
sudo systemctl start isc-dhcp-server

should work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.