From owner-freebsd-net Thu Jul 11 22:43:36 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1305637B400 for ; Thu, 11 Jul 2002 22:43:33 -0700 (PDT) Received: from wso-h001.wsonline.net (12-254-30-97.client.attbi.com [12.254.30.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 74A3543E58 for ; Thu, 11 Jul 2002 22:43:32 -0700 (PDT) (envelope-from seahorse51@attbi.com) Received: from seahorse.attbi.com (trilluser@seahorse [192.168.1.101]) by wso-h001.wsonline.net (8.12.5/8.12.5) with ESMTP id g6C5hUYS001958; Thu, 11 Jul 2002 23:43:31 -0600 (MDT) (envelope-from seahorse51@attbi.com) Message-Id: <5.1.0.14.0.20020711233932.0237f368@wsonline.net> X-Sender: seahorse@wsonline.net X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 11 Jul 2002 23:43:52 -0600 To: Mikel King , nascar24 From: Andy Subject: Re: DHCP lease renewal Cc: net@FreeBSD.ORG In-Reply-To: <3D2DD3BB.2010506@ocsinternet.com> References: <01c001c221dd$38127d20$0200a8c0@winxp> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org This is the script I use to accomplish this. Just substitute the network card interface code with the one you wish to have renewed. I run this every 24 hours, and have been able to keep the same IP address for going on 6 months now. It also generates a handy Email to root when run from /etc/crontab, so that you can review the renewal information, verify your ifconfig settings for that network card, and your change in the IP lease. #!/bin/sh # # Restart DHCLIENT and reconfigure ifconfig ... # SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin HOME=/var/log echo " " echo "************************************************************" echo "Started DHCLIENT update: `date \"+%Y-%m-%d %H:%M:%S\"`" echo "************************************************************" echo " " kill -TERM `cat /var/run/dhclient.pid` echo "DHCP Killed, restarting" echo " " /sbin/dhclient xl0 echo " " sleep 10 ifconfig xl0 echo " " more /var/db/dhclient.leases echo " " echo "************************************************************" echo "Finished DHCLIENT update: `date \"+%Y-%m-%d %H:%M:%S\"`" echo "************************************************************" echo " " At 12:51 07/11/2002, Mikel King wrote: >Not sure if you've found this already. One thing I used to do on an older >box was a simple cron job that ran a script which HUP'd the dhclient every >so often thus effectively renewing the lease... > >If memory serves me it went something like.... > > #!/bin/sh > > kill -HUP `ps ax |awk '/dhclient/{print $1; exit}'` >cheers, >mikel > >nascar24 wrote: > >>Hallo, >> >>My FreeBSD 4.5-RELEASE machine is connected to the internet via a cable >>connection. And when booting (or running dhclient) I get an IP address. >>But when I have an IP address and my ISP wants to give me a new IP >>address I doesn't go the way it should. Because I don't get the new IP >>address, my machine continues to use the 'old' IP address. And when that >>happens I get an angry phone call from my ISP, and they shut me from >>internet for a day. >> >>So, how can I configure (dhclient.conf I guess) my machine so that it >>accepts this new IP address. I thought I would configure my machine so >>that it renews its lease every 10 hours. But I have read the man for >>dhclient.conf, dhcp-options and dhclient but I still am puzzled. >> >>Gr. >> >>Marcel. >> > >Cheers, >Mikel To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message