OVH VPS IPV6 CentOS 6 – add default route / persistent config after network restart / reboot

First of all, I had centos 7 and this made it worse because I would have to learn cloud-init crap as the VPS ip and ethernet files were overwritten with every reboot or network restart. So I reinstalled the VPS to centos 6.

 

The OVH guides on the internet are useless. Most of them say change the gateway ipv6 to ff:ff:ff:ff:ff -
( I will change my ipadddress to add xxxx to hide my actual ip )
so
2001:xxxx:0701:1100:0000:0000:0000:0001 would become 2001:xxxx:0701:11ff:ff:ff:ff:ff

I tried this for a day and got nowhere. I then used the full ipv6 gateway address and things started working.

 

So here is what worked for me:

add these to end of /etc/sysctl.conf:
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.all.disable_ipv6 = 0

add this to /etc/sysconfig/network
NETWORKING_IPV6=yes

run this command to enable the sysctl changes:
sysctl -p

 

my network device is called eth0 - change the following lines if yours is different!!

 

add this to /etc/sysconfig/network-scripts/ifcfg-eth0 (it should already contain a line IPV6INIT="yes"  - if not, add it.)
IPV6_AUTOCONF=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6ADDR=2001:xxxx:0701:1100:0000:0000:0000:0985/128
IPV6_DEFAULTGW=2001:xxxx:0701:1100:0000:0000:0000:0001

(you could probably also use netmask of 64 on your IPV6ADDR line instead of 128, but I read all sorts on the net, to use /56 or /48 and stuff. I had success using /128 but you might want /64 so you can add more ipv6 addresses. but i offer no assistance if /64 does not work for you)
remember to change xxxx to your IP.

 

Some rules do not stick after reboot or network restart. For this you must persistent static routes in

/etc/sysconfig/network-scripts/route6-eth0  (notice the route6 - ipv4 files would be called route-eth0 )

route6-eth0 contains this:
2001:xxxx:701:1100:0000:0000:0000:0001 dev eth0
::/0 via 2001:xxxx:701:1100:0000:0000:0000:0001 dev eth0

remember to change xxxx to your IP.

 

restart networking

service network restart

(never use ifup eth0 in SSH or you lose access and have to use OVH control panel KVM to get shell access)

ping6 ipv6.google.com - hopefully this works for you now.

ping6 your server from somewhere else if you can.

 

I disable ip6tables while I got this working and testing ping from other servers..... be sure to enable firewall again after.

 

hope this helps. this took me days to get working. grrr ovh  🙁