# Trouble getting address via DHCP



## jtl (Dec 1, 2008)

Often when staring up FreeBSD 7.0, DHCP goes through the following dance with the DHCP server.

DHCPDISCOVER on bge0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on bge0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on bge0 to 255.255.255.255 port 67 interval 5
DHCPOFFER from 128.4.30.64
DHCPOFFER from 128.4.30.64
DHCPOFFER already seen.
DHCPREQUEST on bge0 to 255.255.255.255 port 67
DHCPREQUEST on bge0 to 255.255.255.255 port 67
DHCPDISCOVER on bge0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on bge0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on bge0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on bge0 to 255.255.255.255 port 67 interval 21
DHCPOFFER from 128.4.30.64
DHCPOFFER from 128.4.30.64
DHCPOFFER already seen.
DHCPREQUEST on bge0 to 255.255.255.255 port 67
DHCPREQUEST on bge0 to 255.255.255.255 port 67
.
.
.

I've seen this continue through as many as half a dozen iterations before simply failing.  I'd be inclined to blame the DHCP server for not recognizing the DHCPREQUEST, or perhaps for not sending a DHCPACK, except that I have also seen cases where DHCP fails and reports that no offers were received yet two offers were in fact received from the server - at least wireshark saw them...  That makes me wonder about FreeBSD's DHCP behavior.

Has anyone seen this before, or have any ideas why this is happening?  Thanks.


----------



## komeylian (Dec 2, 2008)

hi, may you please inform me about your rc.conf & dhcpd.conf.


----------



## s-tlk (Dec 2, 2008)

I've recently seen something similar. The Problem in my case was, that the DHCP Server was changed to a redundant server. I don't investigate the problem further and so I can't tell what was the real issue, but installing the original isc-dhcp-client solves my problem. (net/isc-dhcp*)
I guess the isc-dhcp server, or the freebsd client, which is afair a adaption of the isc-client, don't follow the standard.

Perhaps this helps to solve your problem. ^^


----------



## jtl (Dec 2, 2008)

s-tlk -
Thanks for the info.  I'll give that a whirl.

komeylian -
My /etc/rc.conf file is listed below.  I'm not running dhcpd and don't have a dhcpd.conf file.  I'm guessing that maybe you'd like to see my dhclient.conf file, but that file is empty.  If you're looking for the dhcp.conf file on the DHCP server, I'm afraid I can't get that because I don't have access to that machine.

# -- sysinstall generated deltas -- # Fri Sep 12 09:09:01 2008
# Created: Fri Sep 12 09:09:01 2008
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname="buzet.pc.cis"
ifconfig_bge0="DHCP"
inetd_enable="YES"
moused_enable="YES"
moused_port="/dev/usm0"
moused_type="auto"
sshd_enable="YES"
devfs_system_ruleset=localrules
cupsd_enable="YES"

-----------------

here are the relevant lines from /etc/defaults/rc.conf
.
.
.
dhclient_program="/sbin/dhclient"       # Path to dhcp client program.
dhclient_flags=""               # Extra flags to pass to dhcp client.
#dhclient_flags_fxp0=""         # Extra dhclient flags for fxp0 only
background_dhclient="NO"        # Start dhcp client in the background.
#background_dhclient_fxp0="YES" # Start dhcp client on fxp0 in the background.
synchronous_dhclient="YES"      # Start dhclient directly on configured
                                # interfaces during startup.
.
.
.


----------



## SirDice (Dec 2, 2008)

> DHCPOFFER from 128.4.30.64
> DHCPOFFER from 128.4.30.64
> DHCPOFFER already seen.


The DHCP server is seeing your DISCOVER or else it wouldn't OFFER :e

The real question is why is it offering twice? Is the DHCP server in the same broadcast domain? Or are you using some sort of relay?


----------



## jtl (Dec 2, 2008)

The server is in the same broadcast domain and there is no relay involved.  I suspect that the multiple offers arise from the multiple discovers.  Similarly, I see mutiple acks on those occasions where I actually succeed in getting an address, but typically my machine has sent multiple requests before getting an ack, and I assume that each ack is a response to a different request.  I have no control over the DHCP server (which is serving hundreds of linux and Windows boxes apparently without issue), so I am primarily focused on why the server doesn't respond to my machine's DHCPREQUESTs.


----------



## jtl (Dec 3, 2008)

s-tkl -
Looks like the isc-dhclient may be a solution, though I don't have the kinks ironed out.  When I request an address with the isc-dhclient, the process completes in a fraction of a second (as it should), but I'm having trouble when booting up.  I added dhclient_program="/usr/local/sbin/dhclient" to my /etc/rc.conf file, but on startup it doesn't get an address.  When I login and request and address I am informed that the address is in use, and I have to do a "dhclient -r bge0" and an "ifconfig bge0 -alias" to remove it before I can successfully request an address with dhclient bge0.  Have you run into anything like this?


----------



## s-tlk (Dec 3, 2008)

Mh interessting. 
I didn't run into this problem. Have you read pkg-message and comment the old DHCP line? I suppose it has something to do with the old client.


----------

