Wednesday, April 24, 2013

Disabling IPv6 on Ubuntu

There might be times when you might want to disable IPv6 support on your PC running an older version of Ubuntu (in my case 10.10) and you try out the following methods:

Method 1)
Simply issuing the command:
sudo sh -c "echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6" might not work on older versions of Ubuntu.

Method 2)
Neither would the alternate method of editing /etc/sysctl.conf as shown here: How to disable IPv6 in Ubuntu 10.04 Lucid Lynx work on older versions of Ubuntu.

Method 3)
To conclusively disable IPv6 (on Ubuntu 10.10 for example) you need to resort to editing the command line options passed to the kernel by the bootloader (grub) as shown here: How to disable IPv6 in Ubuntu 9.10 Karmic Koala
It involves adding the line GRUB_CMDLINE_LINUX="ipv6.disable=1" to /etc/default/grub and running update-grub2

Don't go by the titles of the posts linked to above, editing the kernel command line arguments is still the best way to disable IPv6 on any version of Ubuntu (although Method 1 does work simply and nicely on newer versions of Ubuntu like 12.04.1)

After executing method 3 on Ubuntu 10.10, you will get the following error while trying to manually set IPv6 address on your PC:

anurag@anupc:~$ sudo /sbin/ifconfig eth6 inet6 add 2001:0db8:0:f101::1/64
No support for INET6 on this system.

In case you want  renable IPv6 on Ubuntu 10.10 after executing method 3, do the following
  1. Edit /etc/default/grub by executing:
    sudo gedit /etc/default/grub
  2. Change GRUB_CMDLINE_LINUX="ipv6.disable=1" to GRUB_CMDLINE_LINUX="ipv6.disable=0" and save the file.
  3. Update Grub by running: sudo update-grub2
  4. Reboot the PC
  5. Execute:sudo sh -c "echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6" 
  6. Reboot once more and you are done.


Post a Comment