Enable IPv6 for Server

We can check the current state of the IPv6 address configuration by typing:

$ ip -6 addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 2604:a880:400:d0::218:2001/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::601:c0ff:fea1:4101/64 scope link
       valid_lft forever preferred_lft forever

The command to set the IPv6 address is:

$ sudo ip -6 addr add 2604:a880:400:d0::218:2001/64 dev eth0

Setting the gateway

$ sudo ip -6 route add default via 2604:a880:400:d0::1 dev eth0

Your IPv6 connection should now be configured. This will be configured until the next boot. Continue on if you want to make these changes persistent.

Making the IPv6 Configuration Persistent

If you are on Ubuntu or Debian, you will need to edit the /etc/network/interfaces file. Open this with sudo privileges in your text editor:

$ sudo vim /etc/network/interfaces

Inside, you will see a section for each of the networks that you are already configured to use. First, look for the dns-nameservers parameter and remove this line from the IPv4 section. We will add it to the IPv6 section instead.

We must add a new section for our IPv6 address. It should look like this:

iface eth0 inet6 static
        address 2604:a880:400:d0::218:2001
        netmask 64
        gateway 2604:a880:400:d0::1
        autoconf 0
        dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888 209.244.0.3

When you are finished, save and close the file. Your IPv6 connection should be brought up at boot now.

Check IPv6 settings of your system:

$ sudo sysctl -a | grep ipv6

If we found

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

that means system has disabled IPv6, run sudo sysctl -w net.ipv6.conf.eth0.disable_ipv6=0 to enable IPv6 on eth0 temporary before set IPv6 address. If enable IPv6 permanently, edit /etc/sysctl.conf file, and set IPv6 section like following

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

IPv6 should now be up and running on server.

0.00 avg. rating (0% score) - 0 votes