How to Configure IPv6 Network on CentOS/RHEL 8

IPv6 addressing was developed in anticipation of depletion of the IPv4 addresses. It is meant to solve the exhaustion of IPv4 addresses through the use of a much wider network addressing space. An IPv6 address is a 128-bit number comprising 8 colon-separated groups each made up of 4 hexadecimal numbers.

Read Also: What’s wrong with IPv4 and Why we are moving to IPv6

An example of an IPv6 address is shown below:

2001:1:1:1443:0:0:0:400

IPv6 is usually enabled by default on CentOS/RHEL 8. To check if IPv6 is enabled on your system, run the command:

$ sudo sysctl -a | grep ipv6.*disable
Check IPv6 Support in RHEL 8
Check IPv6 Support in RHEL 8

The value 0 indicates that IPv6 is active on your node. A value of 1 shows that IPv6 is disabled. Therefore, from the output above, IPv6 is enabled.

Another method of checking if IPv6 is enabled is by viewing your network interface at the /etc/network-scripts/ directory. In our case, this will be the /etc/sysconfig/network-scripts/ifcfg-enps03 file.

So let’s execute the command below and check if IPv6 is enabled.

$ cat /etc/sysconfig/network-scripts/ifcfg-enps03

Be on the lookout for the folIowing IPV6 options as shown:

  • IPV6INIT=yes – This initializes the interface for IPv6 addressing.
  • IPV6_AUTOCONF=yes – This enables the IPv6 auto-configuration for the interface.
  • IPV6_DEFROUTE=yes – This indicates that the default IPv6 route has been assigned to the interface.
  • IPV6_FAILURE_FATAL=no – indicates that the system won’t fail even when IPv6 fails.
Check IPv6 Support
Check IPv6 Support

The output above confirms that IPv6 addressing is enabled. On the terminal, you can check the IPv6 address of your interfaces by running the IP commands below.

$ ip a
OR
$ ip -6 addr

Be on the lookout for the inet6 prefix as shown below.

Check IPv6 IP Address
Check IPv6 IP Address

To temporarily disable IPv6, run the command:

$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
$ ip -6 addr
Disable IPv6 Address
Disable IPv6 Address

To enable IPv6, run the command:

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

Then restart NetworkManager for the changes to apply.

$ sudo systemctl restart NetworkManager
Enable IPv6 Address
Enable IPv6 Address

To permanently disable IPv6, edit the GRUB /etc/default/grub file. In the line, GRUB_CMDLINE_LINUX, append the argument ipv6.disable=1 at the end of the line as shown.

Disable IPv6 Address Permanently
Disable IPv6 Address Permanently

To apply the changes, reboot your system.

Just like IPv4, a manual configuration of IPv6 is possible using the nmtui and nmcli tools. However, this is not recommended because the manual configuration of IPv6 is prone to errors and is quite arduous.

Furthermore, it’s quite a task keeping track of which IPv6 addresses are assigned to what systems. Chances are that you are likely to mess up your configuration.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.