Ubuntu 20.04 Focal Fossa Linux enables Internet Protocol Version 6 (IPv6) by default. However, in certain situations, some users may find it desirable to disable IPv6 support or to re-enable it after it has been disabled.
Disabling IPv6 support (Permanently)
Disable ipv6 built-in kernel module.
1. Edit /etc/default/grub and append ipv6.disable=1 to GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT as the following sample:
FROM:
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
TO:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"
2. Run the update-grub command to regenerate the grub.cfg file:
update-grub
3. Reboot the system to disable IPv6 support.