Disabling IPv6 on Mint and Debian

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x