Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I set up a dhcpd on my ubuntu server with this configuration: please note that the ubuntu server which runs the dhcpd has a static ip of 192.168.1.50

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

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.50;
option domain-name-servers 192.168.1.50;
option netbios-name-servers 192.168.1.50;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.150 192.168.1.200;
}

Now when I try to get an ip from the dhcpd server from my ubuntu client computer the server offers an ip from the pool of 192.168.1.150 but the client doesn't seem to pick it up, instead it fires new requests until a timeout occurs:

Listening on LPF/eth0/00:24:8c:1d:fb:40
Sending on   LPF/eth0/00:24:8c:1d:fb:40
Sending on   Socket/fallback
DHCPRELEASE on eth0 to 195.130.132.102 port 67
Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:24:8c:1d:fb:40
Sending on   LPF/eth0/00:24:8c:1d:fb:40
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPOFFER of 192.168.1.150 from 192.168.1.50
DHCPREQUEST of 192.168.1.150 on eth0 to 255.255.255.255 port 67
DHCPREQUEST of 192.168.1.150 on eth0 to 255.255.255.255 port 67
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPOFFER of 192.168.1.150 from 192.168.1.50
DHCPREQUEST of 192.168.1.150 on eth0 to 255.255.255.255 port 67
DHCPREQUEST of 192.168.1.150 on eth0 to 255.255.255.255 port 67
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPOFFER of 192.168.1.150 from 192.168.1.50
DHCPREQUEST of 192.168.1.150 on eth0 to 255.255.255.255 port 67
DHCPREQUEST of 192.168.1.150 on eth0 to 255.255.255.255 port 67
...

tcpdump information:

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
19:04:18.431422 IP 94.227.60.1.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300
19:05:10.316903 IP 94.224.188.1.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300

iptables information is the same for both server and client:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination    

Any ideas??

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

I found a solution, iptables was blocking the dhcp port. I needed to add this rule that would cause UFW to open the DHCP port, called bootps in /etc/services

sudo ufw allow bootps
share|improve this answer
    
You must have added that yourself nkr1pt. A default ufw install doesn't block DHCP. In fact, a default ufw install doesn't block anything outgoing, only incoming. Glad you got to the bottom of it though. You probably should have marked up RichM's answer rather than creating your own answer and marking it as the answer. –  Scaine Dec 6 '10 at 20:02
add comment

Your server is 192.168.1.50, but you're also specifying that this will be the default route for any clients offered an IP. Can you clarify that this DHCP box is definitely also a default router for that subnet? Normally it's a router with an IP of something like 192.168.1.1 (your broadband/adsl router for example).

Probably doesn't explain the repeated rejection of the offer though.

On the client, assuming you're using a cable, please run :

sudo tcpdump -ni eth0 port 67

(Substitute eth0 for wlan0 or similar if your client is using WIFI. Run ifconfig in a terminal to see a list of your interfaces)

You should see something like this :

scaine@GroovyTosh:~$ sudo tcpdump -ni eth0 port 67
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
00:24:38.520770 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:1e:68:d9:1b:7b, length 300
00:24:38.521211 IP 192.168.1.50.67 > 192.168.1.150.68: BOOTP/DHCP, Reply, length 300

I'm running ufw in default mode on Ubuntu 10.10, using an ethernet cable. My server is Ubuntu 9.10 running Webmin which I used to configure my DHCP server.

Post the output of your tcpdump command and I'll be able to help further (or others will).

share|improve this answer
    
Scaine, I edited the question with the information you asked for. –  nkr1pt Dec 3 '10 at 18:06
    
There is some bizarre stuff going on here. If you ran tcpdump on the client requesting the address, then it clearly already has an address of 94.227.60.1.67!! The first request outbound should be from 0.0.0.0, broadcasting for a DCHP server. –  Scaine Dec 4 '10 at 17:51
    
Can you also explain what command you ran to show the DHCP info from your first section? It shows : DHCPRELEASE on eth0 to 195.130.132.102 port 67 Internet Systems Consortium DHCP Client V3.1.3 ...which suggests that there's yet another IP address in play on your system. You need give as much information as possible when troubleshooting stuff like this. Is it ethernet or wifi, versions, routers inbetween, is the server doing NAT, or routing? There definitely some strange stuff going here. –  Scaine Dec 4 '10 at 17:54
    
It is all ethernet. After some unplugging an pinging 195.130.132.102 it seems to be from the cable modem. Setup is: coax cable goes into cable modem from isp, cable modem is connected via ethernet to wan port of router, router is connected to 16 port switch via another port, all other computers are connected onto the switch. Please mind that all computers in the network have been assigned static ip's, although dhcp is enabled on the router. The reason is that sometimes the clients would get an ip from the router, as desired, but sometimes they would get the public ip from the isp -> non nat –  nkr1pt Dec 4 '10 at 22:00
    
I also tried by directly connecting the server and client via ethernet cable, without any routher, modem, switch ... and still the client wouldn't an ip from the dhcp server: DHCPDISCOVER on vboxnet0 to 255.255.255.255 port 67 interval 8 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6 DHCPOFFER of 192.168.1.151 from 192.168.1.50 DHCPREQUEST of 192.168.1.151 on eth0 to 255.255.255.255 port 67 DHCPREQUEST of 192.168.1.151 on eth0 to 255.255.255.255 port 67 DHCPDISCOVER on vboxnet0 to 255.255.255.255 port 67 interval 10 DHCPREQUEST of 192.168.1.151 on eth0 to 255.255.255.255 port 67 –  nkr1pt Dec 4 '10 at 22:17
show 1 more comment

Make sure that there isn't a firewall on either server or client that is blocking the responses from the server. Try turning both firewalls off and if dhcp works then your firewall rules need tweaking.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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