HOWTO — Disable IPv6 support in Ubuntu/Linux.

As many people know, Ubuntu supports IPv6 by default. It’s nice but sometimes you don’t have chance to use IPv6 in your network environment. And maybe, sometimes it brings few more complexity for your system administration tasks.

For example, if you set listen_ip= in a services daemon’s config file and hope it can listen to all of the IPv4 IPs of your network interfaces, you might not get what you want.

This is because, if the daemon supports both IPv4 and IPv6, it will listen to IPv6 :::80 by default. That’s why you cannot connect to your service even the network link is up.


There are many different, alternative, or strange ways people tell you that it can disable IPv6.

But the best way is using /etc/sysctl.conf to disable it in your kernel.

# Using those commands to append kernel settings/parameters into /etc/sysctl.confecho "#disable ipv6" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf

Enable those settings Righ Now!

sysctl -p


All those setting will will be kept and will be applied/enabled automatically at future boot time. Tested on: Ubuntu 8.04 LTS, Ubuntu 10.04 LTS

Trackback URL :

Originally published at on April 15, 2011.


BlueT’s LoGeeks, Logics of Geeky Thoughts.

BlueT / Matthew Lien 練喆明

Written by

Just another Perl / OpenSource / Security Hacker. CTO / Co-founder @Imonology, Leader @Ubuntu_TW, Founder @OSSPlanet. Promote Ubuntu Linux, Networking, Privacy.



BlueT’s LoGeeks, Logics of Geeky Thoughts.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade