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.
Share This







6th June 2006, 19:33
thank you
7th November 2006, 15:45
I want a lean and mean kernel, but w/o recompiling…
where do I get the list of modules so I can set them all off
in /etc/modprobe.conf ? (using FC5)
e.g. disable sound, ipv6 (got that!), SELinux etc…
14th December 2006, 09:28
Dotan,
I have not worked with RedHat types of kernels in a while. Still, for what you want, probably a better choice is to recompile the kernel and just disable the things you don’t need. You can pack that in distribution package and install it easily on more machines if that is needed.
14th December 2006, 09:40
It might be useful to explain why the entry referrences the net-pf-10 module *instead*of* the ipv6 module but, otherwise, very useful.
8th February 2007, 19:56
Dotan and anyone else,
I use FC4.
I have onboard ALSA sound and had many snd-* modules loaded. lsmod showed tons. I included this single line command in my /etc/rc.d/rc.local file (sorry if it wraps here):
awk ‘/^snd/||/^sound/&&($3==0){system(”rmmod ” $1)}’ /proc/modules /proc/modules /proc/modules
It processes modules three times to be sure it gets them all.
It removes all the ALSA modules. This will work for any modules you want to remove if you add the correct module prefix (i.e. the Module column) and interrupt value (i.e., the Used by column).
To disable selinux, add selinux=0 on the kernel line in boot/grub/grub.conf, i.e.
kernel /vmlinuz-2.6.17-1.2142_FC4 ro root=/dev/hda3 selinux=0
15th February 2007, 20:25
Hello all,
at least on a recent Debian System you can disable your undesired modules by adding them to /etc/modprobe.d/blacklist.
For example to disable IPv6 just add a line like:
blacklist ipv6
17th June 2007, 22:53
I am trying to replace the line mentioned in the original post. I am in terminal, I have my list of aliases…how do I actually replace it? It seems to be un-editable?
I am a newbie and it took me a while to figure out how to even get the list to display…this is what I did.
harmonicagoldfish@harmonicagoldfish:~$ sudo -s
Password:
root@harmonicagoldfish:~# /etc/modprobe.d/aliases
bash: /etc/modprobe.d/aliases: Permission denied
root@harmonicagoldfish:~# su /etc/modprobe.d/aliases
Unknown id: /etc/modprobe.d/aliases
root@harmonicagoldfish:~# /etc/modprobe.d/blacklist
bash: /etc/modprobe.d/blacklist: Permission denied
root@harmonicagoldfish:~# su /etc/modprobe.d/blacklist
Unknown id: /etc/modprobe.d/blacklist
root@harmonicagoldfish:~# cd /etc/modprobe.d/aliases
bash: cd: /etc/modprobe.d/aliases: Not a directory
root@harmonicagoldfish:~# cd /etc/modprobe.d/
root@harmonicagoldfish:/etc/modprobe.d# aliases
bash: aliases: command not found
root@harmonicagoldfish:/etc/modprobe.d# dir
aliases blacklist-framebuffer bluez lrm-video
alsa-base blacklist-modem ibm_acpi.modprobe nvidia-kernel-nkc
arch blacklist-oss ipw3945 options
arch-aliases blacklist-scanner isapnp toshiba_acpi.modprobe
blacklist blacklist-watchdog libpisock9
root@harmonicagoldfish:/etc/modprobe.d# cat aliases
# These are the standard aliases for devices and kernel drivers.
# This file does not need to be modified.
#
# Please file a bug against module-init-tools if a package needs a entry
# in this file.
# network protocols ##########################################################
alias net-pf-1 unix
alias net-pf-2 ipv4
alias net-pf-3 ax25
alias net-pf-4 ipx
alias net-pf-5 appletalk
alias net-pf-6 netrom
alias net-pf-7 bridge
alias net-pf-8 atm
alias net-pf-9 x25
alias net-pf-10 ipv6
alias net-pf-11 rose
alias net-pf-12 decnet
# 13 NETBEUI
alias net-pf-15 af_key
alias net-pf-16 af_netlink
alias net-pf-17 af_packet
# 18 ASH
alias net-pf-19 af_econet
alias net-pf-20 atm
# 22 SNA
alias net-pf-23 irda
alias net-pf-24 pppoe
alias net-pf-25 wanrouter
alias net-pf-26 llc
alias net-pf-31 bluetooth
# executables formats ########################################################
install binfmt-0000 /bin/true
alias binfmt-204 binfmt_aout
alias binfmt-263 binfmt_aout
alias binfmt-264 binfmt_aout
alias binfmt-267 binfmt_aout
alias binfmt-387 binfmt_aout
# block devices ##############################################################
alias block-major-3-* ide_generic
alias block-major-8-* sd_mod
alias block-major-9-* md
alias block-major-11-* sr_mod
alias block-major-22-* ide_generic
alias block-major-33-* ide_generic
alias block-major-34-* ide_generic
alias block-major-37-* ide_tape
alias block-major-44-* ftl
alias block-major-46-* pcd
alias block-major-47-* pf
alias block-major-56-* ide_generic
alias block-major-57-* ide_generic
alias block-major-58-* lvm_mod
alias block-major-88-* ide_generic
alias block-major-89-* ide_generic
alias block-major-90-* ide_generic
alias block-major-91-* ide_generic
alias block-major-93-* nftl
alias block-major-97-* pg
# character devices ##########################################################
alias char-major-9-* st
alias char-major-10-1 psmouse
alias char-major-10-139 openprom
alias char-major-10-157 applicom
alias char-major-10-181 toshiba
alias char-major-10-183 hw_random
alias char-major-10-187 irnet
alias char-major-10-189 ussp
alias char-major-10-250 hci_vhci
alias char-major-13-0 joydev
alias char-major-13-1 joydev
alias char-major-13-2 joydev
alias char-major-13-3 joydev
alias char-major-13-32 mousedev
alias char-major-13-33 mousedev
alias char-major-13-34 mousedev
alias char-major-13-35 mousedev
alias char-major-13-63 mousedev
alias char-major-13-64 evdev
alias char-major-13-65 evdev
alias char-major-13-66 evdev
alias char-major-13-67 evdev
alias char-major-19-* cyclades
alias char-major-20-* cyclades
alias char-major-22-* pcxx
alias char-major-23-* pcxx
alias char-major-27-* ftape
alias char-major-34-* scc
alias char-major-35-* tclmidi
alias char-major-48-* riscom8
alias char-major-49-* riscom8
alias char-major-57-* esp
alias char-major-58-* esp
alias char-major-63-* kdebug
alias char-major-67-* coda
alias char-major-75-* specialix
alias char-major-76-* specialix
alias char-major-81-* videodev
alias char-major-83-* vtx
alias char-major-89-* i2c_dev
alias char-major-90-* mtdchar
alias char-major-96-* pt
alias char-major-97-* pg
alias char-major-107-* 3dfx
alias char-major-109-* lvm_mod
alias char-major-166-* cdc_acm
alias char-major-171-0 raw1394
alias char-major-171-1 video1394
alias char-major-171-2 dv1394
alias char-major-171-3 amdtp
alias char-major-180-* usbcore
alias char-major-195-* nvidia
alias char-major-200-* vxspec
alias char-major-202-* msr
alias char-major-203-* cpuid
alias char-major-206-* osst
alias char-major-208-* ussp
alias char-major-227-* tub3270
#alias char-major-240-* usb-serial
#alias char-major-240-* hsfserial
#alias char-major-241-* hsfserial
# misc #######################################################################
alias xfrm-type-2-4 xfrm4_tunnel
alias xfrm-type-2-50 esp4
alias xfrm-type-2-51 ah4
alias xfrm-type-2-108 ipcomp
alias xfrm-type-10-41 xfrm6_tunnel
alias xfrm-type-10-50 esp6
alias xfrm-type-10-51 ah6
alias xfrm-type-10-108 ipcomp6
alias bt-proto-0 l2cap
alias bt-proto-2 sco
alias bt-proto-3 rfcomm
alias bt-proto-4 bnep
alias bt-proto-5 cmtp
alias bt-proto-6 hidp
alias bt-proto-7 avdtp
alias cipcb0 cipcb
alias cipcb1 cipcb
alias cipcb2 cipcb
alias cipcb3 cipcb
alias dummy0 dummy
alias dummy1 dummy
alias plip0 plip
alias plip1 plip
alias slip0 slip
alias slip1 slip
alias tunl0 ipip
alias gre0 ip_gre
alias usbdevfs usbcore
root@harmonicagoldfish:/etc/modprobe.d# alias net-pf-10 off
bash: alias: net-pf-10: not found
bash: alias: off: not found
root@harmonicagoldfish:/etc/modprobe.d# blacklist
bash: blacklist: command not found
root@harmonicagoldfish:/etc/modprobe.d# blacklist ipv6
bash: blacklist: command not found
root@harmonicagoldfish:/etc/modprobe.d#
I also tried the blacklist thing, as you can see in the results, with no luck.
thanks for any guidance!
18th June 2007, 07:42
You should use a text editor to make changes to that file. joe, vim, etc.
Also you can use MC also to easily navigate and edit (F4) the file. HTH.
13th September 2007, 04:11
[...] http://www.ducea.com/2006/06/01/disable-ipv6-module-on-default-kernels/ ohh nice .) [...]
24th October 2007, 12:38
[...] also a method to disable IPv6 module, which can be adopted for the pcspkr module. However, I didn’t use it - methods listed above [...]
20th April 2008, 00:18
On LinuxMint Daryna kernel 2.6.22-14-generic
I opened /etc/modprobe.d/aliases w/kate - replaced “ivp6″ with “off” - saved - closed.
Just as this article instructs & now no more Gazillions of “ivp6″ entries in the syslog.