内核与硬件管理
2017-07-10 本文已影响21人
尘曦的雨
proc目录及文件下的子系统
- proc可以查看进程的信息

- 临时设置让其他主机禁ping功能

- 修改该文件永久设置内存里的相关设置

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
#
# Use '/sbin/sysctl -a' to list all possible parameters.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0 #0表示关闭路由转发功能
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536 内存相关设置信息
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736 最大共享段尺寸字节为单位 默认最大64G控制内存使用情况
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296 表示一页为单位
- 修改该文件后让它马上生效执行“sysctl -p”命令让它马上生效

- 查看当前生效的值-a查看所有

- 这个值如果要设置成1的话;表示不接受ARP广播;0的接受ARP广播

、
这个表示所有都不接受ARP广播

这个如果设置成1表示自己设置的ip地址也不告诉其他主机

- 释放缓存

设置禁ping功能

-
7更改内核的配置
- 在此目录下设置相关的文件

- 加载文件

- 更改设备名起个名

起个名
参考系统的格式

格式如下

- 显示所有模块

- usb模块名称

- 手工加载USB模块

- 搜索模块名

- 卸载模块命令、

-挂载模块用此命令不用写ko

lsmod与该文件显示的内容一样

[root@chenxi ~]# lsmod
Module Size Used by
nls_utf8 1455 1
fuse 79892 2
rfcomm 71047 4
sco 17493 2
bridge 85706 0
bnep 16370 2
l2cap 54210 16 rfcomm,bnep 表示i后面依赖前面的
autofs4 27000 3
8021q 20475 0
garp 7152 1 8021q
stp 2218 2 bridge,garp
llc 5418 3 bridge,garp,stp
ipt_REJECT 2383 2
nf_conntrack_ipv4 9186 2
nf_defrag_ipv4 1483 1 nf_conntrack_ipv4
iptable_filter 2793 1
ip_tables 17895 1 iptable_filter
ip6t_REJECT 4372 2
nf_conntrack_ipv6 7985 3
nf_defrag_ipv6 26468 1 nf_conntrack_ipv6
xt_state 1492 5
nf_conntrack 79537 3 nf_conntrack_ipv4,nf_conntrack_ipv6,xt_state
ip6table_filter 2889 1
ip6_tables 18796 1 ip6table_filter
ib_ipoib 80839 0
rdma_ucm 15739 0
ib_ucm 12328 0
ib_uverbs 40372 2 rdma_ucm,ib_ucm
ib_umad 13487 0
rdma_cm 36555 1 rdma_ucm
ib_cm 36900 3 ib_ipoib,ib_ucm,rdma_cm
iw_cm 32976 1 rdma_cm
ib_sa 24092 4 ib_ipoib,rdma_ucm,rdma_cm,ib_cm
ib_mad 41340 3 ib_umad,ib_cm,ib_sa
ib_core 82732 10 ib_ipoib,rdma_ucm,ib_ucm,ib_uverbs,ib_umad,rdma_cm,ib_cm,iw_cm,ib_sa,ib_mad
ib_addr 8304 3 rdma_ucm,rdma_cm,ib_core
ipv6 336368 34 bridge,ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6,ib_ipoib,ib_addr
- 查看指定模块的详细
[root@chenxi ~]# modinfo ext4
filename: /lib/modules/2.6.32-696.el6.x86_64/kernel/fs/ext4/ext4.ko
license: GPL
description: Fourth Extended Filesystem
author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
srcversion: 74AEE2BDA63AC8482A78F4D
depends: mbcache,jbd2
vermagic: 2.6.32-696.el6.x86_64 SMP mod_unload modversions
[root@chenxi ~]# modinfo -n ext4 只显示模块路径
/lib/modules/2.6.32-696.el6.x86_64/kernel/fs/ext4/ext4.ko
- 列出模块参数-p

- 加载模块卸载模块

它可以解决模块之间依赖关系

insmod命令

查看对应xfs用户控件的软件包

装在内核模块

lspci 查看pci接口的sheb
查看硬件驱动信息

lsusb 查看USB接口设备的信息
- 列出所有硬件信息
