1

I am trying to setup a DHCP sever with my Raspberry pi, but the service isc-dhcp-server cannot be restarted.

Why isn't the service being restarted?

ifconfig

eth0      Link encap:Ethernet  HWaddr X  
          inet6 addr: fe80::3d41:3edd:7319:617e/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth1      Link encap:Ethernet  HWaddr X  
          inet addr:169.254.6.116  Bcast:169.254.255.255  Mask:255.255.0.0
          inet6 addr: fe80::f16d:b76f:795e:d4ff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:299 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:40462 (39.5 KiB)  TX bytes:20406 (19.9 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:200 errors:0 dropped:0 overruns:0 frame:0
          TX packets:200 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:16656 (16.2 KiB)  TX bytes:16656 (16.2 KiB)

wlan0     Link encap:Ethernet  HWaddr X  
          inet addr:192.168.0.102  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::704a:b2ae:8ac9:48e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1022 errors:0 dropped:11 overruns:0 frame:0
          TX packets:726 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:125229 (122.2 KiB)  TX bytes:114072 (111.3 KiB)

/etc/network/interfaces

auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet dhcp
    address 192.168.2.1
    netmask 255.0.0.0

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/dhcp/dhcpd.conf

ddns-update-style none;
log-facility local7;

subnet 192.168.2.0 netmask 255.255.255.0 {

        option routers                  192.168.2.1;
        option subnet-mask              255.255.255.0;
        option broadcast-address        192.168.2.255;
        option domain-name-servers      194.168.2.1;
        option ntp-servers              192.168.2.1;
        option netbios-name-servers     192.168.2.1;
        option netbios-node-type 2;
        default-lease-time 86400;
        max-lease-time 86400;

        pool {
                range 192.168.2.2 192.168.2.254;
        }

        host gateway {
                hardware ethernet x;
                fixed-address 192.168.2.1;

        }

}

service isc-dhcp-server restart

Job for isc-dhcp-server.service failed. See 'systemctl status isc-dhcp-server.service' and 'journalctl -xn' for details.

systemctl status isc-dhcp-server.service

Mar 25 20:33:55 raspberrypi dhcpd[1146]: 
Mar 25 20:33:55 raspberrypi dhcpd[1146]: No subnet declaration for wlan0 (192.168.0.102).
Mar 25 20:33:55 raspberrypi dhcpd[1146]: ** Ignoring requests on wlan0.  If this is not what
Mar 25 20:33:55 raspberrypi dhcpd[1146]: you want, please write a subnet declaration
Mar 25 20:33:55 raspberrypi dhcpd[1146]: in your dhcpd.conf file for the network segment
Mar 25 20:33:57 raspberrypi isc-dhcp-server[1138]: Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed!
Mar 25 20:33:57 raspberrypi isc-dhcp-server[1138]: failed!
Mar 25 20:33:57 raspberrypi systemd[1]: isc-dhcp-server.service: control process exited, code=exited status=1
Mar 25 20:33:57 raspberrypi systemd[1]: Failed to start LSB: DHCP server.
Mar 25 20:33:57 raspberrypi systemd[1]: Unit isc-dhcp-server.service entered failed state

EDITED

/etc/default/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="eth1"
  • 1
    You don't have any network adapters talking to that subnet. Your WLAN port is not on 192.168.2.xxx, so it can't talk on it. You probably want to assign it to the fixed address 192.168.2.1, or assign one of the eth's, if that's what you are working towards. Do you have a INTERFACES line in /etc/default/isc-dhcp-server – infixed Mar 25 '16 at 19:57
  • @infixed - I have updated the question including the /etc/network/interfaces information. – Bob Mar 25 '16 at 20:02
  • 1
    well, two things. That /etc/network/interfaces leads off eth1 with a dhcp option. That's indicating it as a dhcp client. Set it up as static. Also, apparently the isc-dhcp-server depends on information in /etc/default/isc-dhcp-server that you have not shown yet. – infixed Mar 25 '16 at 20:07
1

in /etc/network/interfaces, you need to change the stanza for eth1 to look like

auto eth1
iface eth1 inet static
    address 192.168.2.1
    netmask 255.255.255.0

You seem to have /etc/default/isc-dhcp-server in hand now

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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