Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Sep 2000 00:19:44 -0700
From:      "Crist J . Clark" <cjclark@reflexnet.net>
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>
In-Reply-To: <DBB3921EFE2AD211A81500A0C9B5FE76057945CD@msg04.scana.com>; from MSILVER@scana.com on Tue, Sep 05, 2000 at 05:23:31PM -0400
References:  <DBB3921EFE2AD211A81500A0C9B5FE76057945CD@msg04.scana.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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