How to disable IPv6

Good day my dear Linux Yogi’s,

in today’s illustration I am going to show you how you can turn off IPv6. In most company networks IPv6 is not been used so why should we have it even running? I always like to preserve resources even if they are very little in usage. I like to turn off services I don’t need or use.

Let’s get started. First I like to see if its active or already turned off. Run the following command:

more /proc/sys/net/ipv6/conf/all/disable_ipv6

and it either returns a 0 or a 1.

  • 0 = IPv6 is turned on
  • 1 = IPv6 is turned off

If the return value is 0 we need to edit the /etc/sysctl.conf file to disable it. Use your favorite text editor and add the following lines to the end of the /etc/sysctl.conf file.

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

now save the file and run the following command in order to update our system with the new settings.

sudo sysctl -p

it should return something like the following:

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

next we can run the very first command again to verify our system changes and it should return 1 this time.

more /proc/sys/net/ipv6/conf/all/disable_ipv6

Thank you for reading this quick how-to to disable IPv6. Please subscribe to my blog and register to the blogs forum. If you like me to write about something in particular feel free to drop me a line using my contact form.

Thank you and until next time, Namaste my friends 😉