My words on free/open source software

Sunday, May 02, 2010

HOWTO: Disable IPv6 in MeeGo

With traditional desktop Linux distros, the IPv6 can be disabled by removing the ipv6-related modules, but not with MeeGo since it's ipv6 module is compiled in kernel (for fastboot). The following instructions apply to similar situations where you can't remove the ipv6 module (like you have no control over the kernel, or using a Xen VM, etc.)

The ipv6 module will always assign an address to all NIC during startup, there's no way to disable it, we have to disable ipv6 autoconf, and remove all assigned IPv6 addresses:

Create a file /etc/sysctl.d/disable_ipv6:


# disable autoconf
net.ipv6.conf.default.autoconf=0
net.ipv6.conf.all.autoconf=0
net.ipv6.conf.eth0.autoconf=0

# block all received Router-Advertisement (RA) packets
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.eth0.accept_ra = 0

# NOTE: the *.all* above applies to newly created NICs only,
# not to existing NICs. So you have to list all NIC's explicitly
# here. For example, if you have a wireless card wlan0, add the
# following lines:
#net.ipv6.conf.wlan0.autoconf=0
#net.ipv6.conf.wlan0.accept_ra = 0


Then delete all pre-allocated ipv6 address by adding the following lines in /etc/rc.local:

ifconfig lo inet6 del ::1/128
IPV6ADD=`ifconfig eth0 | grep inet6 | awk '{print $3}'`
ifconfig eth0 inet6 del "$IPV6ADD"


Don't forget to:

chmod +x /etc/rc.local


Update:
I've discovered that sshd running on MeeGo can't accept X11 forwarding requests after made above changes. You can find the following error message in /var/log/secure:

sshd[]: error: Failed to allocate internet-domain X11 display socket.


The reason is that sshd is still trying to bind to an IPv6 address but there's no IPv6 address available. To solve this issue, we need to start sshd with "-4" option.

Create a new file For MeeGo at /etc/sysconfig/sshd:

OPTIONS="-4"


And restart sshd:

service sshd restart


Reference:

About Me

My photo
Santa Cruz, California, United States