1

I'm trying to use isc-dhcp-server on an Ubuntu 14.04 machine as my DHCP server rather than the DHCP service offered by router. My set up is below.

I got everything set up OK and when I turned off the router's DHCP, I was pleased that everything worked: machines that connect to the router are assigned IP addresses in the range defined in my dhcpd.conf file. I did however find it strange that the router showed a public IP address for the Ubuntu machine instead of the 10.0.0.2 address defined in its /etc/network/interfaces. In fact, the IP address assigned is not even a private address! It starts with 169 not 10, 192 or 172. The IP address works; I can SSH in no problem. The whole thing fails however when I reboot the router& DHCP server.

When I reboot, I don't see an IP address for the Ubuntu machine in the router's interface anymore. Not surprisingly, DHCP doesn't work either: machines that connect to the router don't get IP addresses. When I re-enable DHCP on the router, the Ubuntu DHCP server gets the 10.0.0.2 IP address as expected. When I SHH into it I find that isc-dhcp-server isn't running. I can start it of course, and then the whole cycle repeats. (FWIW: I've previously seen an error message when I try to restart isc-dhcp-server saying that I haven't defined a subnet for that weird public IP address the Ubuntu DHCP server gets. I wasn't able to reproduce it for this post however)

It occurs to me that something's going on with eth0 during startup. Any suggestions?

Topology

My Ubuntu machine is connected to a router that is in turn, connected to another router which is the Internet gateway.

/etc/dhcpd/dhcpd.conf

ddns-update-style none;

# option definitions common to all supported networks...
option domain-name "SomeName";
option domain-name-servers 8.8.8.8, 8.8.4.4;

default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

subnet 10.0.0.0 netmask 255.255.255.0 {
   option subnet-mask 255.255.255.0;
   option domain-name-servers 8.8.8.8, 8.8.4.4;
   option routers 10.0.0.1;
   pool {
      range 10.0.0.60 10.0.0.70;
   }
}

/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
   address 10.0.0.2
   netmask 255.255.255.0
   network 10.0.0.0
   broadcast 10.0.0.255
   gateway 10.0.0.1

# The secondary network interface
#auto eth1
#iface eth1 inet dhcp

# WiFi use: -> connmanctl

# Ethernet/RNDIS gadget (g_ether)
# Used by: /opt/scripts/boot/autoconfigure_usb0.sh
iface usb0 inet static
    address 192.168.7.2
    netmask 255.255.255.252
    network 192.168.7.0
    gateway 192.168.7.1

/etc/default/isc-dhcp-server

DHCPD_PID=/run/dhcp-server/dhcpd.pid

INTERFACES="eth0"
  • Tried a few things, nothing worked though:Edited /etc/init/isc-dhcp-server.conf changed: start on runlevel [2345] to: start on runlevel [2345] and net-device-up IFACE=eth0 Edited /etc/init/isc-dhcp-server.conf added: sleep 30 before: exec dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf $CONFIG_FILE $INTERFACES Edited /etc/dhcp/dhclient.conf added: reject 192.168.1.1; – deiter62 Oct 18 '16 at 3:57
  • I put two spaces at the end of each line, but no <br/> inserted! – deiter62 Oct 18 '16 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.