Simple way that worked for a very long time was adding in /etc/sysctl.conf

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

Afterwards sysctl -p for activation of the setting.
It works for a while, but suddenly the IPv6 is enabled.
We are facing two things:

  1. IPv6 is randomly enabled
  2. After restart of the server, IPv6 is enabled again.

Checking the proc:

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

I want this disabled, there is a postfix server and gmail is objecting while IPv6 is active.

  • However, seems to be ok lately (few months already), I didn't figure out what was wrong. Maybe some ubuntu update fixed that.
    – frank_108
    May 6, 2021 at 9:57

1 Answer 1


To permanently disable ipv6, you can update your grub file. You'll need administrative rights.

Edit /etc/default/grub with your preferred text editor. Make sure ipv6.disable=1 is added to the GRUB_CMDLINE_LINUX lines as follows:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"


sudo update-grub

And you should be good after a reboot.

  • Worked great for a few months, but now on 5.11.0-44 it still uses IPv6 even with setting ipv6.disable=1 :/
    – krubo
    Jan 16, 2022 at 23:35
  • 1
    It is no issue with, I'm running the same and still disabled. Double check if nothing has changed your grub config... linuxconfig.org/… Also you can check if ipv6 is really disabled in different ways golinuxcloud.com/linux-check-ipv6-enabled
    – Jakke
    Jan 18, 2022 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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