Think before you speak, read before you think.

使用iptables遇到nf_conntrack table full

环境 centos 6.6

在/var/log/messages看到报错

kernel: nf_conntrack: table full, dropping packet.

nf_conntrack 默认最大值 65536

cat /proc/sys/net/ipv4/ip_conntrack_max | wc -l

超过这个 65536 便会报错。

现在将值改为 655360 并且永久生效

首先修改/etc/sysctl.conf

net.nf_conntrack_max = 655360
net.netfilter.nf_conntrack_max = 655350
net.netfilter.nf_conntrack_tcp_timeout_established = 1200

然后修改/etc/sysconfig/iptables-config
注意如下两行

IPTABLES_MODULES="ip_conntrack"
IPTABLES_SYSCTL_LOAD_LIST=".nf_conntrack"

之后重新 iptables.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *