How to disable ipv6 on a specific interface in linux?

You can disable it from /etc/sysctl.conf with this line:

net.ipv6.conf.eth0.disable_ipv6 = 1

Take a look at /proc/sys/net/ipv6/conf/eth0. There are many options you can set in that directory, like leaving IPv6 enabled but disabling autoconf etc.


$ sudo sysctl -w net.ipv6.conf.eth0.disable_ipv6=1

deprecates

# echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6

In order to ensure that this change persists across reboots, you'll want to add this line to your /etc/sysctl.conf file:

net.ipv6.conf.eth0.disable_ipv6=1

Note that using the /etc/sysconfig/network-scripts/ifcfg-eth0 file is non-portable.


You should be root to set network parameter below:

echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6