Table of Contents

IPv6 - How do I disable IPv6 on Linux?



Note


Check IPv6

# ip a |grep inet6
# ifconfig |grep inet6


Ubuntu

Ubuntu 20.04 18.04 16.04

$ sudo vi /etc/sysctl.conf
....
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
....
$ sudo sysctl -p


RHEL/CentOS

RHEL/CentOS 8

nmcli connection modify xxx ipv6.method ignore

nmcli connection modify ens1 ipv6.method ignore
nmcli connection modify enp0s3 ipv6.method ignore


RHEL/CentOS 7

/etc/sysctl.conf or /etc/sysctl.d/disableipv6.conf

# vi /etc/sysctl.conf
...
net.ipv6.conf.all.disable_ipv6 = 1
...

# sysctl -p
temporally
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

or

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


RHEL/CentOS 5.X / 6.X

/etc/modprobe.conf or /etc/modprobe.d/ipv6.conf

options ipv6 disable=1