Linux: Disable IPv6

Hi,

to disable IPv6 on a Linux system you have to set some variables with sysctl.

root@debdev ~ # sysctl -w net.ipv6.conf.all.disable_ipv6=1
root@debdev ~ # sysctl -w net.ipv6.conf.default.disable_ipv6=1
root@debdev ~ # sysctl -w net.ipv6.conf.lo.disable_ipv6=1

The settings switches IPv6 immediately off.

This can also be set in the /proc filesystem

root@debdev ~ # ls -l /proc/sys/net/ipv6/conf
dr-xr-xr-x 1 root root 0 May 29 11:04 all
dr-xr-xr-x 1 root root 0 May 29 11:04 default
dr-xr-xr-x 1 root root 0 May 29 09:20 eth0
dr-xr-xr-x 1 root root 0 May 29 09:20 lo
root@debdev ~ # echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
root@debdev ~ # cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1

But this does not survive a reboot. You have to add those variables to /etc/sysctl.conf or create a file /etc/sysctl.d/10-disable-IPv6.conf with the following content


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

To read and set the values from the sysctl file(s) use

root@debdev ~ # sysctl -p

Michael

Advertisment to support michlstechblog.info

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.