DHCPv6, IPv6 net tools

From: David W. Hankins
Date: Mon Feb 05 2007 - 17:09:08 EST


I'm in the middle of updating ISC dhclient to provide DHCPv6
support.

As a bit of background in case you weren't aware, our DHCP
client iterates a shell script in order to perform the actual
configuration of the system.

It's possible that dhclient would be executed after a previous
incarnation failed or was killed ungracefully. So any 'stale'
addresses need to be removed in the off chance that the server
won't offer the same addresses next go round.

To do this with IPv4, we merely:

ifconfig $interface 0 up

Which is wonderfully simple.


I've been looking for a way to do this with IPv6. The various
documents I've read suggest cycling the inet6 state, eg:

ifconfig foo0 inet6 down
ifconfig foo0 inet6 up

Should do the trick (although it seems a bit excessive...a
waste to force the kernel to re-autoconfig the interface).

On 2.6.16.21, this appears to actually mark the interface's
state as down, rather than simply clearing out inet6 state.
Any ipv4 addresses remain on the interface, but as the
interface is down the route to that subnet (and consequently
the default route) are dropped.

Can't have that.

So for testing thus far, I have resorted to this:

for addr in `${ifconfig} ${interface} | grep 'Scope:Global' | \
cut -d ' ' -f 13` ; do
${ifconfig} ${interface} del ${addr}
done

Which is more than a little unsettling.

Any other ways about it? Undocumented 'ifconfig foo0 inet6 del *'?


While I'm asking on this subject, DHCPv6 introduces the concept of
a 'preferred' lifetime. The objective is to encourage applications
to move from an old address to a new one over a grace period before
the old address fully expires.

Have either the linux kernel or net-tools folks spent any time
thinking about how this will be implemented and signalled? I'm
not seeing anything related in the ifconfig manpage.

--
David W. Hankins "If you don't do it right the first time,
Software Engineer you'll just have to do it again."
Internet Systems Consortium, Inc. -- Jack T. Hankins

Attachment: pgp00000.pgp
Description: PGP signature