2

I have a home router providing internet access to my desktop and laptop. Both computers are running Ubuntu GNU/Linux version 12.04, and have been configured to use DHCP upon installation. So the router and DHCP are working correctly for these two computers.

I also have an older desktop computer with Ubuntu 10.04. This older desktop is normally not attached to the network, and was not configured to use DHCP.

I have now connected a network cable to it and I wanted to activate a network connection using DHCP. From the command line, I use

sudo dhclient eth0

The result is that the following is printed:

Listening on LPF/eth0/...
Sending on   LPF/eth0/...
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPOFFER of 192.168.2.106 from 192.168.2.1
DHCPREQUEST of 192.168.2.106 on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.2.1
DHCPREQUEST of 192.168.2.106 on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.2.1
DHCPREQUEST of 192.168.2.106 on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.2.1
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPOFFER of 192.168.2.106 from 192.168.2.1
DHCPREQUEST of 192.168.2.106 on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.2.1
DHCPREQUEST of 192.168.2.106 on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.2.1
DHCPREQUEST of 192.168.2.106 on eth0 to 255.255.255.255 port 67
DHCPNAK from 192.168.2.1

I do not know much about DHCP but it seems to me that the router (192.168.2.1) keeps offering address 192.168.2.106, and then refuses to acknowledge it. At least, this is what I have understood from rfc2131.

Do I have to change the configuration of my router, or of my desktop, or both?

EDIT

Following the indications of the comments I have added the following block to the file /etc/dhcp3/dhclient.conf:

interface "eth0"
{
  request subnet-mask;
}

but I still have the same errors as above. In particular, I still see

DHCPREQUEST of 192.168.2.106 on eth0 to 255.255.255.255 port 67

which means that the subnet-mask in my configuration file is ignored.

EDIT 2

Problem solved: apparently dhclient was not reading the default file /etc/dhcp3/dhclient.conf. I solved the problem by:

  • Calling dhclient with the -cf option (specifying the configuration file explicitly).
  • Specifying the option require subnet-mask instead of request: in this way I am sure (AFAIU) that the client is using a subnet mask it got from the router.

Thanks a lot for the hints that pointed me in the right direction.

  • Change the Subnet to at least 255.255.255.252. 255x4 tells dhcp there is no room left in your subnet – eyoung100 May 20 '14 at 21:04
  • @ECarterYoung that's the broadcast address, not the subnet. – derobert May 20 '14 at 21:33
  • Look for any logs on your router. That is indeed odd, unless there is some other part of the request (other than the IP address) causing it to be rejected. BTW: Wireshark would be a good tool to actually look at the packets. – derobert May 20 '14 at 21:34
  • /var/log/syslog contains the same messages that I have pasted above. – Giorgio May 20 '14 at 21:41
  • @ECarterYoung: Do you know how I can specify the subnet mask? I have not found any such option in man dhclient. – Giorgio May 20 '14 at 21:51

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.