{"id":527080,"date":"2021-08-19T21:36:24","date_gmt":"2021-08-19T13:36:24","guid":{"rendered":"http:\/\/4563.org\/?p=527080"},"modified":"2021-08-19T21:36:24","modified_gmt":"2021-08-19T13:36:24","slug":"debian%e7%9a%84iptables%e5%92%8b%e6%8c%81%e4%b9%85%e5%8c%96%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=527080","title":{"rendered":"debian\u7684iptables\u548b\u6301\u4e45\u5316\uff1f"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>\u7b11\u82b1\u843d\u534a\u4e16\u7409\u7483<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>debian\u7684iptables\u548b\u6301\u4e45\u5316\uff1f<\/h3>\n<p>  \t\tiptable \u2013F\uff0c\u2013X\uff0c\u2013Z\u540e\u88c5\u4e86iptables-persistent\uff0c<br \/>  \u4f46\u662fsave\u540e\u7684\u6587\u4ef6\u5185\u5bb9\u8fd8\u662f\u2013F\uff0c-Z\uff0c-X\u4e4b\u524d\u7684\u89c4\u5219\u3002\u3002\u3002<br \/>  \u5927\u4f6c\u4eec\u6765\u4e2a\u6b63\u786e\u7684\u59ff\u52bfyc005t\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>tdd<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e00\u3001\u4fdd\u5b58\u9632\u706b\u5899\u89c4\u5219\u5230\u6587\u4ef6\u4e2d<\/p>\n<p>  iptables-save &gt; \/etc\/iptables.up.rules<\/p>\n<p>  \u4e8c\u3001\u914d\u7f6e\u542f\u52a8\u540e\u81ea\u52a8\u52a0\u8f7d\u6700\u65b0\u7684\u9632\u706b\u5899\u89c4\u5219<\/p>\n<p>  vi \/etc\/network\/if-pre-up.d\/iptables<\/p>\n<p>  \/etc\/network\/if-pre-up.d\/iptables\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<p>  #!\/bin\/sh<br \/>  \/sbin\/iptables-restore &lt; \/etc\/iptables.up.rules<\/p>\n<p>  \u4e09\u3001\u7ed9\u6587\u4ef6\u589e\u52a0\u53ef\u6267\u884c\u6743\u9650<\/p>\n<p>  chmod +x \/etc\/network\/if-pre-up.d\/iptables<\/p>\n<p>  \u56db\u3001\u914d\u7f6e\u5b8c\u6210\uff0c\u4ee5\u540e\u4fee\u6539\u4e86\u9632\u706b\u5899\u89c4\u5219\uff0c\u53ea\u9700\u8981\u6267\u884ciptables-save &gt; \/etc\/iptables.up.rules\u547d\u4ee4\u5c06\u6700\u65b0\u7684\u9632\u706b\u5899\u89c4\u5219\u5199\u5165\u6587\u4ef6\u5373\u53ef\u3002<\/p>\n<p>  \u6458\u81ea\u54ea\u91cc\u5fd8\u8bb0\u4e86 \u8bb0\u5728\u81ea\u5df1\u5c0f\u672c\u672c\u4e0a\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>hotpeople<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6539\u7528ufw \uff0c\u7b80\u5355\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7b11\u82b1\u843d\u534a\u4e16\u7409\u7483<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\ttdd \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-19 21:34<br \/>  \u4e00\u3001\u4fdd\u5b58\u9632\u706b\u5899\u89c4\u5219\u5230\u6587\u4ef6\u4e2d<\/p>\n<p>  iptables-save &gt; \/etc\/iptables.up.rules<\/p>\n<p>  \u8fd9\u4e2a\u8bd5\u8fc7\u4e86,\u91cd\u542f\u5c31\u6ca1\u4e86,\u8fd8\u5f97\u624b\u52a8\u6267\u884c\u8986\u76d6\u64cd\u4f5cyc016t<br \/>  \u5173\u952esave\u4fdd\u5b58\u7684\u662f\u6211\u5220\u6389\u89c4\u5219\u4e4b\u524d\u7684\u5185\u5bb9,\u5c31\u79bb\u8c31\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>a8184976<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7528 netfilter-persistent save \u547d\u4ee4\u5c31\u884c\uff0c\u4f60\u53ef\u4ee5\u8bd5\u4e00\u4e0b\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>tdd<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7b11\u82b1\u843d\u534a\u4e16\u7409\u7483 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-19 21:35<br \/>  \u8fd9\u4e2a\u8bd5\u8fc7\u4e86,\u91cd\u542f\u5c31\u6ca1\u4e86,\u8fd8\u5f97\u624b\u52a8\u6267\u884c\u6700\u540e\u4e00\u6761<\/p>\n<p> \u90a3\u5c31\u628a\u6700\u540e\u4e00\u53e5\u52a0\u5728rc.local\u91cc\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7b11\u82b1\u843d\u534a\u4e16\u7409\u7483<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\ta8184976 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-19 21:36<br \/>  \u7528 netfilter-persistent save \u547d\u4ee4\u5c31\u884c\uff0c\u4f60\u53ef\u4ee5\u8bd5\u4e00\u4e0b<\/p>\n<p>  \u5c31\u662fsave\u4e86&#8230;.<br \/>  \u7136\u540e\u5b83\u4fdd\u5b58\u7684\u5185\u5bb9\u662f\u6211save\u64cd\u4f5c\u524d,\u5220\u6389\u7684\u89c4\u5219<br \/>  yc014t\u7b49\u4e8e\u8bf4\u6211\u4fdd\u5b58\u4e86\u4e2a\u5bc2\u5bde,\u800c\u4e14\u624b\u52a8\u6539\u4fdd\u5b58\u540e\u7684\u6587\u4ef6,\u91cd\u542f\u4e4b\u540e\u4e5f\u662f\u4f1a\u6062\u590d\u5220\u9664\u7684\u89c4\u5219\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u5ba3\u4f20<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 \u5ba3\u4f20 \u4e8e 2021-8-19 21:40 \u7f16\u8f91 <\/p>\n<p> \u5b89\u88c5iptables-persistent\u4e4b\u540e<\/p>\n<p>  netfilter-persistent save<br \/>  \u4fdd\u5b58\u89c4\u5219<\/p>\n<p>  netfilter-persistent reload<br \/>  \u91cd\u65b0\u52a0\u8f7d\u89c4\u5219<\/p>\n<p>  \u89c4\u5219\u6587\u4ef6\u4f4d\u7f6e\uff0c\u6539\u8fd9\u4e2a\u7684\u8bdd\uff0creload\u751f\u6548<br \/>  \/etc\/iptables\/rules.v4<br \/>  \/etc\/iptables\/rules.v6<\/p>\n<p>  Ubuntu\/Debian\u4e00\u6837\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u8d75\u8707<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6211\u4e00\u822c\u662f\u8fd9\u6837\u6301\u4e45\u5316\u7684apt remove iptables\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7b11\u82b1\u843d\u534a\u4e16\u7409\u7483<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8d75\u8707 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-8-19 21:38<br \/>  \u6211\u4e00\u822c\u662f\u8fd9\u6837\u6301\u4e45\u5316\u7684apt remove iptables<\/p>\n<p> \u54c7,\u4f60\u8fd9\u4e2a\u547d\u4ee4yc009t,\u6211\u4ed6\u5988\u4e0b\u5348\u5c31\u662f\u88ab\u4e00\u7bc7\u6587\u7ae0\u5dee\u70b9\u5bb3\u6b7b,<br \/>  \u8fd9\u4e00\u4e2a\u547d\u4ee4\u4e0b\u53bb,\u673a\u5b50\u76f4\u63a5\u5931\u8054,\u67e5\u4e86\u4e00\u4e0b\u662f\u5220\u9664\u4e86\u5168\u90e8\u76f8\u5173\u7684\u8f6f\u4ef6,\u50cfdocker\u4e4b\u7c7b\u7684\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b11\u82b1\u843d\u534a\u4e16\u7409\u7483 \u5927\u4f6c\u6709\u8bdd\u8bf4 : d&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/527080"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=527080"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/527080\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=527080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=527080"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=527080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}