Disabling IPv6, breaks SSH X11 Forwarding in Linux CENTOS and UBUNTU all versions

This was a weird one. It took me ages to discover why SSH X11 died at some point after tuning a box.

It so happens that disabling IPv6 ( not used on my networks) is assumed in SSH at some point and if you disable it (which many people say is a way to avoid systems using IPv6 to other boxes and ignore IPv4 provisions like firewall settings, routes etc..)

So re-enable the IPv6 in /etc/sysctl.conf or /etc/sysconfig/network or other networking script locations, if you need this functionality.

If i find any other counter indication I’ll drop a note and link.

nJoy 😉

Disable IPv6 in centOS

  • Edit /etc/sysconfig/network and set “NETWORKING_IPV6” to “no”
  • For 5.4 and later, replace in /etc/modprobe.conf

 

alias ipv6 off

by

options ipv6 disable=1

Alternative (which might be easier and works on any release with /etc/modprobe.d):

# touch /etc/modprobe.d/disable-ipv6.conf
# echo "install ipv6 /bin/true" >> /etc/modprobe.d/disable-ipv6.conf
  • For CentOS 5.3 or older, add the following to /etc/modprobe.conf :

 

alias ipv6 off
alias net-pf-10 off
  • Run /sbin/chkconfig ip6tables off to disable the IPv6 firewall
  • Reboot the system

<!> With the 5.4 update symbol/ipv6 module dependency capabilities have been introduced; therefore, if IPv6 has been previously disabled as above an upgrade to the bonding driver in 5.4 will result in the bonding kernel module failing to load. For the module to load properly use instead:

# touch /etc/modprobe.d/disable-ipv6.conf
# echo "options ipv6 disable=1" >> /etc/modprobe.d/disable-ipv6.conf

<!> <!> Upstream employee Daniel Walsh recommends not disabling the ipv6 module but adding the following to /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1

In a short way this is what I do:

[root@toro.maranello.local ~]#echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf

While there I would turn off the IPV6Tables service as well

[root@toro.maranello.local ~]# service ip6tables save
[root@toro.maranello.local ~]# service ip6tables stop
[root@toro.maranello.local ~]# chkconfig ip6tables off

NOTE: SSH x11 forwarding may (and probably will) stop working if you disable the IPv6 …just a heads up :)…

nJoy 😉