How to disable Ipv6 on Ubuntu, Linux Mint, Debian


Ipv6 is the next version of the addressing scheme Ipv4 that is currently being used to assign numerical address to domain names like over the internet.

Ipv6 allows for more addresses than what Ipv4 supports. However it is not yet widely supported and its adoption is still in progress.

Does your system support ipv6 ?

Check out to see if you network supports Ipv6.

For Ipv6 to work you need -

1. An OS that supports IPv6. Ubuntu and most modern Linuxes do that.
2. Your network hardware (router/modem) must support Ipv6. Many of the good brands do.
3. Your ISP must also support IPv6. This is something that is not present everywhere !

Check the output of ifconfig command to see the "inet6 addr" line.

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1c:c0:f8:79:ee  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::21c:c0ff:fef8:79ee/64 Scope:Link

Problems if ipv6 not supported

So if ipv6 is not supported on your network infrastructure, it might be useful to disable it all together. It can cause issues like delayed domain lookups, un-necessary attempts to connect to ipv6 addresses causing delay in network connection etc.

I did come across some problems like that. The apt-get command occasionally tries to connect to ipv6 addresses and fails and then retries an ipv4 address. Take a look at this output

$ sudo apt-get update
Ign trusty InRelease
Ign raring InRelease                                                                                                    
Err trusty Release.gpg                                                                                                  
  Cannot initiate the connection to (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) [IP: 2001:67c:1360:8c01::1b 80]
Err raring Release.gpg                                                                                                  
  Cannot initiate the connection to (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) [IP: 2001:67c:1360:8c01::1b 80]


Errors like those have been more frequent in the recent Ubuntu versions, probably because they try to use Ipv6 more than before.

I noticed similar issues happen in other applications like Hexchat and also Google Chrome which would sometimes take longer than usual to lookup a domain name.

So the best solution is to disable Ipv6 entirely to get rid of those things. It takes only a small configuration and can help you solve many network issues on your system. Users have even reported an increase in internet speed.

Method 1 - Disable from sysctl

The first method to disable Ipv6 is to edit kernel level parameters via sysctl interface.
The kernel parameters that enable ipv6 are as follows

$ sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
$ sysctl net.ipv6.conf.default.disable_ipv6
net.ipv6.conf.default.disable_ipv6 = 0
$ sysctl net.ipv6.conf.lo.disable_ipv6
net.ipv6.conf.lo.disable_ipv6 = 0

Note that the variables control "disabling" of ipv6. So setting them to 1 would disable ipv6
Edit the file - /etc/sysctl.conf

$ sudo gedit /etc/sysctl.conf

And fill in the following lines at the end of that file

# IPv6 disabled
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Save the file and close it. Restart sysctl with

$ sudo sysctl -p

Check the output of ifconfig again and there should be no ipv6 address

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:5f:28:8b  
          inet addr:  Bcast:  Mask:
          RX packets:1346 errors:0 dropped:0 overruns:0 frame:0
          TX packets:965 errors:0 dropped:0 overruns:0 carrier:0

If it does not work, then try rebooting the system and check ifconfig again.

Method 2 : Disable ipv6 from GRUB

Ipv6 can also be disabled by editing the grub configuration file

$ sudo gedit /etc/default/grub

Look for the line containing "GRUB_CMDLINE_LINUX" and edit it as follows


The same can also be added to the value of the variable named "GRUB_CMDLINE_LINUX_DEFAULT" and either would work. Save the file, close it and regenerate the grub configuration

$ sudo update-grub2

Reboot. Now ipv6 should be disabled.

Last Updated On : 27th February 2016

Subscribe to get updates delivered to your inbox

10 Comments + Add Comment

  • Also for disabling it from linux kernel.
    Find if its installed, lsmod list the modules:


    Remove it with rmmode:

    rmmod ipv6

  • Thank you. I’m a super noob and this is the first thing I read and applied as far as linux that actually worked with no problems.

  • Hi.
    On Linux Mint 17.2 or 17.3 when I try to use GRUB method I recieve error message after try to update GRUB !! I follow instructions above & change variables in configration file then “save” changes. But when I use:

    sudo update-grub
    then I recieved error message !!

    I try sudo update-grub2
    but It is not available !! Are you sure it is grub2 not grub ? I think it is just grub

    I try to invistigate this by just type in terminal:


    to see what output. Then I recieved message say “grub not installed” & command me to use:

    sudo apt-get install grub

    What is this?

    Please your kind reply.

  • Disbaling IPv6 solved the issue of all google sites loading slowly for me.

  • It’s suffice with just net.ipv6.conf.all.disable_ipv6 = 1
    That will automatically imply net.ipv6.conf.*.disable_ipv6 = 1

    • Thanks for pointing out.

  • Edit /etc/gai.conf and uncomment the line to prefer ipv4 over ipv6.

    Which is the correct way to deal with this.

  • Sorry but, how do you save the file? xD i mean i’m sorry i’m trying to learn.. I have Mint 17 cinammon

  • This does not work for me. $ sudo gedit /etc/default/grub. Will not recognize $ sudo. I’m running Mint 17 KDE. I was able to bring up the command to notice that I have the ipv6 running; but my ISP and the modem is not running it. How should I disable it in KDE?

    • dont use the dollar sign ($), it just indicates the terminal prompt
      type in from “sudo …” onwards

Leave a comment