How to Disable IPv6 on Debian 10

In this short article, I explain how to disable IPv6 in the Debian 10 network stack. Why would one want to do this? Most likely if you have connection problems and cannot reach servers on the Internet from your Debian system using IPv6, while it works using IPv4. Disabling IPv6 should always be the last resort. If you can't fix it on your network, for example, because your Internet access provider blocks IPv6, then the only other option is to disable it on your server, and that's what I'll describe below.

Disable IPv6 Networking on Debian 10

I'll run the commands below as root user. If you are not logged in as root, then run either "su -" first or prepend the command "sudo" to all commands. One way to disable IPv6 networking is to edit the sysctl.conf file. Open /etc/sysctl.conf file with an an editor:

nano /etc/sysctl.conf

And add the following line at the end of the file:

net.ipv6.conf.all.disable_ipv6 = 1

This will disable IPv6 on all network adapters. if you want to disable it just for one adapter, e.g. the external network device ens33, then use this instead:

net.ipv6.conf.ens33.disable_ipv6 = 1

Save and close the file in nano. Then apply the changes with the command:

sysctl -p

An alternative way to edit sysctl.conf with an editor is to run these two commands:

echo 'net.ipv6.conf.all.disable_ipv6 = 1' > /etc/sysctl.d/90-disable-ipv6.conf
sysctl -p -f /etc/sysctl.d/90-disable-ipv6.conf

The first one created a file /etc/sysctl.d/90-disable-ipv6.conf which contains the configuration setting to disable IPv6 and the second one applies the change.

Leave a Comment