Easy methods to Disable IPv6 on Linux


IPv6 gives a a lot bigger addressing scheme than IPv4, which is without doubt one of the many causes it was developed. Nevertheless, I’ve seen uncommon cases through which IPv6 has triggered community issues.

Since some {hardware} doesn’t make the most of IPv6 (and a few admins is perhaps working with IPv4), a brief and simple resolution is to disable IPv6. The protocol will be re-enabled when the problem has been completely resolved.

When you’ve got {hardware} that completely implements IPv6 and software program that makes use of it accurately, it is a non-issue. However in the event you’re having networking points with Linux servers or desktops, and also you’ve exhausted all doable areas, you would possibly strive disabling v6 of the community protocol.

I’ve had just a few cases the place communication between a Linux desktop and an outdated router would continuously drop, and disabling IPv6 was the one resolution that labored. After some time, I might re-enable IPv6 to see if a router firmware replace (and a desktop OS replace) had solved the issue. In some cases, it solved the problem, and IPv6 may stay enabled, although in different cases, IPv6 must be disabled once more.

I’ll present you tips on how to disable IPv6 on a Linux machine. (Observe: I like to recommend disabling IPv6 solely if you’ve exhausted all different choices. Additionally, it is best to contemplate this a brief repair.)

SEE: Prime Instructions Linux Admins Must Know (TechRepublic Premium)

Command line

You guessed it: We’re going to be working with the command line. I’ll present you tips on how to disable IPv6 on Crimson Hat- and Debian-based distributions.

Right here’s tips on how to disable the protocol on a Crimson Hat-based system:

  1. Open a terminal window.
  2. Change to the basis person.
  3. Problem the command sysctl -w web.ipv6.conf.all.disable_ipv6=1
  4. Problem the command sysctl -w web.ipv6.conf.default.disable_ipv6=1

To re-enable IPv6, subject the next instructions:

sysctl -w web.ipv6.conf.all.disable_ipv6=0

sysctl -w web.ipv6.conf.default.disable_ipv6=0

Right here’s tips on how to disable the protocol on a Debian-based machine.

  1. Open a terminal window.
  2. Problem the command sudo nano /and many others/sysctl.conf
  3. Add the next on the backside of the file:

web.ipv6.conf.all.disable_ipv6 = 1

web.ipv6.conf.default.disable_ipv6 = 1

web.ipv6.conf.lo.disable_ipv6 = 1

  1. Save and shut the file.
  2. Reboot the machine.

To re-enable IPv6, take away the above strains from /and many others/sysctl.conf and reboot the machine.

SEE: Easy methods to View Your SSH Keys in Linux, macOS, and Home windows (TechRepublic)

The caveats

For those who occur to make use of X Forwarding by means of ssh, disabling IPv6 can break this method. To repair that subject, you should open the /and many others/ssh/sshd_config file and alter the #AddressFamily any to AddressFamily inet. Save that file and restart sshd.

For those who use Postfix, you might encounter points with the service beginning. To repair this, you’ll have to make use of an IPv4 loopback. Open the /and many others/postfix/important.cf file, remark out the localhost line, and add the IPv4 loopback like so:

#inet_interfaces = localhost

inet_interfaces = 127.0.0.1

SEE: Easy methods to Set Non permanent Atmosphere Variables in Linux (TechRepublic)

An imperfect resolution

This isn’t an ideal resolution, however generally you should be inventive in troubleshooting. For those who’re encountering odd networking errors with Linux servers and desktops, strive disabling IPv6 to assist you in your troubleshooting or to supply a brief repair.

This text was initially printed in June 2016. It was up to date by Antony Peyton in January 2025.



Supply hyperlink

Leave a Reply

Your email address will not be published. Required fields are marked *