rss
twitter
    Find out what I'm doing on Twitter

Howto Disable IPV6 at Ubuntu Jaunty

EDIT : Updated for latest Ubuntu Jaunty.There is a kernel bug at ubuntu jaunty's current kernel, you can read the comments to get more details(bug page, patch etc) about this issue.SO this is the only way to disable ipv6 without compiling new or your current kernel!

You have to install a 2.6.29.3 or a later kernel.You can find debian packages of kernels from here

In this example we are going to install 2.6.29.3 kernel.If you have problems with this kernel, you can always install a newer kernel.Also i will use i386 packages, if you have a 64bit system, install and use 64 bit packages from there!

Now navigate to kernel ppa by clicking here and install the debian files :

linux-headers-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
linux-headers-2.6.29-02062903_2.6.29-02062903_all.deb
linux-image-2.6.29-02062903-generic_2.6.29-02062903_i386.deb

For i386 packages example :

$wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29.3/linux-headers-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
$wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29.3/linux-headers-2.6.29-02062903_2.6.29-02062903_all.deb
$wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29.3/linux-image-2.6.29-02062903-generic_2.6.29-02062903_i386.deb

Now install it :

$sudo dpkg -i *.deb

###################
Optional part :

Now open start up manager (You can install it via $sudo apt-get install startupmanager) via System > Administration > StartUp-Manager navigation or startupmanager command.

Change default operation system to latest kernel we installed (Ubuntu 9.04, kernel 2.6.29-02062903-generic) and close it.

###Optional part ends

Open your grub menu config via :

$sudo gedit /boot/grub/menu.lst

command.Find the kernel line which we installed a couple of minutes ago, and add option ipv6.disable=1

It will look like this :

title Ubuntu 9.04, kernel 2.6.29-02062903-generic
uuid 96c2b3cb-f93c-4601-ac54-922c9efd8de0
kernel /boot/vmlinuz-2.6.29-02062903-generic root=UUID=96c2b3cb-f93c-4601-ac54-922c9efd8de0 ro quiet splash ipv6.disable=1
initrd /boot/initrd.img-2.6.29-02062903-generic
quiet


Edit : I am also posting a screen shot of this , since my theme's width is a little small : ) You can find the screenshot here.

Update your grub via :

$sudo update-grub

Reboot your box with 2.6.29-03 kernel.To be sure, open a terminal and paste this command (change eth0 to your network interface : eth1,eth0, wlan0 etc)

$ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:1d:92:4b:92:c7
inet addr:94.54.36.125 Bcast:94.54.63.255 Mask:255.255.192.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:228348 errors:0 dropped:0 overruns:0 frame:0
TX packets:2891 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16159134 (16.1 MB) TX bytes:486253 (486.2 KB)
Interrupt:27 Base address:0xe000

If the output is similar to this (no extra lines like 213123/64), then you have disabled ipv6 ;)

35 comments:

Arun Mallikarjunan said...

I did add the line as you had suggested

title Ubuntu 9.04, kernel 2.6.28-11-generic
uuid e0d55de8-6a1d-4c2b-bc4b-3018279caa27
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=e0d55de8-6a1d-4c2b-bc4b-3018279caa27 ro ipv6.disable=1 quiet splash
initrd /boot/initrd.img-2.6.28-11-generic

I am getting the error "unknown option ipv6.disable ignoring". Is there anything wrong in what I did?

Thanks,
Arun

Tavi said...

I get the same error as Arun Mallikarjunan :(

milasch said...

Neither methods work. When I try to edit disable_ipv6 it comes back to 0 when I reboot. When I add ipv6.disable=1 I also get the same error.

Binbash said...

I wrote the post when Ubuntu Jaunty was beta, this method is not working for now.

Here is a bug report at launchpad :

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/351656

And here is the patch :

http://patchwork.ozlabs.org/patch/24127/


You can apply the patch or compile a kernel without ipv6

Binbash said...

I forgot to add that you can also disable ipv6 at firefox from about:config section by setting

"network.dns.disableIPv6" to true

But again, this is only for firefox

milasch said...

would you be kind enough to inform (or post a link) on where and how to apply this patch?

Recompiling the kernel is out of question for me as my wireless drivers won't compile when I boot the custom kernel.

Thanks

milasch said...

btw, disabling firefox's ipv6 solves only 10% of my problems since I'm running other services such as ssh, vino-server, svn remotely.

Binbash said...

To apply that patch (it is a kernel patch), you have to recompile the kernel at the end.SO applying the patch is not a solution for average ubuntu desktop user.Also applying a patch to a kernel and applying it to a running kernel are two different things.

ANYWAYS, i found a workaround to disable ipv6, i updated the blogpost (i will update in 10 minutes) for instructions

milasch said...

Thanks Binbash. But this will also imply compiling custom drivers right? Such as my Broadcom Sta drivers, which I can't compile with ubuntu. It gives me an warning which I don't remember right now and make it impossible to install using insmod due to some error with 80211_crypto modules.

Binbash said...

First of all you can do this 2.6.29.x and newer kernels.And the kernel mainline has kernels upto 2.6.30-rc6.You do not have to install the version i wrote at blog post, you may have some issues with some kernels such as shutdown splash may not work etc.So try till you find the best for you.

If you compiled custom drivers previously, you have to re-compile them with a new kernel.I have no idea about Broadcom Sta drivers.But if you can give me exact output of sudo lshw command and things are not working for you i will try to get them fixed.

Russo said...

Hi Binbash, I have followed the steps in your article and it has worked smoothly.

Thanks!

milasch said...

I installed the new kernel and added the disable option at menu.lst and ipv6 was still there. I didn't dig up much since I wasn't able to install NVidia drivers for my laptop, so I just went back to the original kernel and removed the new installed one. Now I'm trying arch linux and it looks promising.

Thanks for all your support Binbash!

Binbash said...

Hello milasch,

I am sure this method works, i tested it myself plus you can read the comments ;)

Are you sure that you are booting with new kernel? (verify it via uname -r command at terminal)

Did you add the disable ipv6 parameter to the new kernel we installed and boot?

If you have problems at installing arch linux, do not forget to check out its awesome wiki, plus feel free to send e-mails, PM from ubuntuforums or so about arch linux!

Have a nice install!

milasch said...

I'm not sure if I did it all right. I was trying everything from work through a ssh connection. I installed the new kernel, updated menu.lst, rebooted, reinstalled Nvidia drivers using the installer found in their website, then rebooted to find my sshd was dead.

When I went back home, I started digging it up and my wife started to complain I was spending too many hours with the laptop and not with her (lol). Rushed by her I just quickly checked if inet6 was still up (ip a), and there it was. So I finally removed the new kernel to avoid new conflicts at home and shut down my laptop hoping I could live (Married) with 10% packet drop averege.

I could have done many wrong things. I could have added ipv6.disable=1 to the wrong kernel, I can't know for sure.

Yesterday I finally tried installing Arch Linux on a VM.

Having tried Gentoo before, I found out it was way too painful to try having control over the whole system. Doing that with Arch Linux doesn't look as time consuming as Gentoo is (with maybe its cons, of course).

So I think I'll give it a try on my laptop, switching from Ubuntu, for knowledge's sake, after all, with linux you never stop learning (at least for me, averege user).

I'm pretty sure I'll end up coming back to ubuntu (as I did after trying gentoo, opensuse, fedora, mandriva, even Linux from scratch), then if it doesn't take long and a new kernel deb package isn't released in the main ubuntu repositoies, I'll definetelly come back to this blog and try your instructions with more attention. I'm pretty sure it works.

Anyways, thanks for the great tips.

Anonymous said...

You forgot to mention which command gives you the final output. I'm assuming it is ifconfig

Binbash said...

Yes you are right, i updated the blog post ;)

অয়ন খান said...

My output is:

eth0 Link encap:Ethernet HWaddr 00:1a:4d:79:20:26
inet6 addr: fe80::21a:4dff:fe79:2026/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:525 errors:0 dropped:0 overruns:0 frame:0
TX packets:312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:210785 (210.7 KB) TX bytes:59654 (59.6 KB)
Interrupt:27 Base address:0x6000

Now please let me confirm, is this trick working?

Binbash said...

Nope, it is IPV6 enabled.Please post the output of uname -r command and your kernel line at /boot/grub/menu.lst

অয়ন খান said...

How to remove the Kerner 2.6.29-02062903-generic and roll-back to the previous one?

Binbash said...

Open StartUp-Manager (if not installed, install it via $sudo apt-get install startupmanager) via navigating to System > Administration > StartUp Manager and select prefered kernel at Default Operating system section.

Before removing 2.6.29 r3 kernel be sure default kernel or any other kernels are installed.(you can check it at Default Operating system section.)If not install a kernel before removing your current one!

remove this packages (sudo apt-get remove packagename) :
linux-headers-2.6.29-02062903
linux-headers-2.6.29-02062903-generic
linux-image-2.6.29-02062903

অয়ন খান said...

Removing "linux-headers-2.6.29-02062903" will remove the the rest of two packages itself.

sudo apt-get remove linux-headers-2.6.29-02062903
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-2.6.29-02062903 linux-headers-2.6.29-02062903-generic
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 78.5MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 141935 files and directories currently installed.)
Removing linux-headers-2.6.29-02062903-generic ...
Removing linux-headers-2.6.29-02062903 ...
ayonkhan@ayonkhan-desktop ~/Desktop $

Afshin said...

Thank you very much Binbash. When it comes to the last part of the guide (to test if ipv6 is disabled or not), isn't it easier to run "ip a | grep inet6"?

For those who don't know: After this command if you get no output, then ipv6 is disabled. Any output, that shows some thing like "inet6 ::1/128 scope host" means that ipv6 is enabled (source: https://help.ubuntu.com/community/WebBrowsingSlowIPv6IPv4).

Anonymous said...

I used the latest daily 2.6.31-999-generic as of 14/7/2009 with success. Thank you for the tutorial.

Martijn said...

Great! U made my day! Thanks a lot!

Anonymous said...

What was the good reason to disable ipv6 in the first place?

Binbash said...

Faster DNS resolves

Anonymous said...

Thanx Binbash!

On a Linux Mint 7 install I applied your method and it worked great!

I used the latest non RC kernel 2.6.30.4

Your optional part did not work for me. I was able to install startupmanager, but when I tried to run it nothing happened. Maybe it doesn't work with Mint.

I edited the menu.lst file by hand since I could not get startupmanager to run. Thank you for the screenshot, or I would not have known that ipv6.disable=1 was part of the kernel line after splash. On my system with word wrap on splash was on its own line...

I actually forgot to run $sudo update-grub but when I rebooted my new kernel choice was there and it booted fine w/o ipv6.

Running $sudo update-grub afterwards installed an additional (recovery mode) choice for the new kernel and wiped out the ipv6 modifications I made. So I had to reedit menu.lst.

My menu.lst looks essentially the same as your post minus the uuid stuff plus a root (hd0,0) entry

Anonymous said...

Hi Everyone,

Ugh... I found a much easier way to disable IPv6 in Jaunty (9.04) permanently which is not needed to reconfigure when new kernel comes..

Here it is.

You only need to edit the file '/etc/rc.local' by

sudo gedit /etc/rc.local (or anyway you want)

The only thing you have to do is to add three lines to the end of the file, before the 'exit (0)' line.
The three lines are these:

IFACE='eth0'
IPV6=`ifconfig $IFACE | gawk '/inet6/ {print $3}'`
ifconfig $IFACE inet6 del $IPV6

(In this case 'eth0' means the preferred network adapter)
after saving the file and rebooting you can check for the solution, just type in a terminal:

lsmod | grep inet6

if there's no output, IPv6 is disabled.

I hope I could help You all!
Best wishes,
Janos

Anonymous said...

Sorry Janos,

The rc.local mod does NOT work, nor does your method of checking IPV6 state (lsmod | grep inet6) which has nothing to do with the state if IPV6. (and in fact will NEVER return anything, regardless of IPV6 state.)

The article is correct, as are the methods listed to check for IPv6 including Afshin's shortcut tip (ip a | grep inet6), which is the correct way to check IPV6 state.

Thanks anyway...
...Old Hacker

marines said...

Anonymous, it doesn't work.

Anonymous said...

Thanks Janos - that did the trick. I just upgraded to 9.10 karmic koala and ran into this ipv6 issue.

Anonymous said...

@Janos:
"lsmod | grep inet6

if there's no output, IPv6 is disabled."

Wrong! do
ip a | grep inet6
and if there's no output, IPv6 is disabled.
lsmod only lists the kernel modules, and there's no module named inet6.
And your method sadly did not work for me :(

Anonymous said...

on ubuntu I did like this successfully:

open a console and write thid to see the actual situ:

~$ ip a | grep inet6

put this line into /etc/sysctl.conf :

net.ipv6.conf.eth0.disable_ipv6 = 1

reboot, and:

~$ ip a | grep inet6

you should see:

~$inet6 ::1/128 scope host

and now you should have a faster internet

-=fabius=-

Hellas said...

Hey Janos. This worked perfectly. Thanks.

Anonymous said...

Hi all

echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6

also instead of 'all' you can name the if that you want to disable ipv6 on... eg eth0, eth1, lo

robbiesz

Post a Comment