How to disable IPv6 on RHEL5, CentOS5 and RHEL6, CentOS6

Since there seems to be some confusion how to disable IPv6 on RHEL and CentOS, here is how to do it.

How not to do it

Do not disable the IPv6 kernel module. The reason is that IPv6 is quite integrated into the kernel in spite of being a kernel module. Things like SELinux need the IPv6 kernel module to be loaded. If you disable the IPv6 kernel module expect strange AVCs and generally things falling apart.

On up-to-date RHEL5 or CentOS5 (currently that means 5.10 aka 5U10)

Add the following line to /etc/sysctl.conf:

On a live system you can disable it with:

On up-to-date RHEL6 or CentOS6 (currently that means 6.4 aka 6U4)

Add the following lines to /etc/sysctl.conf:

On a live system you can disable it with:

In case of any sshd problems on RHEL6, CentOS6 edit /etc/ssh/sshd_config and change ‘#AddressFamily any’ to ‘AddressFamily inet’ *or* uncomment ‘#ListenAddress’.

RHEL kernel ABI reference files not found

If you are building kernel modules on up-to-date RHEL 6 (or CentOS 6) and get the following warning:

Then some manual fixing is required. Here is the solution:

1) make sure you have the kABI Whitelists package installed

2) fix wrong search directory with a symlink

The script that does the kABI checks, find-requires.ksyms, is searching in the wrong directory. Here is the responsible snippet:

Looking in the /lib/modules/ directory we don’t find a ‘kabi’ dir:

The quick fix is to create a symlink ‘kabi’ pointing to ‘kabi-current’:

Once you have created the symlink, the find-requires.ksyms script will be able to find the kABI Whitelists and function correctly.

Clearly this is a very simple fix. Unfortunately Red Hat has not yet issued an update of the kabi-whitelists package. Hopefully it will be fixed with RHEL 6.5.

For future reference, the related bugzilla numbers are: