Disabling IPv6 on a single interface

Autoconf in part of the basic functionality of IPv6. RA announcements are not DHCP, and the RA server does not assign addresses. RA is much closer to the IPv4 auto-configuration done on the 169.254.0.0/16 IP range. If privacy is enabled, your IPv6 address will change over time. Your old address will be retired and eventually removed.

You can disable ipv6 autoconf easily with the command:

sudo sysctl -w net.ipv6.conf.all.autoconf=0

Substitute all with the interface name to disable one interface. Replace autoconf with disable_ipv6 to disable IPv6. Create a file in /etc/sysctl.d with the variable assignments you want to have the setting applied during startup.

To find all the ipv6 related settings run the command:

sudo sysctl -a | grep ipv6 | less

To check if IPv6 is enabled or disabled

$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

0 means it’s enabled and 1 is disabled.

To disable IPv6

$ su -
# nano /etc/sysctl.conf

and add these lines to sysctl.conf file

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

Save sysctl.conf file with new config, then reboot your system

# reboot

Check your system again

$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

Now you should see “1″ means IPv6 has been disabled on your system.

From http://namhuy.net/1419/disable-ipv6-ubuntu-linux-mint.html


Similar to, but different from, one of the other answers, I tried this with a great deal of joy:

Add a sysctl file in /etc/sysctl.d to disable ipv6 - not universally, though, just as an interface default state:

net.ipv6.conf.default.disable_ipv6=1

Then, in the interfaces file and for only the interfaces you wish to have ipv6 on, add:

iface eth0 inet dhcp # .. or whatever
up sysctl -w net.ipv6.conf.$IFACE.disable_ipv6=0

... thus, interfaces don't get IPv6 addresses when they come up (as currently) but can be persuaded to have them in specific cases. You could no doubt disable RAs before enabling ipv6 if that's what you wanted, too.

NB: I suspect you'll run into issues with VLAN named interfaces (e.g. eth0.100) and will have to spell that out in the 'up' command as 'eth0/100' rather than $IFACE, which will have the wrong format - I haven't tested, but that seems to be how sysctl views the world.