4

I'm looking to permanently disable IPv6 on a specific interface because it's broken and my question on Superuser to fix it is dead so how can I go about doing that? I've added net.ipv6.conf.eth0.disable_ipv6=1 to /etc/sysctl.conf but it doesn't work for some reason. At the moment I just use the sysctl command every time I turn on my PC to disable it.

  • 2
    Do you see value in sysctl.conf persistent after reboo....you can also put up sysctl -w net.ipv6.conf.$IFACE.disable_ipv6=1 in the /etc/interface file – Milind Dumbare Mar 14 '15 at 18:25
  • @Miline if you're asking if the entry stays there after reboot yes it does. – Scoopta Mar 14 '15 at 19:54
  • your problem is syntax in the sysctl.conf file you need to use the syntax net.ipv6.conf.eth0.disable_ipv6 = 1 instead of net.ipv6.conf.eth0.disable_ipv6=1 – mchid Mar 14 '15 at 20:28
  • @mchid does that space really matter? – Scoopta Mar 14 '15 at 20:29
  • @Scoopta yes, I believe so. If you look at the default options in that file they all use the same syntax and I believe I've seen this issue before with setting swappiness. – mchid Mar 14 '15 at 20:34
7

First, edit /etc/default/grub and find the line:

GRUB_CMDLINE_LINUX=""

and change the line to say this instead (this will disable ipv6 completely):

GRUB_CMDLINE_LINUX="ipv6.disable=1"

alternatively, to leave the ipv6 stack functional but to disable assignment of ipv6 addresses you can use the following option instead:

GRUB_CMDLINE_LINUX="ipv6.disable_ipv6=1"

Finally, run:

sudo update-grub

and reboot to apply the changes.

This will disable ipv6 at the kernel level so that it is never enabled from the get-go.


Furthermore, you seem to be using the wrong syntax in the file /etc/sysctl.conf.

Instead of:

net.ipv6.conf.eth0.disable_ipv6=1

you should use this instead:

net.ipv6.conf.eth0.disable_ipv6 = 1

When making command line changes such as

sudo sysctl.conf

there is no space between the = and the options, however, directly editing the /etc/sysctl.conf file requires a space before and after "=".


Finally, if using the option to disable ipv6 in sysctl.conf, you need to also make sure ipv6 is commented out in /etc/hosts. See here https://wiki.archlinux.org/index.php/IPv6#Disable_functionality

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.