How to disable IPv6 on Ubuntu?

This worked for me:

Add these lines to the bottom of sysctl.conf

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

Then run sudo sysctl -p or reboot

source: http://www.noobslab.com/2012/05/disable-ipv6-if-your-internet-is.html

This of course won't stop bind from blindly trying to use ipv6 though, so you also need to alter /etc/default/bind9 like so:

# run resolvconf? 
RESOLVCONF=yes 
# startup options for the server 
OPTIONS="-4 -u bind"

source: http://blog.evilcoder.net/disable-ipv6-on-bind9-linux/#sthash.U95y4s6U.dpuf


To check if IPv6 is enabled or disabled, from a terminal window:

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

0 means it’s enabled and 1 is disabled.

To disable IPv6

$ sudo su -
# nano /etc/sysctl.conf

and add these lines to sysctl.conf file

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

Save sysctl.conf file with new config, then reboot your system

# reboot

Check your system again

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

Now you should see “1″ means IPv6 has been disabled on your system.

From http://namhuy.net/1419/disable-ipv6-ubuntu-linux-mint.html


  1. Open a terminal and type the following command (if you don't use Gedit, replace it with your text editor such as Kate, etc).

    sudo gedit /etc/default/grub
    
  2. And search for this:

    GRUB_CMDLINE_LINUX
    

    Modify it so it looks like this:

    GRUB_CMDLINE_LINUX="ipv6.disable=1"
    
  3. Now, let's update the GRUB:

    sudo update-grub2
    

    Or if you don't use GRUB 2, do:

    sudo update-grub
    
  4. And finally, restart your system.