Enable IPV6 addresses from pool permanently
I'm trying to set up a few web servers on one VPS, each with it's own IPV6 address. I got an IPV6 Pool from Linode, I followed their instructions on setting them up. Once done I am able to ping the new IPV6 addresses remotely and everything looks great. But after some time (say between 5 and 30 minutes) it stops working. Rebooting doesn't help. But if I revert to "Auto-configure Networking" in the profile and start over again, it works for awhile. I have tried many variations, and looked for help in these forums and elsewhere, but no luck.
Any ideas of what I'm doing wrong?
I have Ubuntu 16.04, and my /etc/network/interfaces file looks like this:
# The loopback network interface
iface lo inet loopback
# This is an autoconfigured IPv6 interface
# iface eth0 inet6 auto
# The primary network interface
iface eth0 inet static
# Add DNS resolvers for resolvconf. Can mix IPv4 and IPv6.
dns-nameservers 18.104.22.168 2600:3c01::5
# IPv6 gateway and primary address.
iface eth0 inet6 static
Auto-configure networking automatically statically reconfigures your networking file on boot, so any changes to it (adding the /64 block) would be removed after the Linode is rebooted.
In order to configure the /64 block, you'll first want to ensure that you disable Auto-configure networking. Once you do that you can add the following to your
# IPv6 gateway and primary address. iface eth0 inet6 static address 2600:3c01:e000:02b9::1/64 gateway fe80::1 # Add a second IPv6 address. iface eth0 inet6 static address 2600:3c01:e000:02b9::2/64
Once you add that, you can reboot your Linode to confirm that it will remain statically configured.
You can confirm by running the
ip a| grep "inet" command, it should look something like this:
root@localhost:~# ip a| grep "inet" inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host inet $ipv4address/24 brd 22.214.171.124 scope global eth0 inet6 2600:3c01:e000:02b9:::2/64 scope global inet6 2600:3c01:e000:02b9:::1/64 scope global inet6 $linklocalipv6/64 scope link
I hope that helps!
That won't work out of the box (or it will for a bit then break), because you're not configuring the primary address, which is needed for the routed /64. When configuring IPv6 addresses statically with /etc/network/interfaces, SLAAC is completely disabled, so you have to configure every address you want to use, including the primary. Your /etc/network/interfaces (or some file in /etc/network/interfaces.d) should contain all of this:
iface eth0 inet6 static address 2600:3c01::<primary IPv6>/64 gateway fe80::1 iface eth0 inet6 static address 2600:3c01:e000:02b9::1/64
To add more addresses, just add another block, like this:
iface eth0 inet6 static address 2600:3c01:e000:02b9::2/64
Victory! I got it my IPs up and running without failing. Thanks to both dwfreed and hmorris for your help.
In addition to your suggestions, I took out the following line from my /etc/network/interfaces file:
That line wasn't in the sample in the documentation, but I thought it was necessary. Taking it out, along with the other tips solved my problem.