How to Disable disable ipv6 on Linux (Step by Step Guide 2024)

An IP address is an Internet protocol address that is required for communication between two networking devices, Such as between your PC and router, or switch. Currently, most of devices use IPv4 and IPV6 is the most recent version of internet protocol (IP) designed to eliminate the long-anticipated address exhaustion problem of IPv4. if you’re having networking issues with Linux servers or desktops, and you’ve exhausted all possible areas, you might try disabling IPv6 of the network protocol. This would be helpful, Here in this post we go through steps to Disable disable ipv6 on Linux.

Checking IPv6 is Enabled or Not

Let’s start with Terminal. Open your terminal and run the below command

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

if the above command returns the value then IPv6 is currently active on your system. In Case it returns 1 it’s already disabled.

Disable IPv6 on Linux

Here is how to disable IPv6 on Red Hat- and Debian-based distributions.

  1. Open a terminal window. (by pressing Ctrl + Alt + T or Ctrl + Shift + T)
  2. Change to the root user. ( Type SU or Try out sudo -s instead su command)
  3. Issue the command sysctl -w net.ipv6.conf.all.disable_ipv6=1
  4. Issue the command sysctl -w net.ipv6.conf.default.disable_ipv6=1

To Re-enable IPv6 on Linux

sysctl -w net.ipv6.conf.all.disable_ipv6=0

sysctl -w net.ipv6.conf.default.disable_ipv6=0

That’s all, you have successfully disable IPV6 on Linux.

Here is another way to disable IPV6 on Linux/Ubuntu

Step 01: Open Terminal

Step 02: Enter gksudo gedit /etc/sysctl.conf and open the configuration file

Step 03: add the following lines at the end

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Step 04: After that run $ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

If it reports ‘1′ means you have disabled IPV6. If it reports ‘0‘ then please follow Step 4 and Step 5.

Step 05: Type the command sudo sysctl -p you will see this in the terminal.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Step 06: Repeat above “Step 4” and it will now report 1.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More