DHCP and dynamic IP

DHCP and dynamic IP

Post by Christian Caro » Mon, 14 Jan 2002 13:42:28



Hi everyone,

I have a dynamic ip and a firewall. I have a M$ computer connected to a
FreeBSD computer, which is connected to Internet. Whenever the ip changes,
all my connections to the Internet stop working.

Is there a way to:

-track the new ip as it changes
-restart the network using this new ip (do I have to?)
-restart the firewall (ipfw) using the new ip

...without rebooting?

Any idea?

--
==========================================
Christian Caron

 
 
 

DHCP and dynamic IP

Post by Devon Rya » Mon, 14 Jan 2002 14:03:49



> Hi everyone,

> I have a dynamic ip and a firewall. I have a M$ computer connected to a
> FreeBSD computer, which is connected to Internet. Whenever the ip changes,
> all my connections to the Internet stop working.

> Is there a way to:

> -track the new ip as it changes
> -restart the network using this new ip (do I have to?)
> -restart the firewall (ipfw) using the new ip

> ...without rebooting?

> Any idea?

Hopefully there is a better way, but you could find out how often you
have to renew your lease and make a cron job that does whatever it is
you need it to do (never had those problems, then again my lease is
always for the same ip).

--

Biology/Neuroscience, Pre-med | http://home.uchicago.edu/~dpryan



 
 
 

DHCP and dynamic IP

Post by Aaron Ange » Mon, 14 Jan 2002 16:15:07



> Hi everyone,

> I have a dynamic ip and a firewall. I have a M$ computer connected to a
> FreeBSD computer, which is connected to Internet. Whenever the ip changes,
> all my connections to the Internet stop working.

> Is there a way to:

> -track the new ip as it changes
> -restart the network using this new ip (do I have to?)
> -restart the firewall (ipfw) using the new ip

> ...without rebooting?

> Any idea?

Yes, there is.  First off, you don't need to "restart" the network, and
second off, you don't need to redo firewall rules.  There is a "me"
alias that, which is basically a coverall for any IP address assigned to
the machine.  If you write your rules well, you can narrow down which IP
address is most likely to match the "me" rule (for example, blocking all
packets with internal IP addresses on the external interface, using "me"
in a rule for external interfaces would allow only external IP
addresses, and visa-versa).

As for tracking the new IP as it changes, that would depend on which
DHCP client you're using.  If you're using dhclient, there is a dhclient
script, /sbin/dhclient-script, which is called each time the IP address
changes.  Look in there, it may call a local script.  If so, modify
that.  If not, backup the original and modify the master script to call
a local script, and put your notification stuff in there.

 
 
 

DHCP and dynamic IP

Post by Berk S. Daemo » Mon, 14 Jan 2002 19:14:44




> > Hi everyone,

> > I have a dynamic ip and a firewall. I have a M$ computer connected to a
> > FreeBSD computer, which is connected to Internet. Whenever the ip
changes,
> > all my connections to the Internet stop working.

> > Is there a way to:

> > -track the new ip as it changes
> > -restart the network using this new ip (do I have to?)
> > -restart the firewall (ipfw) using the new ip

> > ...without rebooting?

> > Any idea?

> Hopefully there is a better way, but you could find out how often you
> have to renew your lease and make a cron job that does whatever it is
> you need it to do (never had those problems, then again my lease is
> always for the same ip).

> --

> Biology/Neuroscience, Pre-med | http://home.uchicago.edu/~dpryan



check /var/db/dhclient.leases for renewal times, etc.
 
 
 

DHCP and dynamic IP

Post by Rodrigo A B Freire - STB » Mon, 14 Jan 2002 23:18:54


    If security isn't a must, you could use the PPP daemon [if via a dial-up
connection] to fix this issue.

    Rod.



Quote:> Hi everyone,

> I have a dynamic ip and a firewall. I have a M$ computer connected to a
> FreeBSD computer, which is connected to Internet. Whenever the ip changes,
> all my connections to the Internet stop working.

> Is there a way to:

> -track the new ip as it changes
> -restart the network using this new ip (do I have to?)
> -restart the firewall (ipfw) using the new ip

> ...without rebooting?

> Any idea?

> --
> ==========================================
> Christian Caron

 
 
 

DHCP and dynamic IP

Post by ericg » Tue, 15 Jan 2002 22:17:30


Hi Christian,

It probably stop working because your ipfw rules prevent connections using the
new IP. What i did is i defined a $dynip = `ifconfig ep0 | grep inet | grep -v
inet6 | awk '{print $2}'` variable in my rules file and use this variable
instead of hardcoded IP.

I assume here that you get a new IP after a system reboot since changing the
IP while having an active connection is a serious violation of the DHCP
protocol.

Eric.


> Hi everyone,

> I have a dynamic ip and a firewall. I have a M$ computer connected to a
> FreeBSD computer, which is connected to Internet. Whenever the ip changes,
> all my connections to the Internet stop working.

> Is there a way to:

> -track the new ip as it changes
> -restart the network using this new ip (do I have to?)
> -restart the firewall (ipfw) using the new ip

> ...without rebooting?

> Any idea?

> --
> ==========================================
> Christian Caron

 
 
 

DHCP and dynamic IP

Post by Lowell Gilber » Wed, 16 Jan 2002 00:57:38


Quote:> I assume here that you get a new IP after a system reboot since changing the
> IP while having an active connection is a serious violation of the DHCP
> protocol.

No.  It's not.  Changing IP addresses on clients without needing
to reboot them was the whole *point* of developing DHCP, as an
improvement to BOOTP.
 
 
 

DHCP and dynamic IP

Post by jp » Wed, 16 Jan 2002 01:29:41



>> I assume here that you get a new IP after a system reboot since changing the
>> IP while having an active connection is a serious violation of the DHCP
>> protocol.

> No.  It's not.  Changing IP addresses on clients without needing
> to reboot them was the whole *point* of developing DHCP, as an
> improvement to BOOTP.

But it'll still break the existing connections (eg, ssh), so those will
need to be re-established, no?

--
  j p d (at) d s b (dot) t u d e l f t (dot) n l .

 
 
 

DHCP and dynamic IP

Post by ericg » Wed, 16 Jan 2002 04:02:19


Yes it is (See RFC 2131 on DHCP protocol). DHCP doesn't require an administrator
to manualy configure each new network device. That was the whole point of
developing DHCP.

Eric.


> > I assume here that you get a new IP after a system reboot since changing the
> > IP while having an active connection is a serious violation of the DHCP
> > protocol.

> No.  It's not.  Changing IP addresses on clients without needing
> to reboot them was the whole *point* of developing DHCP, as an
> improvement to BOOTP.

 
 
 

DHCP and dynamic IP

Post by ericg » Wed, 16 Jan 2002 04:10:41


You're right. That's exactly why DHCP will rebind you to the same address on an
active session.

Eric.



> >> I assume here that you get a new IP after a system reboot since changing the
> >> IP while having an active connection is a serious violation of the DHCP
> >> protocol.

> > No.  It's not.  Changing IP addresses on clients without needing
> > to reboot them was the whole *point* of developing DHCP, as an
> > improvement to BOOTP.

> But it'll still break the existing connections (eg, ssh), so those will
> need to be re-established, no?

> --
>   j p d (at) d s b (dot) t u d e l f t (dot) n l .

 
 
 

DHCP and dynamic IP

Post by Lowell Gilber » Wed, 16 Jan 2002 04:19:08




> >> I assume here that you get a new IP after a system reboot since changing the
> >> IP while having an active connection is a serious violation of the DHCP
> >> protocol.

> > No.  It's not.  Changing IP addresses on clients without needing
> > to reboot them was the whole *point* of developing DHCP, as an
> > improvement to BOOTP.

> But it'll still break the existing connections (eg, ssh), so those will
> need to be re-established, no?

Yes.  [Actually, I once had a proposal for an extension to DHCP that
would allow for gradual transfer to a new IP address, but it was never
implemented by anyone but me, never implemented in any server at all,
and obviously was never advanced as a standard.]

 - Lowell

 
 
 

DHCP and dynamic IP

Post by Lowell Gilber » Wed, 16 Jan 2002 04:57:05



> Yes it is (See RFC 2131 on DHCP protocol). DHCP doesn't require an administrator
> to manualy configure each new network device. That was the whole point of
> developing DHCP.

It's true that DHCP is intended to avoid manual configuration of
individual devices.  *It* provides an IP address (and other
information), which means that the administrator doesn't need to
configure the device directly.  It also, however, provides for address
"leases", so that the device doesn't necessarily get to keep using
that address indefinitely.  The device is required to contact the
server to renew its lease occasionally, and must be prepared, if the
server so instructs, to stop using the address and start using a new
one.  A reboot of the device is, thus, not required, and neither is
direct configuration.

[You can run a DHCP server such that it gives out infinite leases that
don't need to be renewed.  However, this is functionally equivalent to
BOOTP.]

In short, DHCP is a way to configure devices over the network, and one
of its features *is* the ability to change the IP address on a client.
This does, indeed, cause active connections to fail.

  -- Lowell Gilbert

> Eric.


> > > I assume here that you get a new IP after a system reboot since changing the
> > > IP while having an active connection is a serious violation of the DHCP
> > > protocol.

> > No.  It's not.  Changing IP addresses on clients without needing
> > to reboot them was the whole *point* of developing DHCP, as an
> > improvement to BOOTP.

 
 
 

DHCP and dynamic IP

Post by Christian Caro » Wed, 16 Jan 2002 07:06:11


Well... My leases are good for 6 hours (but they usually are renewed for a few weeks to a few months.

My problems are not when I'm rebooting as the new ip is detected and I use this script to get the new ip in the firewall.

The problem is when my ip is not renewed and I get another one, while the computer is running. Then, I lose my connections. The only way I found to correct the situation is to reboot.

But does somebody know how to "restart the services" (including the firewall ipfw), without rebooting?

Thanks!

--
==========================================
Christian Caron

 
 
 

DHCP and dynamic IP

Post by jp » Wed, 16 Jan 2002 09:37:23


On Mon, 14 Jan 2002 19:19:08 GMT,
[SNIP renewing lease with another ip]

Quote:>> But it'll still break the existing connections (eg, ssh), so those will
>> need to be re-established, no?

> Yes.  [Actually, I once had a proposal for an extension to DHCP that
> would allow for gradual transfer to a new IP address, but it was never
> implemented by anyone but me, never implemented in any server at all,
> and obviously was never advanced as a standard.]

I can see a lot of problems with it[1], but I can see merits, too.
You don't perchance have any draft floating around, do you?

[1] Mending programs (not being dhcp[cd]) to take hold of the new ip?
    Here _and_ there?

--
  j p d (at) d s b (dot) t u d e l f t (dot) n l .

 
 
 

DHCP and dynamic IP

Post by ericg » Wed, 16 Jan 2002 22:05:13


Quote:>   It also, however, provides for address
> "leases", so that the device doesn't necessarily get to keep using
> that address indefinitely.

There is 2 conditions that *may* cause your client to get a different lease.

1. The lease has expired ( which mean the client haven't tried to *revalidate* his
lease). That will not happen unless you turn off your computer for a while or your
connexion break for more than the lease period.

2. The client has sent a request to release his lease.

The dhcp server will keep the information about the given lease and will try as much
as possible to re-assign the same lease to the same host. In case where the dhcp
server have no more free lease to assing to new clients it will reclaim *unused*
leases and start assigning them to new clients.

Quote:> The device is required to contact the
> server to renew its lease occasionally, and must be prepared, if the
> server so instructs, to stop using the address and start using a new
> one.  A reboot of the device is, thus, not required, and neither is
> direct configuration.

It is prepared for that situation but this situation is most likely not expected since
it will break active connexions.

Quote:

> In short, DHCP is a way to configure devices over the network, and one
> of its features *is* the ability to change the IP address on a client.
> This does, indeed, cause active connections to fail.

That's exactly why it is an unacceptable server behavior.
 
 
 

1. DHCP and Bootp Assignment of Dynamic IP Addresses.

My university is switching to a dynamic IP assignment from the standard
static setup they had before.  The will be using a combination of
bootp or dhcp to allocate these numbers.  I have scoured the FAQS
and the newsgroups and have had no luck.  Is there any suggested
manner for dealing with this problem?

Thank you.

Charles Suprin.

--
Charles Suprin
---
 There's not enough sax and violins on television.

2. Some notes on ftp with cron

3. dynamic IP address on my LAN w/ MS DHCP <<HOW>>

4. Ethernet Port

5. PPP server w/ dynamic IP provided by DHCP server

6. Implementation of QoS in Linux

7. Dhcp, dynamic ip and daemon

8. what is the syntax for virtual hosting for 2 differnet machine Linux rh 6.0 & solaris 8 intel under differnet version of Apache.

9. Dynamic (DHCP) IP and DNS

10. Linux DHCP server with dynamic IP

11. Dynamic allocation of IP (DHCP)

12. Finding DHCP (dynamic IP) devices on a subnet

13. DHCP, dynamic IP and DNS?