From owner-freebsd-questions Wed Sep 6 0:19:48 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mailhost01.reflexnet.net (mailhost01.reflexnet.net [64.6.192.82]) by hub.freebsd.org (Postfix) with ESMTP id 2466A37B422 for ; Wed, 6 Sep 2000 00:19:46 -0700 (PDT) Received: from 149.211.6.64.reflexcom.com ([64.6.211.149]) by mailhost01.reflexnet.net with Microsoft SMTPSVC(5.5.1877.197.19); Wed, 6 Sep 2000 00:18:41 -0700 Received: (from cjc@localhost) by 149.211.6.64.reflexcom.com (8.9.3/8.9.3) id AAA08685; Wed, 6 Sep 2000 00:19:44 -0700 (PDT) (envelope-from cjc) Date: Wed, 6 Sep 2000 00:19:44 -0700 From: "Crist J . Clark" To: msilver@sc.rr.com Cc: questions@FreeBSD.ORG Subject: Re: Dynamic IP and IPFW Message-ID: <20000906001944.G69158@149.211.6.64.reflexcom.com> Reply-To: cjclark@alum.mit.edu References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from MSILVER@scana.com on Tue, Sep 05, 2000 at 05:23:31PM -0400 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Sep 05, 2000 at 05:23:31PM -0400, SILVER, MICHAEL A wrote: > I have FreeBSD system acting as a gateway for some other home machines I > have. So far it works like a champ, beyond my expectations. I even have > apache running with virtual domains over a dynamic IP. Pretty impressive > stuff. > > My concern is that once the dynamic IP changes, the gateway machine will no > longer forward packets. I currently have the FreeBSD's gateway address hard > coded to the dynamic IP address (defaultrouter="123.4.5.67"). This doesn't > seem right (since DHCP should assign an address), but unless I do this, the > internal machines cannot get out over the internet. Are you saying when the gateway machine uses DHCP, the default route is not properly set? Or are you saying that you force it and have not actually let DHCP set it? > My question: I have a script to check for IP changes, but how do I change > the gateway address when my IP changes? DHCP should take care of giving your machine a default gateway. > I imagine that I need to use route. No. > If so, could someone please provide an example. (Yes, I have read the man > pages, and yes I am a newbie). An example of what? To see the actual code that does the configuring once dhclient(8) has grabbed the info, look at dhclient-script(8). That said, DO NOT EDIT /sbin/dhclient-script if that's what you decide you need, make a /etc/dhclient-exit-hooks script. For an example of this, here is mine, #!/bin/sh # # dhclient-exit-hooks - 2000/07/29 # # Refresh firewall since IP address of external interface may # have changed. # Load in site configuration. Stolen from /etc/rc. if [ -f /etc/defaults/rc.conf ]; then . /etc/defaults/rc.conf elif [ -f /etc/rc.conf ]; then . /etc/rc.conf fi # This is right out of /etc/rc.network (1.39.2.14). Disabling the # verbosity, lines left in but commented out. if [ -z "${firewall_script}" ] ; then firewall_script="/etc/rc.firewall" fi if [ -f "${firewall_script}" -a X"$firewall_enable" = X"YES" ]; then . "${firewall_script}" # echo -n 'Firewall rules loaded, starting divert daemons:' fi #End -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message