To enable or disable the IPv6 address on an Ubuntu Linux machine, please follow these instructions.
Step 1: Check Current IPv6 Configuration
To enable or disable IPv6, first, check the current status of IPv6 from your terminal:
ip -6 addr show
If you see “inet6” after executing the command, it indicates that the IPv6 is enabled on your Ubuntu system.
Now, let’s start to disable the IPv6 on Ubuntu system.
Step 2: Open the GRUB Configuration File
Run the provided command to access the GRUB configuration file:
sudo nano /etc/default/grub
Step 3: Disable IPv6
Within the GRUB configuration file, locate the line containing “GRUB_CMDLINE_LINUX_DEFAULT” and add “ipv6.disable=1” using the following syntax:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
Enable IPv6
To enable IPv6 on Ubuntu, set “GRUB_CMDLINE_LINUX_DEFAULT” to “ipv6.disable=0” in the GRUB configuration file:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=0"
Step 4: Update GRUB
Run the update-grub command to save and update the changes in the GRUB Configuration file:
sudo update-grub
After successfully updating the GRUB file, you will see “done” in your output.
Step 5: Reboot
Without rebooting your Ubuntu machine, the changes made in the GRUB file may not apply. Run the reboot command to apply the changes by restarting your system:
reboot
Step 6: Verify IPv6 Status
Once your Ubuntu system reboots, verify that IPv6 has been disabled on Ubuntu Linux:
ip -6 addr show
An empty output after running the command indicates that IPv6 has been disabled on your system.