This article will demonstrate how to in Redhat disable the IPv6 protocol. This is especially useful and common in private networks that have no need to support IPv6. Private networks usually have more than enough IPv4 addresses, and enabling IPv6 can introduce a number of unexpected networking issues.
IPv6 identifies a computer or node on a network the same as IPv4, with the difference being a much larger set of addresses to choose from.
The examples in this article are based on RHEL 8.7 Ootpa.
cat /etc/redhat-release Red Hat Enterprise Linux release 8.7 (Ootpa)
Note that privileged access is required to disable and enable IPv6 at the system level.
Redhat 8 Disable IPv6
Temporarily disable IPv6
To temporarily disable IPv6 on Redhat, use the sysctl utility.
sysctl -w net.ipv6.conf.all.disable_ipv6=1
Permanently disable IPv6
To permanently disable IPv6 on Redhat you must modify the GRUB boot menu.
First, display the kernelopts argument list.
# grub2-editenv - list | grep kernelopts kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet
Then append the ipv6.disable=1 to the output of the previous command.
# grub2-editenv - set "kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet ipv6.disable=1"
Reboot your system and verify IPv6 is disabled. Now that IPv6 is enabled at a system level permanently, if you need to re-enable it temporarily for testing, move on to the next section.
Disable IPv6 for a specific connection
To disable IPv6 for a specific connection or device in Redhat, use the Network Manager nmcli utility.
nmcli connection modify <device> ipv6.method "disabled"
The restart Network Manager and the device.
systemctl restart NetworkManager nmcli con down <device> && nmcli con up <device>
Redhat 8 Enable IPv6
Temporarily enable IPv6
To temporarily enable IPv6 on Redhat, use the sysctl utility.
sysctl -w net.ipv6.conf.all.disable_ipv6=0
Permanently enable IPv6
To permanently enable IPv6 on Redhat, undo the “permanently disable IPv6” commands defined previously in this article.
Confirm IPv6 is disabled
To confirm that IPv6 has been disabled on Redhat, run the following command.
ip a | grep inet6
If no results are returned you know that IPv6 is disabled. All of the addresses should be IPv4, defined by inet.
Alternatively, you can show the specific device or connection IPv6 status.
ip a show <device>
To verify IPv6 is disabled for a specific device, look in the configuration file for that device.
0 – enabled
1 – disabled
This article has demonstrated how to enable and disable IPv6 in Redhat both temporarily and permanently. Leave us a comment if you have any questions or would like to see additional examples of managing IPv6 in Redhat. Go here to read more of our articles.
Leave a Reply