1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[インシデント]nf_conntrack: table full, dropping packet

Posted at

環境

  • OSはCentOS6。
  • nginx / tomcatでJavaアプリケーションを稼働させているサーバ。
  • アドテクノロジーのプロダクトサーバであることから、通信量は多い。

現象

  • とあるサーバ間での通信エラーが発生していた。
  • /var/log/messagesに以下の内容が連続して出力されていることが確認できた。
Jun  3 14:32:12 xxxx kernel: nf_conntrack: table full, dropping packet.
Jun  3 14:32:12 xxxx kernel: nf_conntrack: table full, dropping packet.
Jun  3 14:32:12 xxxx kernel: nf_conntrack: table full, dropping packet.
Jun  3 14:32:12 xxxx kernel: nf_conntrack: table full, dropping packet.
Jun  3 14:32:12 xxxx kernel: nf_conntrack: table full, dropping packet.

原因

  • ip_conntrackの最大トラッキング数を超過して、新規セッションを弾いてしまって、ネットワークパフォーマンスが劣化した。
  • 当該サーバはnf_conntrack_maxの値が65536(デフォルト値)になっていた。
[root@xxxx ~]# cat /proc/sys/net/netfilter/nf_conntrack_max
65536
[root@xxxx ~]#
  • 現在の接続数は以下のコマンドで確認することが可能。
[root@xxxx ~]# cat /proc/sys/net/netfilter/nf_conntrack_count
72861
[root@xxxx ~]#

解決策

  • /etc/sysctl.confnet.netfilter.nf_conntrack_maxを接続数よりも大きい値とし、設定を反映する。
    • 以下の例では、500000に値を設定している
■/etc/sysctl.conf編集後の反映コマンド
/sbin/sysctl -p

■反映処理の例
[root@xxxx etc]# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
vm.swappiness = 0
net.ipv4.ip_local_port_range = 32768 65000
net.ipv4.tcp_fin_timeout = 5
net.ipv4.tcp_max_tw_buckets = 900000
net.ipv4.tcp_max_syn_backlog = 60000
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.netfilter.nf_conntrack_max = 500000
net.nf_conntrack_max = 500000
net.core.somaxconn = 2048
net.core.netdev_max_backlog = 30720
net.ipv4.conf.all.log_martians = 1
[root@xxxx etc]# cat /proc/sys/net/netfilter/nf_conntrack_max
500000
[root@xxxx etc]#
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?