Ubuntu-Server
Disabling Ipv6

To permanently disable IPv6 on Ubuntu 24 (or any recent version of Ubuntu), you can follow these steps. These instructions will disable IPv6 at the system level, so it won't be used by any applications or network interfaces.

1. Disable IPv6 via sysctl (recommended for persistent settings)

Ubuntu uses sysctl to manage kernel parameters. You can modify these settings to disable IPv6.

Steps:

  1. Open a terminal.

  2. Edit the /etc/sysctl.conf file or create a custom configuration file under /etc/sysctl.d/:

    sudo vim /etc/sysctl.d/99-disable-ipv6.conf
  3. Add the following lines to disable IPv6:

    # Disable IPv6
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
  4. Save the file and exit (press Ctrl+X, then Y to confirm, and Enter).

  5. Apply the changes immediately:

    sudo sysctl --system

2. Disable IPv6 via GRUB (alternative method)

This method modifies the boot loader (GRUB) to disable IPv6 during the system startup.

Steps:

  1. Edit the GRUB configuration file:

    sudo vim /etc/default/grub
  2. Find the line starting with GRUB_CMDLINE_LINUX and append ipv6.disable=1 to the existing options. For example:

    GRUB_CMDLINE_LINUX="... ipv6.disable=1"
  3. Save the file and exit (press Ctrl+X, then Y to confirm, and Enter).

  4. Update GRUB to apply the changes:

    sudo update-grub
  5. Reboot your system:

    sudo reboot

3. Verify IPv6 is Disabled

After rebooting, you can check if IPv6 is disabled by running the following command:

ip a | grep inet6

You should see no output, meaning there are no IPv6 addresses assigned to your interfaces.

Alternatively, you can use:

sysctl net.ipv6.conf.all.disable_ipv6
sysctl net.ipv6.conf.default.disable_ipv6

Both should return 1 indicating that IPv6 is disabled.