Re: DHCPv6 without SLAAC
Joachim Achtzehnter
Mon Jan 05 18:58:54 2015
Hi Roy,
You wrote:
Hi Joachim
On Tuesday 30 Dec 2014 16:05:56 Joachim Achtzehnter wrote:
Further on the desire for an option to configure a specific interface on
a specific host to assign only a DHCP address, but not assign any
autonomously chosen SLAAC addresses: One way to provide this option is
illustrated by the attached patch.
This relies on the caller of dhcpcd to set the kernel parameters
(accept_ra==1, autoconf==0). This is how ifup from the ifupdown package
would configure this use case if it supported dhcpcd for IPv6. I've
tried this and it does what I want, with two small problems, which I
think are unrelated issues.
The patch is only intended as an illustration, I'm not familiar enough
with the dhcpcd implementation to know whether this is an appropriate
way to do it.
We cannot use that kernel tunable because if dhcpcd wants to own the RA
entirely it will disable it anyway, so a future restart of dhcpcd may not work
the same way as the first pass.
Attached is a better patch which adds noipv6ra_autoconf as a tunable in
dhcpcd.conf. Let me know if that works for you.
My first attempt to use this didn't work. I had added noipv6ra_autoconf
to the configuration file and left the kernel parameters autoconf and
accept_ra both set to 1. This left me with a stateless auto-configured
address and no DHCP address. The last message on the console from the
dhcpcd daemon was "soliciting an IPv6 router", then it must have exited
with an error because ifup reported "Failed to bring up eth1", even
though the stateless auto-configuration did occur, probably done by the
kernel. Do I need one of the 'own' settings in addition to
noipv6ra_autoconf?
In terms of whether the general approach would work for us, I believe
the answer is yes for the time being, while we allow our users to choose
between stateless auto-configuration-only, and DHCP-only. In the future
we will probably want to support both together as another choice, and
then we would have to mess with the configuration file, potentially
needing different settings for different interfaces, which is not ideal.
It is unfortunate that dhcpcd needs to (essentially) hijack these kernel
parameters. Personally, I would have preferred if the dhcp client left
these kernel settings alone and only handled DHCP configuration. Even if
the kernel does all processing of RAs, the DHCP client would still be
able to see whether the 'managed' flag is set.
By the way, coming back to your earlier question about what should
happen when different RAs don't agree about the 'managed' flag. The RFC
is quite clear about this, saying that a transition from '1' to '0' for
the 'managed' flag should be ignored.
Here are the two remaining problems:
1) For some reason the DHCP address is added with a prefix length of 128
instead of 64. The router advertises a prefix with length 64.
DHCPv6 IA_NA and IA_TA messages have no notion of prefix length - it's just an
address.
http://www.ietf.org/mail-archive/web/v6ops/current/msg17669.html
Okay, I think I understand where you're coming from. Processing of
subsequent RAs, which may set the lifetime of a prefix to 0 among other
things, is probably easier if the routing table entries for on-link
address ranges are entered explicitly instead of implicitly via an
interface prefix. On other other hand, the output of ifconfig with the
128 prefix does look confusing to many users in the common case when the
address does in fact match an on-link prefix, hence the many questions
about this in various mailing lists. ;)
I'll come back to the missing script calls once I get your patch working.
Thanks,
Joachim
2) The hook script does not seem to get called after the DHCP address
was bound (at least not when starting up with an existing lease), it is
only called for the receipt of the RA.
dhcpcd[6738]: wlp4s0: vltime 5800 seconds, pltime 3625 seconds
dhcpcd[6738]: wlp4s0: renew in 1812 seconds, rebind in 2900 seconds
dhcpcd[6738]: wlp4s0: writing lease `/var/db/dhcpcd-wlp4s0.lease6'
dhcpcd[6738]: wlp4s0: waiting for DHCPv6 DAD to complete
dhcpcd[6738]: wlp4s0: Router Advertisement DAD completed
dhcpcd[6738]: wlp4s0: executing `/libexec/dhcpcd-run-hooks' ROUTERADVERT
dhcpcd[6738]: wlp4s0: DHCPv6 DAD completed
dhcpcd[6738]: wlp4s0: executing `/libexec/dhcpcd-run-hooks' BOUND6
Thanks
Roy
--
joachima@xxxxxxxxxxxxxx http://www.netacquire.com
Archive administrator: postmaster@marples.name