SysTutorials

Disabling IPv6 on Linux: Step-by-Step Guide

· updated April 12, 2026

IPv6 is enabled by default on most Linux distributions. While IPv6 adoption has grown, there are legitimate reasons to disable it: some legacy applications don’t handle dual-stack networks well, it can complicate firewall rules, or you might be operating in an environment that doesn’t support it. Disabling IPv6 requires kernel-level configuration through sysctl.

Using sysctl to Disable IPv6

The most reliable way to disable IPv6 is through kernel parameters. Add these lines to /etc/sysctl.conf:

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

These three parameters control IPv6 across all interfaces (all), default settings for new interfaces (default), and the loopback interface (lo).

Apply the changes immediately without rebooting:

sudo sysctl -p

The -p flag loads settings from /etc/sysctl.conf. To apply changes to a specific file:

sudo sysctl -p /etc/sysctl.conf

Verifying IPv6 is Disabled

Check that the kernel parameter is set:

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

Output of 1 means IPv6 is disabled. 0 means it’s enabled.

Verify that IPv6 addresses no longer appear on your interfaces using ip:

ip addr show

You should no longer see any inet6 entries. The older ifconfig command still works on many systems but ip is the modern standard:

ifconfig

Check that IPv6 is not listening on services:

ss -tuln | grep -E '^\[|::1'

Look for IPv6 socket entries (indicated by [ brackets for IPv6 addresses like [::1]).

Temporary Runtime Disable

If you need to disable IPv6 temporarily without persisting the change:

echo 1 | sudo tee /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 | sudo tee /proc/sys/net/ipv6/conf/default/disable_ipv6
echo 1 | sudo tee /proc/sys/net/ipv6/conf/lo/disable_ipv6

These changes are lost after reboot.

Disabling IPv6 via GRUB (Boot Parameter)

Some systems require boot-time IPv6 disabling. Edit /etc/default/grub and add ipv6.disable=1 to the GRUB_CMDLINE_LINUX line:

GRUB_CMDLINE_LINUX="ipv6.disable=1"

Update GRUB and reboot:

sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo reboot

On UEFI systems, the path may be /boot/efi/EFI/grub/grub.cfg.

NetworkManager and systemd-networkd

If you’re using NetworkManager, you can also disable IPv6 per-connection in the configuration:

sudo nmcli connection modify <connection-name> ipv6.method ignore

For systemd-networkd, add to your .network file in /etc/systemd/network/:

[Network]
IPv6AcceptRA=no

Then restart:

sudo systemctl restart systemd-networkd

Important Considerations

Disabling IPv6 completely can break some services. Test thoroughly in your environment first. Some applications—particularly container orchestration, service meshes, and modern web services—may have issues without IPv6 support.

If you only want to disable IPv6 on specific interfaces, modify the sysctl parameter for that interface:

echo 1 | sudo tee /proc/sys/net/ipv6/conf/eth0/disable_ipv6

Changes persisted in /etc/sysctl.conf survive system reboots and are applied automatically during boot.

2026 Best Practices and Advanced Techniques

For Disabling IPv6 on Linux: Step-by-Step Guide, understanding both the fundamentals and modern practices ensures you can work efficiently and avoid common pitfalls. This guide extends the core article with practical advice for 2026 workflows.

Troubleshooting and Debugging

When issues arise, a systematic approach saves time. Start by checking logs for error messages or warnings. Test individual components in isolation before integrating them. Use verbose modes and debug flags to gather more information when standard output is not enough to diagnose the problem.

Performance Optimization

Security Considerations

Security should be built into workflows from the start. Use strong authentication methods, encrypt sensitive data in transit, and follow the principle of least privilege for access controls. Regular security audits and penetration testing help maintain system integrity.

These complementary tools expand your capabilities:

Integration with Modern Workflows

Consider automation and containerization for consistency across environments. Infrastructure as code tools enable reproducible deployments. CI/CD pipelines automate testing and deployment, reducing human error and speeding up delivery cycles.

Quick Reference

This extended guide covers the topic beyond the original article scope. For specialized needs, refer to official documentation or community resources. Practice in test environments before production deployment.

← All posts