blog posts

How to configure IPv6 on CentOS

What is IPv6?

First, let’s learn more about IPv6 and explore why IPv6 is important. Since devices are assigned a unique IP address to identify and locate definitions, more addresses are required to connect devices. IPv4 was the first public use version of the Internet Protocol, but its limitations led the IETF to formalize a successor protocol. And this successor was IPv6. In addition to the larger address space, IPv6 offers other technical advantages. IPv4 and IPv6 are not designed to be interoperable. Therefore, direct communication between them is impossible, complicating the transition to IPv6. However, several transmission mechanisms have been devised for this. In this article, we want to introduce you to enable and add IPv6 in CentOS virtual server.

In order to understand this tutorial better, you can order your CentOS virtual server on virtual server purchase page.

Advantages of IPv6

Using IPv6 allows you to experience faster connections and better data. Due to a false belief, people disable IPv6 to speed up their internet connection, but disabling it doesn’t do it. However, it may be a quick fix but it will surely cause problems later. By default, IPv6 is enabled on Windows, Linux, and other operating systems because they all have built-in IPv6 support. You must join the movement to IPv6. Not only can disabling IPv6 cause problems, but IPv4 must be replaced with IPv6. The main difference with IPv6 is that it uses a 128-bit IP address (it can support 2^128 Internet addresses).

Advantages and features of IPv6:

1- No more DHCP, easier management

2- There is no more news about network address translation

3- There is no more news about private addresses

4- Internal identity verification and privacy support

5- Simpler header format

6- Better multicast routing

7- Automatic configuration

8- Simple and more efficient routing

9- Actual quality of service (QoS), which is also called “flow marking”.

10- Larger address space

11- Extensibility

12- Efficient and hierarchical addressing and routing infrastructure

13- Internal security

14- New protocol for neighbor node interaction

How to add IPv6 on CentOS server

As you learned, IPv6 was developed to deal with the long-anticipated obsolescence of IPv4. In this section, you’ll learn how to add IPv6 to your CentOS server for better routing, routed data streams, simplified network configuration, security, and more.

How to Check IPv6 Status on CentOS

As we mentioned, IPv6 is usually enabled by default in Linux. However, you can check if IPv6 is enabled on your CentOS system in two ways.

The first method shows you by running the following command:

sudo sysctl -a | grep ipv6.*disable

In the output of the above command, a value of 0 means that IPv6 is enabled on your node and 1 indicates that IPv6 is disabled.

The second way to check if IPv6 is enabled is by looking at the network interface in the /etc/network-scripts/ directory. So. Use the following command:

IPV6 options

Since you’ll see IPv6 options in the output of the above commands, let’s see what each one means:

IPV6INIT=yes: Initializes this interface for IPv6 addressing.

IPV6_AUTOCONF=yes: This enables automatic IPv6 configuration for the interface.

IPV6_DEFROUTE=yes: This indicates that the IPv6 default route is assigned to the interface.

IPV6_FAILURE_FATAL=no: indicates that the system will not crash even when IPv6 fails.

 

Once you are sure IPv6 is enabled, use the following command to check the IPv6 addresses of your interfaces:

ip a

Or :

ip -6 addr

How to disable and enable IPv6 in CentOS?

You can temporarily disable IPv6 on your server. To do this, use the following commands:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1

ip -6 addr

If, for any reason, you need to permanently disable IPv6, you must edit the GRUB file /etc/default/grub. In the line GRUB_CMDLINE_LINUX, add the ipv6.disable=1 argument.

You must reboot your system to apply the changes.

And to enable IPv6 run the following command:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0

Finally, you need to restart NetworkManager for the changes to take effect:

sudo systemctl restart NetworkManager

Conclusion

In this article, IPv6 was introduced to you and you learned how to add IPv6 in CentOS. Today, most systems are slowly moving away from IPv4. It is not recommended that you do the configuration manually because manually configuring IPv6 is error prone and very difficult.