zoukankan      html  css  js  c++  java
  • iptables ip_conntrack_max

    iptables ip_conntrack_max

    1、what

    允许的最大跟踪连接条目

    -允许的最大跟踪连接条目:CONNTRACK_MAX(默认值是 2^16=65536

    -存储跟踪连接条目列表的哈西表的大小:HASHSIZE

    -每个哈西表的条目(叫一个bucket),包含了一个链接起来的跟踪连接条目

    -哈希表大小HASHSIZE,表现为 条目bucket的多少,在iptables启动时在日志中会显示。

    First of all, let us see what IP_CONNTRACK is. It is nothing but the number of sessions that can be handled simultaneously by netfilter in kernel memory.

    ip_conntrack_max计算公式:

    CONNTRACK_MAX = RAMSIZE (in bytes) / 16384 / (x / 32)

    这里x是指针的bit数,(例如,32或者64bit

    通常,CONNTRACK_MAX = HASHSIZE * 8。这意味着每个链接的列表平均包含8conntrack的条目(在优化的情况并且CONNTRACK_MAX达到的情况下),每个链接的列表就是一个哈西表条目(一个桶)。

    Linux kernel 2.4.23版本前,使用:

    # cat /proc/sys/net/ipv4/ip_conntrack_max

    Linux kernel 2.4.23版本后,使用:

    # cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max

    对于linux内核2.4.24以后,当前的HASHSIZE值可以在运行时使用下面的命令读取:

    # cat /proc/sys/net/ipv4/netfilter/ip_conntrack_buckets

    2、how

    # vi /etc/sysctl.conf

    # Append this line

    >> net.ipv4.ip_conntrack_max = CONNTRACK_MAX

    where,

    CONNTRACK_MAX = RAMSIZE (in bytes) / 16384 / (x / 32)

    where x is the number of bits in a pointer (for example, 32 or 64 bits).

    To save the changes quit the editor and execute the command:

    # sysctl -p

    原文

    [1]http://hi.baidu.com/dreamcast_sh/item/b378d6e04b83b9f42a09a4b5

    [2]http://blog.sina.com.cn/s/blog_4078ccd601012crx.html

    [3]http://wiki.khnet.info/index.php/Conntrack_tuning

    [4]http://www.webhostrepo.com/blog/how_to_increase_ip_conntrack_value

  • 相关阅读:
    Android Layout XML属性
    linux]ubuntu挂载U盘
    Android之NDK开发
    Android 创建永不Kill的Service
    如何编写可移植的c/c++代码
    Android写日志文件类
    Android Activity去除标题栏和状态栏
    linux .bash_profile和.bashrc的什么区别
    ListView.setOnItemClickListener、setOnCreateContextMenuListener无效 为什么
    WCF 第四章 绑定 使用队列技术进行通信
  • 原文地址:https://www.cnblogs.com/mydomain/p/3077027.html
Copyright © 2011-2022 走看看