How to disable IPv6 on Ubuntu 22.04 Jammy Jellyfish
This guide will show you how to disable IPv6 on Ubuntu 22.04 Jammy Jellyfish. While IPv6 is essential for the future, many systems and applications still depend on IPv4, which can cause compatibility issues with IPv6.
For instance, if a software repository supports IPv6, the APT package manager will default to using it, even if your ISP doesn’t support IPv6.
Method 1: Disable IPv6 via the GRUB Boot Loader
This method is straightforward but requires a system reboot.
GRUB, the standard Linux boot loader, can be configured by editing its settings in a text editor such as Nano.
sudo nano /etc/default/grub
Locate this line:
GRUB_CMDLINE_LINUX=""
Change it to:
GRUB_CMDLINE_LINUX="ipv6.disable=1"
Save and exit (press Ctrl+O
to save and Ctrl+X
to exit in Nano). Then, update the GRUB boot menu with:
sudo update-grub
Reboot your system:
sudo shutdown -r now
Method 2: Disable IPv6 via sysctl
You can also disable IPv6 by adjusting kernel parameters. Instead of editing /etc/sysctl.conf
, create a custom configuration file to ensure changes persist across upgrades.
sudo nano /etc/sysctl.d/60-custom.conf
Add the following lines:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
If your system uses a wireless card, add this line, replacing wlan0
with your wireless interface name:
net.ipv6.conf.wlan0.disable_ipv6 = 1
Save and close the file. Apply the changes with:
sudo sysctl -p
sudo systemctl restart procps
Check if IPv6 is disabled by running:
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
This file will keep IPv6 disabled after reboot unless you remove these lines.
Disable IPv6 in Netplan
If your Ubuntu server uses Netplan for network configuration, you need to disable IPv6 in its config file. For example, in /etc/netplan/10-wifi.yaml
, add:
link-local: [ ipv4 ]
Then apply the Netplan changes:
sudo netplan apply
Disable IPv6 in NetworkManager
For Ubuntu desktop users, NetworkManager may assign an IPv6 address after resuming from sleep. Disable IPv6 in NetworkManager through the network settings. Select the IPv6 tab and set it to “off,” then apply.
Restart NetworkManager with:
sudo systemctl restart NetworkManager
Disable IPv6 in APT
To disable IPv6 specifically in APT, create a configuration file:
sudo nano /etc/apt/apt.conf.d/99force-ipv4
Add the line:
Acquire::ForceIPv4 "true";
Save and close the file. From now on, APT will use IPv4 exclusively.
And that’s it! This guide should help you disable IPv6 on Ubuntu 22.04 Jammy Jellyfish.