Disabling IPv6 on Linux: A Step-by-Step Guide

IPv6 gives us a much bigger addressing capability than IPv4, which was one of its key reasons for development. However, I have seen a few rare situations where IPv6 can cause network issues.

Sometimes, hardware just doesn’t support IPv6, and some system admins might still be stuck on IPv4. If you run into a problem, disabling IPv6 can be a quick and straightforward fix. You can switch it back on once the issue is resolved permanently.

For setups where both your hardware and software fully support IPv6, you won’t even think about this issue. But if you’re dealing with networking headaches on Linux servers or desktops, and you’ve tried everything, you might consider turning off IPv6 for a while.

I remember having persistent communication dropouts between a Linux desktop and an old router. Disabling IPv6 was the only fix that worked. After some time, I’d turn IPv6 back on to see if updates to the router’s firmware or the desktop OS made a difference. Sometimes it worked, and IPv6 could stay enabled; other times, it needed to be disabled again.

Let’s look at how to disable IPv6 on a Linux machine. Remember, this should only be a last resort—it’s a temporary workaround.

Working with the Command Line

We’ll use the command line to disable IPv6 on both Red Hat-based and Debian-based systems.

For Red Hat-based systems:

  1. Open a terminal.
  2. Switch to the root user.
  3. Enter:
    sysctl -w net.ipv6.conf.all.disable_ipv6=1
    sysctl -w net.ipv6.conf.default.disable_ipv6=1

To re-enable IPv6, run:

sysctl -w net.ipv6.conf.all.disable_ipv6=0
sysctl -w net.ipv6.conf.default.disable_ipv6=0

For Debian-based systems:

  1. Open a terminal.
  2. Type:
    sudo nano /etc/sysctl.conf
  3. Add these lines at the bottom:
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
  4. Save and close the file.
  5. Reboot the machine.

To re-enable IPv6, remove those lines from /etc/sysctl.conf and reboot.

Things to Watch Out For

If you’re using X Forwarding via SSH, turning off IPv6 can mess this up. To fix it, open /etc/ssh/sshd_config and change #AddressFamily any to AddressFamily inet. After saving, restart the SSH service.

If you’re using Postfix, you might face issues when starting it up. You can sort this out by using an IPv4 loopback. Edit /etc/postfix/main.cf, comment out the localhost line, and add the IPv4 loopback like this:

#inet_interfaces = localhost
inet_interfaces = 127.0.0.1

A Workable Approach

This isn’t a flawless solution, but sometimes troubleshooting requires a bit of creativity. If odd network errors are bothering you on Linux systems, disabling IPv6 can be a practical step in your troubleshooting process or serve as a temporary fix.

Unlock your business potential with our expert guidance. Get in touch now!

tr_20250107-dell-pro-ai-laptops-ces-2025.jpg

Dell Retires XPS Branding in Favor of New Pro and Pro Max Tiers

ipv6istock000032253336ayagiz.jpg

Disabling IPv6 on Linux: A Step-by-Step Guide

ivr-script-featured-image-01032025-min.jpg

21 IVR Scripts You Can Adapt for Your Needs (And How to Implement Them)

FeatureImage_6_Best_Crm_Software_For_Small_Business_For_2024.jpg

Top CRM Solutions for Small Businesses in 2025

FeatureImage_Total_AV_VPN_vs_Surfshark.jpg

How to Select the Right VPN for You?

voip-gateway-featured-image-12312024-min.jpg

Absolutely, Analog Phones Function Perfectly with a VoIP Gateway

ucaas-migration-featured-image-12312024-min.jpg

Seamless UCaaS Migration: Ensuring Your Customers Remain Unaware