学习啦>学习电脑>操作系统>Linux教程>

sysctl命令怎么修改内核参数(2)

春健分享

  实例

  sysctl -a所看到的参数全部来自/proc/sys/目录下的文件内容,可以用grep加sort加ll的方法来查看与对应

  代码如下:

  [root@Firewall sys]# pwd

  /proc/sys

  [root@Firewall sys]# ll

  total 0

  dr-xr-xr-x 0 root root 0 Apr 12 14:29 crypto

  dr-xr-xr-x 0 root root 0 May 10 15:53 debug

  dr-xr-xr-x 0 root root 0 Apr 12 14:28 dev

  dr-xr-xr-x 0 root root 0 Apr 12 14:28 fs

  dr-xr-xr-x 0 root root 0 Apr 12 14:28 kernel

  dr-xr-xr-x 0 root root 0 Apr 12 14:28 net

  dr-xr-xr-x 0 root root 0 May 10 15:53 sunrpc

  dr-xr-xr-x 0 root root 0 May 10 15:53 vm

  代码如下:

  [root@Firewall netfilter]# pwd

  /proc/sys/net/netfilter

  [root@Firewall netfilter]# sysctl -a|grep net.net|sort

  net.netfilter.nf_conntrack_acct = 1

  net.netfilter.nf_conntrack_buckets = 16384

  net.netfilter.nf_conntrack_checksum = 1

  net.netfilter.nf_conntrack_count = 1739

  net.netfilter.nf_conntrack_expect_max = 256

  net.netfilter.nf_conntrack_generic_timeout = 600

  net.netfilter.nf_conntrack_icmp_timeout = 30

  net.netfilter.nf_conntrack_log_invalid = 0

  net.netfilter.nf_conntrack_max = 65536

  net.netfilter.nf_conntrack_tcp_be_liberal = 0

  net.netfilter.nf_conntrack_tcp_loose = 1

  net.netfilter.nf_conntrack_tcp_max_retrans = 3

  net.netfilter.nf_conntrack_tcp_timeout_close = 10

  net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60

  net.netfilter.nf_conntrack_tcp_timeout_established = 432000

  net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120

  net.netfilter.nf_conntrack_tcp_timeout_last_ack = 30

  net.netfilter.nf_conntrack_tcp_timeout_max_retrans = 300

  net.netfilter.nf_conntrack_tcp_timeout_syn_recv = 60

  net.netfilter.nf_conntrack_tcp_timeout_syn_sent = 120

  net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120

  net.netfilter.nf_conntrack_tcp_timeout_unacknowledged = 300

  net.netfilter.nf_conntrack_udp_timeout = 30

  net.netfilter.nf_conntrack_udp_timeout_stream = 180

  代码如下:

  [root@Firewall netfilter]# ll

  total 0

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_acct

  -r--r--r-- 1 root root 0 May 10 15:53 nf_conntrack_buckets

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_checksum

  -r--r--r-- 1 root root 0 May 10 15:53 nf_conntrack_count

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_expect_max

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_generic_timeout

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_icmp_timeout

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_log_invalid

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_max

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_be_liberal

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_loose

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_max_retrans

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_close

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_close_wait

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_established

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_fin_wait

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_last_ack

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_max_retrans

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_syn_recv

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_syn_sent

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_time_wait

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_tcp_timeout_unacknowledged

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_udp_timeout

  -rw-r--r-- 1 root root 0 May 10 15:53 nf_conntrack_udp_timeout_stream

  代码如下:

  [root@Firewall core]# sysctl -a|grep net.core|sort

  net.core.dev_weight = 64

  net.core.message_burst = 10

  net.core.message_cost = 5

  net.core.netdev_budget = 300

  net.core.netdev_max_backlog = 1000

  net.core.optmem_max = 10240

  net.core.rmem_default = 111616

  net.core.rmem_max = 131071

  net.core.somaxconn = 8192

  net.core.warnings = 1

  net.core.wmem_default = 111616

  net.core.wmem_max = 131071

  net.core.xfrm_acq_expires = 30

  net.core.xfrm_aevent_etime = 10

  net.core.xfrm_aevent_rseqth = 2

  net.core.xfrm_larval_drop = 1

  代码如下:

  [root@Firewall core]# ll

  total 0

  -rw-r--r-- 1 root root 0 May 10 15:53 dev_weight

  -rw-r--r-- 1 root root 0 May 10 15:53 message_burst

  -rw-r--r-- 1 root root 0 May 10 15:53 message_cost

  -rw-r--r-- 1 root root 0 May 10 15:53 netdev_budget

  -rw-r--r-- 1 root root 0 May 10 15:53 netdev_max_backlog

  -rw-r--r-- 1 root root 0 May 10 15:53 optmem_max

  -rw-r--r-- 1 root root 0 May 10 15:53 rmem_default

  -rw-r--r-- 1 root root 0 May 10 15:53 rmem_max

  -rw-r--r-- 1 root root 0 Apr 12 14:29 somaxconn

  -rw-r--r-- 1 root root 0 May 10 15:53 warnings

  -rw-r--r-- 1 root root 0 May 10 15:53 wmem_default

  -rw-r--r-- 1 root root 0 May 10 15:53 wmem_max

  -rw-r--r-- 1 root root 0 May 10 15:53 xfrm_acq_expires

  -rw-r--r-- 1 root root 0 May 10 15:53 xfrm_aevent_etime

  -rw-r--r-- 1 root root 0 May 10 15:53 xfrm_aevent_rseqth

  -rw-r--r-- 1 root root 0 May 10 15:53 xfrm_larval_drop

看过“ sysctl命令怎么修改内核参数 ”的人还看了:

1.linux如何防止DDOS攻击

2.分析Linux系统rc.sysinit脚本

3.Linux虚拟环境怎么搭建DB2数据库DPF

4.Linux内核配制详细说明

5.Linux虚拟环境下怎么搭建DB2数据库DPF

6.Linux内核配制详细说明

749517