My ISP (Time Warner Cable) hands out IPv6 addresses with DHCPv6;
it will delegate a /56 if asked. So long as I keep refreshing the lease,
it won't renumber me. I have my cable modem set to bridge, and do all the
firewalling, NATing, etc., on a Debian box.
In what follows, eth0
is the internal interface.
The dhclient that ships with debian/ubuntu does not support asking for a prefix delegation, so I had to build one from sources.
- Get the ISC dhcp source.
- Get patches.
- Build, and install the client as
/sbin/dhclient6
if you don't want to do an actualmake install
, which would probably also require to figure out how to apply the Debian packaging changes.
Next, change the stanza for your external interface (in my case, eth1
) in /etc/network/interfaces
to this:
iface eth1 inet dhcp
up /sbin/dhclient6 -v -6 -P -Pl 56 -pf /run/dhclient6.eth1.pid -lf /var/lib/dhcp/dhclient6.eth1.leases eth1
down killall dhclient6
down service radvd stop
(there are many other ways to skin this particular cat, I opted for the one that involved the least amount of blood!)
Install ipv6
in /etc/dhcp/dhclient-enter-hooks.d/
, and
dhclient-ipv6-hook.py
in /usr/local/sbin/
.
Make sure the following sysctl
variables are set correctly:
net.ipv6.conf.eth1.accept_ra=2
net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.all.forwarding=1
(you need the first one so you can get the LL address of the default route from your ISP; at least I do).
ifdown eth1; ifup eth1
should do the trick.
In my case, I'm asking for a /56, I allocate a /64 to each of my interfaces, vlans, etc. I'm only showing one interface here, of course.
Thrashing through the compiled-in ::/64 prefix-length problem with
dhclient
I came acrosshttps://kb.isc.org/article/AA-01141/0/How-to-workaround-IPv6-prefix-length-issues-with-ISC-DHCP-clients.html
This looks like a reasonable alternative to the complex patch, assuming that a single changed prefix-length hint is sufficient
The Debian packaging isn't as bad as it once was, with
pbuilder
or the like keeping things a lot cleaner.https://wiki.ubuntu.com/PbuilderHowto
https://wiki.debian.org/BuildingTutorial
https://www.debian.org/doc/manuals/packaging-tutorial/packaging-tutorial.en.pdf
_Edit: I haven't had any luck getting ISC
dhclient
to send ania-prefix
hint in the Solicit message, even after changing that#define
_