Disable IPV6 module on default kernels

One of the main advantages when using a custom build kernel is that you can include in the running kernel (or available modules) only the things that are really needed. The default kernel included in most Linux distributions will try to load many modules (even if not necessary) to make it work on the most systems and configurations possible.

Even if you are using the default kernel, and don’t want to recompile the kernel, then you can disable the load of some modules that you don’t want loaded. For example I will show you how to disable the loading of the IPV6 module that is normally autoloaded on most recent Linux distributions default kernels (2.6.x). Basically we need to add one line (alias net-pf-10 off) in the module configuration file to achieve this. Based on the particular distribution used you will need to add this to the proper place. Let’s see how we can do this on some sample distributions: _Debian _and RHEL:

Debian Etch (default kernel version 2.6.15-1)

Where?

/etc/modprobe.d/aliases

By default you will have a line like this: alias net-pf-10 ipv6 in the aliases file. Replace that line with:

alias net-pf-10 off

RHEL4/Centos4 (default kernel version 2.6.9-34.EL)

Where?

/etc/modprobe.conf

Add the following line to the modprobe.conf file:

alias net-pf-10 off

On your next reboot the IPV6 module will no longer be loaded. In a similar way, you can disable other kernel modules from autoloading, based on your particular needs. See the modules documentation for further details.

comments powered by Disqus