5

How does one disable IPv6 completely (for all interfaces, resp. for the whole machine?

Keep in mind, I don't want any kind of GUI solution.


OS in question:

  • Linux Mint 18.x Cinnamon 64-bit

  • GNU/Linux Debian 9.x Cinnamon 64-bit

1 Answer 1

8

One needs to edit the following file:

/etc/sysctl.conf 

to add the following lines, preferably to the end of the file:

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

Once done, you may either reboot the machine, or type the following:

sudo sysctl --load=/etc/sysctl.conf 

For other OSes it might be worth noting, if it does not read that file at boot time, there's an alternative approach.

One needs to edit the following file:

/etc/default/grub 

to add the following appendix:

ipv6.disable=1 

to the following variable:

GRUB_CMDLINE_LINUX_DEFAULT 

so it might look like for instance in my case like this:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash" 

Once edited, you need to call:

sudo update-grub 

and reboot the machine.


But as pointed out by Rui F Ribeiro, you should do both methods, because:

  1. If you in the future upgrade allow update of your grub file, you have the safety in form of sysctl settings.

  2. With only the sysctl method, the ipv6 module is still loaded.

2
  • 1
    Disabling the entire IPv6 while helping in some situations, also creates other problems that must be corrected, namely postfix, xinetd, and other couple of daemons are expecting nowadays to have IPv6 in the Debian default configuration and wont go up anymore until you fix the config. Commented Nov 3, 2017 at 23:50
  • @RuiFRibeiro absolute true. Best is to block ipv6 per hardware firewall or router. In the end it makes absolutly no sense to switch on ipv6 or udp6. Unless you want to open barn doors. I really don't know of any application that needs this and doesn't work with ipv4. Commented Jun 28, 2022 at 8:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.