1

Struggling a bit with isc-dhcp-server on Ubuntu 16.04.

The Ubuntu box has one NIC that is connected via Ethernet cable to a router. I'm trying to get a Windows 10 machine to connect to the same router over WiFi and get a DHCP address from the Ubuntu machine. For completeness, I should point out that the router is connected to another router, which is the actual Internet gateway. I set it up this way so I could mess around without affecting Internet access for others.

To begin, the router has DHCP enabled and its web portal shows both the Ubuntu and Windows machines are connected. I have no problem on my Windows machine:

Wireless LAN adapter Wi-Fi:

Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 10.0.0.3
Subnet Mask . . . . .. . . .. . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.0.1

I ssh into the Ubuntu machine and configure it (comments removed for brevity):

/etc/network/interfaces

auto eth0
iface eth0 inet static
address 10.0.0.2
netmask 255.255.255.0
gateway 10.0.0.1
broadcast 10.0.0.255

/etc/default/isc-dhcp-server

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

INTERFACES="eth0"

/etc/dhcp/dhclient.conf

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, domain-search, host-name, dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers, netbios-name-servers, netbios-scope, interface-mtu, rfc3442-classless-static-routes, ntp-servers;

timeout 300;

/etc/dhcp/dhcpd.conf

ddns-update-style none;
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 {
range 10.0.0.100 10.0.0.254;
option routers 10.0.0.1
}

Unfortunately, when I turn off the router's DHCP, the Windows machine cannot get an IP address:

Wireless LAN adapter Wi-Fi:

Connection-specific DNS Suffix . :
Autoconfiguration IPv4 Address. . : 169.254.28.77
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :

Once this happens, the only way I can recover is to modify the WiFi adapter settings on the Windows machine and specify the IP address, subnet mask, default gateway and DNS. After doing so, I can connect to the router's web interface and I notice that the Windows machine is the only connected device, so it seems to me that when the router has DHCP disabled, the Ubuntu machine cannot connect to it the same way the Windows machine does when it's configured to obtain its IP address manually.

See anything wrong with my configuration?

1

Found the culprit! Missing a semi-colon:

/etc/dhcp/dhcpd.conf

option routers 10.0.0.1;

The YouTube video DHCP Relay Configuration on Juniper SRX 210 using Ubuntu 12.04 DHCP Server (here) introduced me to this command:

:~$ sudo dhcpd -4 eth0

That's a great check to see if isc-dhcp-serveris running, but in my case it reported the error. It was trivial to fix after that.

0

This bit seems strange to me. Usually the address of that computer is the same as the gateway, so both should be 10.0.0.1

auto eth0
iface eth0 inet static
  address 10.0.0.2
  netmask 255.255.255.0
  gateway 10.0.0.1
  broadcast 10.0.0.255

So try changing the address parameter and see what happens...

  • Thanks for responding Alexis. No joy I'm afraid; same result. Doesn't the router still need to be IP address 10.0.0.1? – deiter62 Sep 17 '16 at 20:32
  • Ah, you have a separate router. I often forget about such. I make my main server the one on the Internet... and I have two separate physical cards to get a safe LAN behind the firewall. – Alexis Wilke Sep 17 '16 at 20:38
  • One other thing I could think of, do you have any firewall in place on either side (Ubuntu or Windows)? If so, one way to test is to drop the firewall while testing and then try to determine what could be blocking the packets as you try to set it back up. – Alexis Wilke Sep 17 '16 at 20:42
  • Yea, I suppose that's an option, but my ISP provides a wireless router. I'd like to use it rather than buying another router one and placing my Ubuntu machine between them. – deiter62 Sep 17 '16 at 20:45
  • OK; I'll look into firewalls. Thanks for the tip. – deiter62 Sep 17 '16 at 20:46

Your Answer

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

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