November 11, 2009

Ubuntu 9.04 JauntyでIPv6を無効(disable)にしたい

Ubuntu 9.04 JauntyでIPv6を無効(disable)にする方法をググっていたのですが、だいたい下記のような内容が大半ですが、これがうまくいきません。

$ sudo echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
$ sudo vi /etc/sysctl.conf
---vi editing---
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
$ sudo sysctl -p

# 確認
$ ip a | grep inet6
$ ifconfig | grep inet6
$ cat /proc/net/if_inet6


[Kubuntu] Disable IPv6 in Kubuntu

Actually this is a kernel bug:
So we will need to wait until the next kernel update.


Bug Description

SRU Justification:

Impact: The method to disable IPV6 in Jaunty does not work, which does not allow systgem administrators to disable it on specific systems.

Fix: Patch from upstream which fixes the disable_ipv6 method.

Testcase: Try to disable ipv6 for a system with echo 1 >/proc/sys/net/ipv6/conf/all/disable_ipv6


When using sysctl to disable IPv6, it doesn't work. The command I used is the following:
sysctl -w net.ipv6.conf.all.disable_ipv6=1

Looking around it seens this a bug in the linux kernel, which already has a fix, as described here:

Please, backport this patch so IPv6 can easily be disabled on Jaunty!

I'm running Jaunty beta, updated as of 29/03/2009. Any details needed I'll be glad to provide.

Ubuntu 9.10 (Karmic)のKernelのバージョンでは影響がありません。このBug FixはKernel 2.6.28-15.52のupdateに含まれます。


$ uname -a
Linux ubuntu 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC 2009 i686 GNU/Linux



$ sudo apt-get dist-upgrade
# 確認
$ cat /boot/grub/menu.lst



$ sudo vi /boot/grub/menu.list
--- vi editing ---
title Ubuntu 9.04, kernel 2.6.28-16-server
uuid 85c0cc4b-b676-4988-9943-8c0867cacb1e
kernel /vmlinuz-2.6.28-16-server root=/dev/mapper/kt--ubuntu-root ro console=tty0 console=ttyS0,9600n8 quiet splash ipv6.disable=1
initrd /initrd.img-2.6.28-16-server
$ sudo shutdown -r now

# 確認
$ ip a | grep inet6
$ cat /proc/net/if_inet6
cat: /proc/net/if_inet6: No such file or directory
$ netstat -lntu # tcp6等でlistenしてない事を確認


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