How to disable IPv6 on your Linux machine

For those who noticed their WAN IP address started showing as IPv6

The following command is used to temporary disable IPv6 on a Linux system.

echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6

It writes the value 1 to the disable_ipv6 file for all network interfaces in the ipv6 configuration.

This will temporarily disable IPv6 for the current session, and IPv6 functionality will be turned off.

However, this change is not persistent, meaning it will not survive a system reboot.

For permanent change:

Open the configuration file using a text editor:

sudo vi /etc/sysctl.conf


sudo vi /etc/sysctl.d/99-disable-ipv6.conf

You can create a new file in the /etc/sysctl.d/ directory to isolate changes and avoid modifying the main configuration file.

Add the following line to the file:

net.ipv6.conf.all.disable_ipv6 = 1

Save the file and exit the text editor.

To apply the changes without rebooting, run:

sudo sysctl -p

This will make the change persistent, and IPv6 will be disabled after a reboot.

Please be aware that disabling IPv6 can have implications for certain network services and applications that rely on IPv6.

It’s generally recommended to leave IPv6 enabled unless you have specific reasons for disabling it.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *