{"id":113,"date":"2020-04-28T16:19:33","date_gmt":"2020-04-28T08:19:33","guid":{"rendered":"https:\/\/chenqinghe.com\/?p=113"},"modified":"2020-04-28T16:20:47","modified_gmt":"2020-04-28T08:20:47","slug":"%e8%bd%ac%e5%85%b3%e4%ba%8eip_conntrack%e8%b7%9f%e8%b8%aa%e8%bf%9e%e6%8e%a5%e6%bb%a1%e5%af%bc%e8%87%b4%e7%bd%91%e7%bb%9c%e4%b8%a2%e5%8c%85%e9%97%ae%e9%a2%98%e7%9a%84%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/chenqinghe.com\/?p=113","title":{"rendered":"[\u8f6c]\u5173\u4e8eip_conntrack\u8ddf\u8e2a\u8fde\u63a5\u6ee1\u5bfc\u81f4\u7f51\u7edc\u4e22\u5305\u95ee\u9898\u7684\u5206\u6790"},"content":{"rendered":"<blockquote class=\"wp-block-quote\">\n<p>\u539f\u6587\u5730\u5740\uff1a <a href=\"https:\/\/blog.51cto.com\/ixdba\/1737642\" target=\"_blank\"  rel=\"nofollow\" >https:\/\/blog.51cto.com\/ixdba\/1737642<\/a> <\/p>\n<\/blockquote>\n<p> \u6211\u4eec\u7684\u7ebf\u4e0aweb\u670d\u52a1\u5668\u5728\u8bbf\u95ee\u91cf\u5f88\u5927\u65f6\uff0c\u5c31\u4f1a\u51fa\u73b0\u7f51\u7edc\u8fde\u63a5\u4e22\u5305\u7684\u95ee\u9898\uff0c\u901a\u8fc7dmesg\u547d\u4ee4\u67e5\u770b\u65e5\u5fd7\uff0c\u53d1\u73b0\u5982\u4e0b\u4fe1\u606f\uff1a <\/p>\n<pre class=\"wp-block-code\"><code>kernel: ip_conntrack: table full, dropping packet.\nkernel: printk: 1 messages suppressed.\nkernel: ip_conntrack: table full, dropping packet.\nkernel: printk: 2 messages suppressed.\nkernel: ip_conntrack: table full, dropping packet.<\/code><\/pre>\n<p> \u8fd9\u91cc\u9762\u5173\u952e\u7684\u4fe1\u606f\u662f&#8221;ip_conntrack: table full, dropping packet&#8221;,\u4ece\u8fd9\u91cc\u53ef\u4ee5\u5224\u65ad\u51fa\u8fd9\u8ddfiptables\u6709\u5173\u7cfb\u4e86\uff0c\u56e0\u4e3aiptables\u9632\u706b\u5899\u4f7f\u7528\u4e86ip_conntrack\u5185\u6838\u6a21\u5757\u5b9e\u73b0\u8fde\u63a5\u8ddf\u8e2a\u529f\u80fd\uff0c\u6240\u6709\u7684\u8fdb\u51fa\u6570\u636e\u5305\u90fd\u4f1a\u8bb0\u5f55\u5728\u8fde\u63a5\u8ddf\u8e2a\u8868\u4e2d\uff0c\u5305\u62ectcp\uff0cudp\uff0cicmp\u7b49\uff0c\u4e00\u65e6\u8fde\u63a5\u8ddf\u8e2a\u8868\u88ab\u586b\u6ee1\u4ee5\u540e\uff0c\u5c31\u4f1a\u53d1\u751f\u4e22\u5305\uff0c\u5bfc\u81f4\u7f51\u7edc\u4e0d\u7a33\u5b9a\u3002 <\/p>\n<p>\u800c\u6211\u4eec\u7684\u670d\u52a1\u5668\u786e\u5b9e\u6253\u5f00\u4e86iptables\u9632\u706b\u5899\uff0c\u5e76\u4e14\u90fd\u662f\u5728\u7f51\u7ad9\u6d41\u91cf\u975e\u5e38\u9ad8\u7684\u65f6\u5019\u7ecf\u5e38\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u95ee\u9898\u3002\u8fd9\u4e2a\u95ee\u9898\u7684\u539f\u56e0\u662f\u7531\u4e8eweb\u670d\u52a1\u5668\u6536\u5230\u4e86\u5927\u91cf\u7684\u8fde\u63a5\uff0c\u5728\u542f\u7528\u4e86iptables\u7684\u60c5\u51b5\u4e0b\uff0ciptables\u4f1a\u628a\u6240\u6709\u7684\u8fde\u63a5\u90fd\u505a\u94fe\u63a5\u8ddf\u8e2a\u5904\u7406\uff0c\u8fd9\u6837iptables\u5c31\u4f1a\u6709\u4e00\u4e2a\u94fe\u63a5\u8ddf\u8e2a\u8868\uff0c\u5f53\u8fd9\u4e2a\u8868\u6ee1\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u51fa\u73b0\u4e0a\u9762\u7684\u9519\u8bef\u3002<\/p>\n<p>iptables\u7684\u94fe\u63a5\u8ddf\u8e2a\u8868\u6700\u5927\u5bb9\u91cf\u914d\u7f6e\u6587\u4ef6\u5982\u4e0b\uff1a<\/p>\n<p>centos5 netfilter \u53c2\u6570\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\/proc\/sys\/net\/ipv4\/netfilter\/ip_conntrack_max\u6216\u8005\/proc\/sys\/net\/ipv4\/ip_conntrack_max<\/code><\/pre>\n<p>centos6 netfilter \u53c2\u6570\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\/proc\/sys\/net\/netfilter\/nf_conntrack_max<\/code><\/pre>\n<p> \u7531\u4e8enf_conntrack \u5de5\u4f5c\u57283\u5c42\uff0c\u652f\u6301IPv4\u548cIPv6\uff0c\u800cip_conntrack\u53ea\u652f\u6301IPv4\uff0c\u56e0\u6b64nf_conntrack\u6a21\u5757\u5728Linux\u76842.6.15\u5185\u6838\u4e2d\u88ab\u5f15\u5165\uff0c\u800cip_conntrack\u5728Linux\u76842.6.22\u5185\u6838\u88ab\u79fb\u9664\uff08centos6.x\u7248\u672c\uff09\uff0c\u56e0\u6b64\u4e0d\u540c\u7248\u672c\u7684\u7cfb\u7edf\uff0c\u914d\u7f6e\u6587\u4ef6\u4e5f\u5c31\u4e0d\u5c3d\u76f8\u540c\u4e86\u3002\u76ee\u524d\u5927\u591a\u7684ip_conntrack_*\u5df2\u88ab nf_conntrack_* \u53d6\u4ee3\uff0c\u5f88\u591aip_conntrack_*\u4ec5\u4ec5\u662f\u4e2a\u8f6f\u94fe\u63a5\uff0c\u539f\u5148\u7684ip_conntrack\u914d\u7f6e\u76ee\u5f55\/proc\/sys\/net\/ipv4\/netfilter\/ \u4ecd\u7136\u5b58\u5728\uff0c\u4f46\u662f\u65b0\u7684nf_conntrack\u5728\/proc\/sys\/net\/netfilter\/\u4e2d\uff0c\u8fd9\u6837\u505a\u662f\u4e3a\u4e86\u80fd\u591f\u5411\u4e0b\u7684\u517c\u5bb9\u3002 <\/p>\n<p> \u4e86\u89e3\u4e86\u914d\u7f6e\u6587\u4ef6\u7684\u53d8\u5316\u540e\uff0c\u6211\u4eec\u770b\u770b\u8fd9\u4e2a\u95ee\u9898\u8be5\u5982\u4f55\u89e3\u51b3\uff0c\u89e3\u6c7a\u65b9\u6cd5\u4e00\u822c\u6709\u4e24\u4e2a\uff1a <\/p>\n<p> 1\u3001\u8c03\u6574 \/proc\/ \u4e0b\u9762\u7684\u53c2\u6570 <\/p>\n<p> \u53ef\u4ee5\u589e\u5927\u9002\u5f53conntrack \u7684\u6761\u76ee\uff0c\u5728CentOS5\/RHEL 5\u4e0b\uff1a <\/p>\n<p> \uff081\uff09\u8fd0\u884c&nbsp; <\/p>\n<pre class=\"wp-block-code\"><code>sysctl -w net.ipv4.netfilter.ip_conntrack_max=655360<\/code><\/pre>\n<p> \uff082\uff09.\u5728 \/etc\/sysctl.conf \u4e2d\u52a0\u5165\uff1a <\/p>\n<pre class=\"wp-block-code\"><code>net.ipv4.netfilter.ip_conntrack_max = 655360<\/code><\/pre>\n<p> \uff083\uff09.\u4f7f\u5176\u751f\u6548 <\/p>\n<pre class=\"wp-block-code\"><code>sysctl -p<\/code><\/pre>\n<p> \u5728CentOS 6 \/RHEL6\u4e0b\uff1a <\/p>\n<p> \uff081\uff09\u8fd0\u884c&nbsp; <\/p>\n<pre class=\"wp-block-code\"><code>sysctl -w net.nf_conntrack_max=100000<\/code><\/pre>\n<p> \uff082\uff09\u5728 \/etc\/sysctl.conf \u4e2d\u52a0\u5165\uff1a <\/p>\n<pre class=\"wp-block-code\"><code>net.nf_conntrack_max = 100000<\/code><\/pre>\n<\/p>\n<p> \uff083\uff09\u4f7f\u5176\u751f\u6548 <\/p>\n<pre class=\"wp-block-code\"><code>sysctl -p<\/code><\/pre>\n<p> 2\u3001\u4e0d\u4f7f\u7528ip_conntrack\u6a21\u5757 <\/p>\n<p> \u5728CentOS5\/RHEL 5\u4e0b\uff1a <\/p>\n<p>\u4e0d\u4f7f\u7528ip_conntrack\uff0c\u9700\u8981\u79fb\u9664state\u6a21\u5757\uff0c\u56e0\u4e3a\u4f7f\u7528\u8be5\u6a21\u5757\u9700\u8981\u52a0\u8f7dip_conntrack\u3002\u786e\u4fddiptables\u89c4\u5219\u4e2d\u6ca1\u6709\u51fa\u73b0\u7c7b\u4f3cstate\u6a21\u5757\u7684\u89c4\u5219\uff0c\u5982\u679c\u6709\u7684\u8bdd\u5c06\u5176\u79fb\u9664\uff1a<\/p>\n<p> \u7136\u540e\u6ce8\u91ca \/etc\/sysconfig\/iptables-config \u4e2d\u7684\uff1a <\/p>\n<pre class=\"wp-block-code\"><code>IPTABLES_MODULES=\"ip_conntrack_netbios_ns\"<\/code><\/pre>\n<p> \u6700\u540e\u79fb\u9664ip_conntrack\u6a21\u5757\uff1a <\/p>\n<pre class=\"wp-block-code\"><code>modprobe -r ip_conntrack_netbios_ns xt_state<\/code><\/pre>\n<p> \u5728CentOS6\/RHEL6\u4e0b\uff1a <\/p>\n<pre class=\"wp-block-code\"><code>modprobe -r nf_conntrack_ipv4 xt_state\nmodprobe -r nf_conntrack<\/code><\/pre>\n<p> \u73b0\u5728 \/proc\/net\/ \u4e0b\u9762\u5e94\u8be5\u6ca1\u6709nf_conntrack\u4e86\u3002 <\/p>\n<p>\u4e24\u79cd\u65b9\u6cd5\u4e2d\uff0c\u7b2c\u4e00\u79cd\u7b80\u5355\uff0c\u4f46\u662f\u6cbb\u6807\u4e0d\u6cbb\u672c\uff0c\u7b2c\u4e8c\u79cd\u7a0d\u5fae\u9ebb\u70e6\uff0c\u4f46\u662f\u6bd5\u7adf\u4f7f\u7528\uff0c\u5927\u5bb6\u53ef\u6839\u636e\u60c5\u51b5\u8fdb\u884c\u9009\u62e9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740\uff1a https:\/\/blog.51cto.com\/ixdba\/1737642 \u6211\u4eec\u7684\u7ebf\u4e0aweb\u670d\u52a1\u5668\u5728\u8bbf\u95ee\u91cf\u5f88\u5927\u65f6\uff0c\u5c31\u4f1a\u51fa\u73b0\u7f51\u7edc\u8fde\u63a5\u4e22\u5305\u7684\u95ee\u9898\uff0c\u901a\u8fc7dmesg\u547d\u4ee4\u67e5\u770b\u65e5\u5fd7\uff0c\u53d1\u73b0\u5982\u4e0b\u4fe1\u606f\uff1a \u8fd9\u91cc\u9762\u5173\u952e\u7684\u4fe1\u606f\u662f&#8221;ip_conntrack: table full, dropping packet&#8221;,\u4ece\u8fd9\u91cc\u53ef\u4ee5\u5224\u65ad\u2026\u2026<\/p>\n","protected":false},"author":1,"featured_media":114,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[17,7],"_links":{"self":[{"href":"https:\/\/chenqinghe.com\/index.php?rest_route=\/wp\/v2\/posts\/113"}],"collection":[{"href":"https:\/\/chenqinghe.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chenqinghe.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chenqinghe.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chenqinghe.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=113"}],"version-history":[{"count":0,"href":"https:\/\/chenqinghe.com\/index.php?rest_route=\/wp\/v2\/posts\/113\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chenqinghe.com\/index.php?rest_route=\/wp\/v2\/media\/114"}],"wp:attachment":[{"href":"https:\/\/chenqinghe.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chenqinghe.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chenqinghe.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}