This config will describe a procedure on how to persistently load kernel modules during a boot time on CentOS or Redhat Linux system. In the below commands will use nf_conntrack_pptp
as a sample module. Replace the name of this module with a module name you wish to load.
First, create a script within /etc/sysconfig/modules/
directory with a file extension modules
. Where the name of the script can be any name of your choice. In our case the script will be called nf_conntrack_pptp.modules
. Enter a following code into your new nf_conntrack_pptp.modules
script while replacing the name of the module with the one you wish to load:
#!/bin/sh exec /sbin/modprobe nf_conntrack_pptp >/dev/null 2>&1
Lastly, make the script executable:
chmod +x /etc/sysconfig/modules/nf_conntrack_pptp.modules
All done. After you reboot your Linux system you can confirm that the scrip was loaded by using lsmod
and grep
commands:
# lsmod | grep nf_conntrack_pptp nf_conntrack_pptp 19258 0 nf_conntrack_proto_gre 14287 1 nf_conntrack_pptp nf_conntrack 105702 8 nf_conntrack_proto_gre,nf_nat,nf_nat_ipv4, nf_nat_ipv6,xt_conntrack,nf_conntrack_ipv4,nf_conntrack_ipv6,nf_conntrack_pptp