Centos 7 with IPV6 at Server4You

As of 2019-10-01, the hosting company server4you.com doesn’t support IPv6, but if you want to test IPv6 or support your IPv6 capable clients there are still a few tricks you can try.
A good way is to use a broker to create a 6in4 tunnel with your IPv4 to the IPv6 enabled internet.

***** Disclaimer *****
This guide DOES NOT WORK if you are using their offerings of the vServer family because it’s powered by OpenVZ, but it will work perfectly with the VDS family powered by KVM or with their dedicated servers.
This is NOT a “true” IPv6 solution as you will use a tunnel broker to make a 6in4 tunnel, but it gets the job done for most workloads.
***** End Of Disclaimer *****

You start by creating an account at Hurricane Electric and then creating a tunnel there pointing to your server IP address, you should preferably choose a tunnel server that is near your server but this is not strictly necessary.

After you made your account and created your tunnel you’ll need to enable IPv6 in your server as the default Centos7 server4you restore image comes with it disabled.

First log in to your server and edit the “/etc/sysctl.conf” file.

Find the lines that are like this

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

And change them to this

net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0


If you cannot find those lines simply append it to the file.

Reboot your server or alternatively run:

systctl -p

After rebooting/reloading you’ll need to create a new systemd unit to rebuild the tunnel automatically every time you restart your server, to do it create the file “/etc/systemd/system/he-tunnel.service” with the following content, edit the lines 8 and 10 with the information you get from hurricane electric.

Description=he.net IPv6 tunnel

ExecStart=/usr/sbin/ip tunnel add he-ipv6 mode sit remote <HE_IPV4_ENDPOINT> local <YOUR_SERVER_IPV4_ADDRESS> ttl 255
ExecStart=/usr/sbin/ip link set he-ipv6 up mtu 1480
ExecStart=/usr/sbin/ip addr add <YOUR_IPV6_ADDRESS_BLOCK> dev he-ipv6
ExecStart=/usr/sbin/ip -6 route add ::/0 dev he-ipv6
ExecStop=/usr/sbin/ip -6 route del ::/0 dev he-ipv6
ExecStop=/usr/sbin/ip link set he-ipv6 down
ExecStop=/usr/sbin/ip tunnel del he-ipv6


Reboot your server to reload the systemd units, or alternatively reload the rules with

systemctl daemon-reload

After rebooting/reloading you can test the service unit with:

systemctl start he-tunnel.service 

To check if everything ran correctly run:

ip addr

The output of the command should have something like this if the tunnel is properly configured:

he-ipv6@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN group default qlen 1000
    inet6 <YOUR_IPV6_ADDRESS_BLOCK> scope global 
       valid_lft forever preferred_lft forever
    inet6 <IPV6_LOCAL_LINK_ADRESS> scope link 
       valid_lft forever preferred_lft forever

You can test IPv6 connectivity with:

ping6 ipv6.google.com

After making sure everything is working, you can enable the service with

systemctl enable he-tunnel.service

Now reboot your server for the last time and if all gone well you should be reachable on the IPv6 internet, don’t forget to update your firewall rules.
Welcome to the IPv6 enabled world.