Linux Kernel module

Source: Internet
Author: User

Linux Kernel module

Guide The Linux kernel adopts the modular technology. This design minimizes the system kernel and ensures the scalability and maintainability of the kernel. the modular design allows us to load modules to the kernel as needed, realize Dynamic kernel adjustment. The following describes how to operate the kernel.

Kernel module storage location

The Linux kernel module File is usually named as <Module name. ko>. kernel modules of Centos 6.3 are stored in the/lib/modules/'uname-R'/directory.

View loaded system modules

The lsmod command is used to display the status of the current Linux kernel module. If no parameters are used, all the currently loaded kernel modules are displayed. The output information is the module name, memory usage, and whether the module is in use. If the third column is 0, the module can be detached at any time. If the value is not 0, modprobe cannot be deleted.

[root@centos6 ~]# lsmodModule                Size              Used bybridge                 79950             0stp                    2173              1     bridgellc                    5642              2     bridge,stpfuse                   66891             2autofs4                27212             3sunrpc                 263516            1ipt_REJECT             2351              2nf_conntrack_ipv4      9606              1nf_defrag_ipv4         1483              1     nf_conntrack_ipv4iptable_filter         2793              1ip_tables              17831             1     iptable_filter
Load and uninstall the system kernel

The modprobe command can dynamically load and uninstall the kernel module. The specific command is as follows:

[Root @ centos6 ~] # Modprobe ip_vs # dynamically load the ip_vs module [root @ centos6 ~] # Lsmod | grep ip_vs # Check whether the module is successfully loaded [root @ centos6 ~] # Modprobe-r ip_vs # dynamically uninstall the ip_vs Module

The modinfo command can also view the kernel module information:

[root@centos6 ~]# modinfo ip_vs
Modify Kernel Parameters Temporarily adjust Kernel Parameters

Linux system parameters will be written into the system memory as the system starts up. We can directly modify a large number of files in the/proc directory to adjust the kernel parameters, and this adjustment takes effect immediately, the following example shows how to enable the kernel route forwarding function (set the switch through 0 or 1 ):

[root@centos6 ~]# echo "1" > /proc/sys/net/ipv4/ip_forward

Enable the function of disabling other hosts from pinging the Host:

[root@centos6 ~]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all

Adjust the total number of files that can be opened by all processes:

[root@centos6 ~]# echo "108248" >/proc/sys/fs/file-max
Permanently adjust Kernel Parameters

You can directly modify the files related to/proc by using the preceding method. The files are no longer valid after the system is restarted. If you want to set the parameters to take effect permanently, you can modify/etc/sysctl. conf file. You can use Vim to modify the file:

[root@centos6 ~]# vim /etc/sysctl.confnet.ipv4.ip_forward = 1net.ipv4.icmp_echo_ignore_all = 1fs.file-max = 108248

Note: parameters modified through the sysctl. conf file do not take effect immediately. You need to use the sysctl-p command to set the parameters to take effect immediately.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.