From owner-freebsd-questions@FreeBSD.ORG Fri Oct 17 21:55:29 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA624106568A for ; Fri, 17 Oct 2008 21:55:28 +0000 (UTC) (envelope-from nlandys@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 69DAA8FC1C for ; Fri, 17 Oct 2008 21:55:27 +0000 (UTC) (envelope-from nlandys@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so508209fgb.35 for ; Fri, 17 Oct 2008 14:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:mime-version:content-type; bh=pEYC+QlkcJUAcqlg0kUYyIYBmSZZ+4JqyXqvtj6Oxs0=; b=rOzjMoAQ0LUoo8KPYn2CRvGEpOCdbKxtBBIU7i/HhSsAFZ2ZIpVYRfky7JXeQpiavH yvQTFhD5uclDm+dEaXcniKLDQfL37ruAoq6/JvedDm/cMPdjxj3x4dXVRPyGMqZcLOwH l3PWHFxIKxb3QXajOzaIx0jXXc0HoJS8rZK9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type; b=E9Ai2jq6PqnpACQXfDxxwGsA6Q6B1l2unRPx3wATLn/n7efUEVl17T/9QgFd2z7pb8 +h8QsP9fgCn2cXwLzA6TbBsUK7dpm9NFmwfq2sqwBZjaiKABtTa1ecXFhAi/hS5gVn8D 5wYT1VlXeuq8jwFkDeMTpH15aazjRO20Uq79o= Received: by 10.181.239.8 with SMTP id q8mr90212bkr.1.1224278640355; Fri, 17 Oct 2008 14:24:00 -0700 (PDT) Received: by 10.181.7.9 with HTTP; Fri, 17 Oct 2008 14:24:00 -0700 (PDT) Message-ID: <560f92640810171424v7fd48462qb750cf40229884ac@mail.gmail.com> Date: Fri, 17 Oct 2008 14:24:00 -0700 From: "Nerius Landys" To: "FreeBSD Mailing Lists" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Rambetter Subject: DHCP release/renew lease - elegant solution? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 21:55:29 -0000 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.