IP addresses provide an identification and address to devices in a network so that they can communicate with other devices. These IP addresses need to be unique so that the device can be uniquely identified with in the network.
Historically, Internet Protocol (IP) version 4 (or IPv4) was used to assign addresses. As the number of devices and networks on the internet increases, the number of addresses that the version 4 can generate has proved to be insufficient. IP version 6 (IPv6) was introduced to combat this exhaustion and also to improve efficiency of packet header processing.
IPv6 uses 128 bits instead of the 32 bits used by IPv4, thus providing a larger address space. We will how you can enable IPv6 on your Linux machine, assuming that you network or DHCP server supports IPv6 allocation.
Most modern distros come with ipv6 enabled by default. So, it is very likely that you would want to disable IPv6.
disable ipv6 in linux
Occasionally, IPv6 do cause issues with networking which means you might want to disable IPv6, at least for debugging purposes. You will need to have administrative privileges or root access to change your network configuration. As a root user, execute
bash(root)# sysctl -w net.ipv6.conf.all.disable_ipv6=1 bash(root)# sysctl -w net.ipv6.conf.default.disable_ipv6=1 bash(root)# sysctl -w net.ipv6.conf.lo.disable_ipv6=1 bash(root)# sysctl -p
Some distros use the /etc/sysctl.conf file to configure these values. In that case, Also modify the /etc/sysctl.conf file to add the above values to the file. That will make the changes more permanent and persist the changes across reboots.
enable ipv6 in linux
If you like to enable (or re-enable) IPv6 then you use ‘0’ instead of ‘1’ in the above configuration settings.
bash(root)# sysctl -w net.ipv6.conf.all.disable_ipv6=0 bash(root)# sysctl -w net.ipv6.conf.default.disable_ipv6=0 bash(root)# sysctl -w net.ipv6.conf.lo.disable_ipv6=0 bash(root)# sysctl -p
If you have also modified the sysctl configuration, then modify the file to change the values to ‘0’.
If you use some distros such as Gentoo or Arch, and you compile your own kernel, you might want consider recompiling the kernel with IPv6 disabled.