Debian

Debian Disable ipv6 on Interface

When you run Debian 10, the IPv6 network connections are enabled by default. But, in most situations, you need to disable the default setting of IPV6. However, we will give you a complete demo on how to disable the IPV6 interface on Debian 10 system.

To execute all commands, you must have the privileges to run the system administrative commands.

First, check if IPV6 is enabled on your Debian system or not. Open the terminal by typing the “terminal” in the search bar, and then click on the displaying Terminal icon in search results. Use the following command to check your IP address:

$ ip a

The following result will show on your terminal to determine if IPV6 is enabled.

Disable IPV6 through systemctl:

Using the following three commands input, you can disable the IPV6 on your system:

$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

After running the above commands, the IPV6 services will be disabled on your Debian system, but this is only a temporary solution. When you restart your system, it will enable it again. Verify the status by typing the “ip a” command.

To disable these IPV6 connections, you need to use /etc/sysctl.conf file. Open this configuration file in any available editor. Here, we are using a nano editor for modifying this file, as shown in the command below:

$ sudo nano /etc/sysctl.conf

Now, paste the following lines in this file and save it:

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

Paste the below-mentioned line, if you have any specific network interface adopter such as “enp0s3”:

net.ipv6.conf.enp0s3.disable_ipv6 = 1

To verify the change settings, type the following command:

$ sudo sysctl -p

Method 1: Using sysctl.d directory

Create file in the /etc/sysctl.d directory using the following command:

$ sudo nano /etc/sysctl.d/disable-ipv6.conf

Paste the following line in this file:

net.ipv6.conf.all.disable_ipv6=1

Save and press ‘Ctrl +X’ to exit from this window.

Now, check the effect of the changes using the following command:

$ sudo sysctl -p -f /etc/sysctl.d/disable-ipv6.conf

Run the following command to verify the results:

$ ip a

As you can see in the above output, IPV6 connections have been disabled on this system.

Conclusion

We have provided you the brief information about how you can disable the IPv6 interface on your Debian 10 system. All these commands can also be executed on the Ubuntu system. If you find this article useful, then let us know with your feedback.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.