Use IPv6 In Linux

Here is a tutorial to help you assign IPv6 address to your Linux OS.

1. Check whether your kernel supports IPv6. Run the command:

sudo lsmod|less

2. Search the listing to see if ipv6 is there. If it isn't there try it with the command:

sudo /sbin/modprobe ipv6

Now issue the lsmod command to see if it is there. It should be.


3. The file to configure will be the standard network interface configuration. This will only work for static IP addresses. The file in question is /etc/network/interfaces. Most likely this is either not configured (if you are using DHCP) or set up for IPv4.

The details of our configuration:

IPv4 address: 162.82.1.65

IPv6 Address: 2002:c0a8:10a::

IPv4 gateway: 162.168.1.1

IPv6 gateway: 2002:c0a8:0101::

5. Add this to the /etc/network/interfaces file. The new file will look like this:

#IPV6 static configuration
iface eth0 inet6 static
pre-up modprobe ipv6
address 2002:c0a8:10a::
netmask 64
gateway 2002:c0a8:0101::


6. Now restart networking with the command:

/etc/init.d/networking restart

You should now have an IPv6 address enabled.

7. Before you assume everything is working, let’s make sure first. You can check your IP routing with the command:

ip -6 route show

The above command should return something like:

2002:c0a8:0100/64 dev eth0 proto kernel scope link src 2002:c0a8:10a

You can also check by pinging with the ping6 tool. A good IPv6 address to try is the Google address. Issue this command:

ping6 ipv6.google.com

If IPv6 isn’t working you will get error:

Network is unreachable

If IPv6 is working you will see the standard ping results in your terminal window.