How To Disable IPv6 on Rocky Linux 9
IPv6, the latest version of the Internet Protocol, has been widely adopted to address the limitations of IPv4. However, there are scenarios where disabling IPv6 on your Rocky Linux 9 system might be necessary. This comprehensive guide will walk you through various methods to disable IPv6, ensuring optimal network performance and addressing specific configuration requirements.
Understanding IPv6 Status in Rocky Linux 9
Before diving into the disabling process, it’s crucial to understand the current IPv6 status on your Rocky Linux 9 system. This knowledge will help you make informed decisions about which method to use and verify the changes after implementation.
Checking Current IPv6 Status
To check the current IPv6 status, open a terminal and use the following command:
ip a | grep inet6
If you see output containing “inet6” addresses, it indicates that IPv6 is currently enabled on your system. If there’s no output, IPv6 is already disabled.
Method 1: Using NetworkManager
NetworkManager is a powerful tool for managing network connections in Rocky Linux 9. It provides both graphical (GUI) and command-line (CLI) interfaces for network configuration.
GUI Method
- Open the terminal and launch the NetworkManager Text User Interface (nmtui) by typing:
sudo nmtui
- Navigate to “Edit a connection” and select the network interface you want to modify.
- Scroll down to the “IPv6 CONFIGURATION” section and change it to “Ignore”.
- Save the changes and exit nmtui.
- Restart the network service to apply the changes:
sudo systemctl restart NetworkManager
CLI Method
For those who prefer command-line operations, follow these steps:
- List available network connections:
nmcli connection show
- Disable IPv6 for a specific connection (replace “CONNECTION_NAME” with your actual connection name):
sudo nmcli connection modify "CONNECTION_NAME" ipv6.method "disabled"
- Apply the changes by restarting the connection:
sudo nmcli connection up "CONNECTION_NAME"
Method 2: Kernel Parameter Configuration
Another effective way to disable IPv6 is by modifying kernel parameters. This method can be applied temporarily or permanently, depending on your needs.
Temporary Disabling
To disable IPv6 temporarily (until the next reboot), use the following commands:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
These commands disable IPv6 for all interfaces, default configurations, and the loopback interface, respectively.
Permanent Configuration
For a permanent solution, modify the /etc/sysctl.conf
file:
- Open the file with root privileges:
sudo nano /etc/sysctl.conf
- Add the following lines at the end of the file:
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
- Save the file and exit the editor.
- Apply the changes:
sudo sysctl -p
Method 3: GRUB Configuration
Modifying the GRUB bootloader configuration is another way to disable IPv6 system-wide. This method ensures that IPv6 is disabled from the moment the system boots up.
Manual GRUB Configuration
- Open the GRUB configuration file:
sudo nano /etc/default/grub
- Locate the line starting with GRUB_CMDLINE_LINUX and add ipv6.disable=1 to it:
GRUB_CMDLINE_LINUX="ipv6.disable=1 rhgb quiet"
- Save the file and exit the editor.
- Generate a new GRUB configuration:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
- For UEFI systems, also run:
sudo grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg
- Reboot your system to apply the changes:
sudo reboot
Using Grubby Tool
Rocky Linux 9 provides the grubby tool for easier GRUB management:
sudo grubby --update-kernel=ALL --args="ipv6.disable=1"
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg # For UEFI systems
Method 4: Network Scripts Configuration
For systems using traditional network scripts, you can disable IPv6 by modifying interface configuration files.
- Open the network interface configuration file (replace eth0 with your interface name):
sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0
- Add or modify the following lines:
IPV6INIT=no IPV6_AUTOCONF=no
- Save the file and exit the editor.
- Restart the network service:
sudo systemctl restart network
Troubleshooting Common Issues
While disabling IPv6 is generally straightforward, you might encounter some issues. Here are some common problems and their solutions:
Persistence Issues
If IPv6 keeps re-enabling after a reboot, ensure you’ve applied the changes permanently using the GRUB or sysctl.conf
methods.
Application Conflicts
Some applications might rely on IPv6. If you experience issues after disabling it, check the application’s documentation for IPv6 requirements.
Network Connectivity Problems
If you face connectivity issues after disabling IPv6, verify that your network doesn’t rely on IPv6 for certain services. You may need to reconfigure DNS settings or other network parameters.
Congratulations! You have successfully disabled IPv6. Thanks for using this tutorial to disable the IPv6 in Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Rocky Linux website.