openwrt / odhcpd

This repository is a mirror of https://git.openwrt.org/?p=project/odhcpd.git. Pull requests will be accepted which will be merged in odhcpd.git
GNU General Public License v2.0
162 stars 98 forks source link

Request: Add config option for specifying upper bound on router advertisement prefix lifetimes #82

Open JohnstonJ opened 8 years ago

JohnstonJ commented 8 years ago

Currently, it appears that odhcpd sends router advertisements with my prefix delegation from Comcast with a lifetime of several days. That is a long time, and if the prefix changes for any reason (e.g. router reboots & odhcp6c gets a different prefix from Comcast), clients on the network will still attempt to use the old prefix - i.e. they can't access the Internet any more.

In an ideal world, odhcpd would be storing a history of all prefixes that we advertised in the past in non-volatile memory and would send RA with preferred lifetime == 0 to deprecate them all after the router reboots or Comcast assigns a new prefix or whatever. But maybe this would be a simpler & quicker fix...

For example, observe these two addresses that one of my network clients was using after such an event happened recently:

$ ip addr show
inet6 2601:781:c201:15f1:59c0:5743:6562:cecb/64 scope global temporary dynamic
   valid_lft 36387sec preferred_lft 32960sec
inet6 2601:781:c280:931:59c0:5743:6562:cecb/64 scope global temporary dynamic
   valid_lft 198744sec preferred_lft 24745sec

Only one of these was valid and needless to say the client just had to pick the one that wasn't when trying to ping6 google.com.

If I could at least set the preferred lifetime to a short value (say, maybe, 5 minutes?) then the downtime from the prefix change could be minimized and the old prefix could be deprecated. (That would also require the router to frequently resend router advertisements, maybe every minute or 30 seconds?)

The feature I am proposing would be some new configuration options for setting MAXIMUM preferred & valid prefix lifetimes on router advertisements. It appears that odhcpd is already limiting the lifetime somewhat - maybe the lease length of the prefix delegation from odhcp6c? So the actual lifetime in the RA would be min(configured max, lifetime picked in current odhcpd version). The simplest would be to make this a global setting... On the other hand I have a ULA prefix set up and that doesn't need a short lifetime, but I don't think it would hurt to also use a short lifetime for that...

AndreBL commented 7 years ago

I have exactly the same problem, and I bet many others may have too, since dynamic IPv6 prefix is (unfortunately) popular on home internet subscriptions.

But I do not agree that configuring very short lifetimes fix it. In fact it creates other problems, due to packet losses and too frequent regeneration of temporary addresses on hosts.

The "ideal world" soliution described by JohnstonJ is something I do with radvd and a shell script as a workaround.

I hope odhcpd will have this feature natively. It doesn't need to keep a long history of deprecated prefixes. Saving just the last one is enough if reboots/disconnects are not too frequent.

MartB commented 4 years ago

What is the "current" way to deal with this issue? Any ideas how to do this with openwrt?