How to Disable IPv6 on Linux

How to Disable Ipv6 on Linux

How to Disable IPv6 on Linux

Home » News » How to Disable IPv6 on Linux
Table of Contents

IPv6 presents a loads greater addressing scheme than IPv4, which is among the many many causes it was developed. Nonetheless, I’ve seen unusual conditions whereby IPv6 has caused neighborhood points.

Since some {{hardware}} doesn’t take advantage of IPv6 (and some admins is more likely to be working with IPv4), a brief lived and easy decision is to disable IPv6. The protocol could possibly be re-enabled when the problem has been fully resolved.

Once you’ve acquired {{hardware}} that fully implements IPv6 and software program program that makes use of it precisely, this generally is a non-issue. Nevertheless within the occasion you’re having networking factors with Linux servers or desktops, and likewise you’ve exhausted all potential areas, you might try disabling v6 of the neighborhood protocol.

I’ve had just some conditions the place communication between a Linux desktop and an earlier router would constantly drop, and disabling IPv6 was the one decision that labored. After a while, I would re-enable IPv6 to see if a router firmware substitute (and a desktop OS substitute) had solved the problem. In some conditions, it solved the problem, and IPv6 would possibly keep enabled, though in numerous conditions, IPv6 should be disabled as soon as extra.

I’ll current you simple strategies to disable IPv6 on a Linux machine. (Remember: I wish to suggest disabling IPv6 solely everytime you’ve exhausted all totally different selections. Moreover, it’s best to consider this a brief lived restore.)

SEE: Excessive Directions Linux Admins Should Know (roosho Premium)

Command line

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

Proper right here’s simple strategies to disable the protocol on a Crimson Hat-based system:

  1. Open a terminal window.
  2. Change to the muse client.
  3. Concern the command sysctl -w internet.ipv6.conf.all.disable_ipv6=1
  4. Concern the command sysctl -w internet.ipv6.conf.default.disable_ipv6=1

To re-enable IPv6, downside the subsequent directions:

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

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

Proper right here’s simple strategies to disable the protocol on a Debian-based machine.

  1. Open a terminal window.
  2. Concern the command sudo nano /and so forth/sysctl.conf
  3. Add the subsequent on the bottom of the file:

internet.ipv6.conf.all.disable_ipv6 = 1

internet.ipv6.conf.default.disable_ipv6 = 1

internet.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 so forth/sysctl.conf and reboot the machine.

SEE: Recommendations on the way to View Your SSH Keys in Linux, macOS, and House home windows (roosho)

The caveats

For many who happen to utilize X Forwarding by way of ssh, disabling IPv6 can break this technique. To restore that downside, it is important to open the /and so forth/ssh/sshd_config file and alter the #AddressFamily any to AddressFamily inet. Save that file and restart sshd.

For many who use Postfix, you’ll encounter factors with the service starting. To restore this, you’ll need to make use of an IPv4 loopback. Open the /and so forth/postfix/major.cf file, comment out the localhost line, and add the IPv4 loopback like so:

#inet_interfaces = localhost

inet_interfaces = 127.0.0.1

SEE: Recommendations on the way to Set Momentary Ambiance Variables in Linux (roosho)

An imperfect decision

This isn’t a great decision, nevertheless typically you ought to be inventive in troubleshooting. For many who’re encountering odd networking errors with Linux servers and desktops, try disabling IPv6 that will help you in your troubleshooting or to supply a brief lived restore.

This textual content was initially printed in June 2016. It was updated by Antony Peyton in January 2025.

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
share this article.

related posts .

Enjoying my articles?

Sign up to get new content delivered straight to your inbox.

Please enable JavaScript in your browser to complete this form.
Name