Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Oct 2008 14:24:00 -0700
From:      "Nerius Landys" <nlandys@gmail.com>
To:        "FreeBSD Mailing Lists" <freebsd-questions@freebsd.org>
Cc:        Rambetter <nlandys@gmail.com>
Subject:   DHCP release/renew lease - elegant solution?
Message-ID:  <560f92640810171424v7fd48462qb750cf40229884ac@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I have an always-on FreeBSD box which is connected to the internet.  My ISP
is some cable company and the IP address is determined via DHCP; I used to
always get the same IP address but recently the address seems to be changing
very frequently whenever I reboot the machine.

My problem is that recently, after being on for a day or so, the internet
connection to the FreeBSD box breaks down, it stops working or becomes very
intermittent/flaky.  I then reboot the machine, and thereafter it usually
uses a new IP address and the internet connection returns fo running fine.
There is no need to reboot the cable modem.

My goal is to do some dhclient magic which will automatically fix this
problem without needing a reboot of the machine.  If possible, I would like
to have the same IP address as often as possible, but I'm not sure that this
is possible.

My FreeBSD version is 5.5, so it uses the ISC DHCP client, but the details
between the current DHCP client and mine are probably insignificant.  My
/etc/dhclient.conf file is empty.

I have been reading man pages, and it seems that the way to release, get a
new IP address is this:

  dhclient -r
  dhclient fxp0

An except from my dhclient man page:

       The  client  normally  doesn't  release  the current lease as it is
not
       required by the DHCP protocol.  Some cable ISPs require  their
clients
       to  notify  the  server if they wish to release an assigned IP
address.
       The -r flag explicitly releases the current lease, and once  the
lease
       has been released, the client exits.

I could put this into a crontab and run it every 12 hours.  However, this
does not seem like a very elegant solution to my problem.  I am wondering
whether there is a more elegant solution.  Thanks in advance.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?560f92640810171424v7fd48462qb750cf40229884ac>