Linux Commands

How to Disable IPv6 on Ubuntu 24.04

IPv6 is the latest version of IP (Internet Protocol) to provide IP addressing and enhance the security of connected devices. However, specific applications or networks don’t support IPv6, making it hard for the user to connect the device to the server.

In this case, you need to disable IPv6 from the device. So, if you want to learn how to disable IPv6 on Ubuntu’s latest version, this guide is for you. In this guide, we are going to disable IPv6 on Ubuntu 24.04.

How to Disable IPv6 on Ubuntu 24.04

First, use the following command to check if IPv6 is enabled in your system.

ip addr

ip-addr-command-in-linux

The above output shows ‘int6’, which indicates that IPv6 is active in your system.

checking-int-6-into-the-file

Now, to disable the IPv6, open the ‘sysctl configuration’ file using the following command:

sudo nano /etc/sysctl.conf

systemd.conf-file-in-nano-editor

Add the above lines at the end of the file and save the file. These lines disable the IPv6 as well as the loopback interface.

Next, apply the new settings using the following command: and it will show the newly added lines in the ‘sysctl configuration’ file as follows

sudo sysctl -p

sysctl-command-example

Finally, IPv6 is disabled in your system, and you can verify it using the same IP command again. You can see in the following output that ‘int6’ has not appeared:

ip-addr-command-example

Apart from this, you can also check the enablement of IPv6 using the below command as follows:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

disable_ipv6

If this command’s output is 0, it means IPv6 is enabled, whereas if it comes up with 1, it indicates that IPv6 is disabled.

Conclusion

So this was all about the easiest way to disable IPv6 on Ubuntu 24.04 without facing any issues. In some scenarios, we need to disable the IPv6 for compatibility with some applications and networks that don’t support the IPv6. Please remember to enable IPv6 again because it can create issues while using the internet. 

About the author

Prateek Jangid