Linux 設備驅動以Kernel Module形式存在,Linux Kernel Module可以動態加載到內核中。
- lsmod Show the status of modules in the Linux Kernel
- modinfo Show information about a Linux Kernle module
- modprobe Add and Remove modules from the Linux Kernel
示例1:
- 加載ip_vs模塊(重啟后失效)
$ modprobe -v ip_vs $ lsmod | grep ip_vs ip_vs 145497 0 nf_conntrack 139224 7 ip_vs,nf_nat,nf_nat_ipv4,nf_nat_ipv6,xt_conntrack,nf_conntrack_ipv4,nf_conntrack_ipv6 libcrc32c 12644 4 xfs,ip_vs,nf_nat,nf_conntrack
- 卸載ip_vs模塊
$ modprobe -v -r ip_vs
- 開機自動加載
// 將模塊加載命令放入 /etc/sysconfig/modules 路徑下
$ cat > /etc/sysconfig/modules/ipvs.modules <<EOF > /sbin/modprobe ip_vs > EOF