5

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.

17
  • 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 Mar 14, 2015 at 18:25
  • @Miline if you're asking if the entry stays there after reboot yes it does.
    – Scoopta
    Mar 14, 2015 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, 2015 at 20:28
  • @mchid does that space really matter?
    – Scoopta
    Mar 14, 2015 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, 2015 at 20:34

2 Answers 2

10

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.


Also, after making the following changes to /etc/sysctl.conf

net.ipv6.conf.eth0.disable_ipv6 = 1

Run the following command to apply the changes:

sudo sysctl -p

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

2
0

Neither the grub nor the sysctl solution worked for me. My guess is that systemd reenabled ipv6 during boot.

So I changed systemd to only configure ipv4 for my en* devices:

sudo vim /etc/systemd/network/en-all.network
[Match]
Name=en*
[Network]
DHCP=ipv4
LinkLocalAddressing=ipv4

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.