Ubuntu 22.04 – method 1

Edit /etc/default/grub and append ipv6.disable=1 to GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT like the following sample: GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"GRUB_CMDLINE_LINUX="ipv6.disable=1" then run:update-grubreboot

Ubuntu 22.04 – method 2

add to  /etc/sysctl.conf the following: net.ipv6.conf.all.disable_ipv6=1net.ipv6.conf.default.disable_ipv6=1net.ipv6.conf.lo.disable_ipv6 = 1 then run:sysctl -p