{"id":6504,"date":"2022-03-01T22:28:50","date_gmt":"2022-03-02T06:28:50","guid":{"rendered":"https:\/\/www.xh86.me\/?p=6504"},"modified":"2022-03-01T22:28:50","modified_gmt":"2022-03-02T06:28:50","slug":"%e8%bf%90%e7%bb%b4%e5%b7%a5%e7%a8%8b%e5%b8%88%ef%bc%9a%e9%85%8d%e7%bd%aeiptables%e9%98%b2%e7%81%ab%e5%a2%99%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=6504","title":{"rendered":"\u8fd0\u7ef4\u5de5\u7a0b\u5e08\uff1a\u914d\u7f6eiptables\u9632\u706b\u5899\u57fa\u7840"},"content":{"rendered":"<div class=\"wxsyncmain\">\n<section style=\"font-size: 15px; letter-spacing: 1px; line-height: 2; box-sizing: border-box; font-style: normal; font-weight: 400; text-align: justify;\" data-mpa-powered-by=\"yiban.io\">\n<section style=\"text-align: center; margin-top: 10px; margin-bottom: 10px; box-sizing: border-box;\">\n<section style=\"max-width: 100%; vertical-align: middle; display: inline-block; line-height: 0; box-sizing: border-box;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-8d71948380954375fa98cb840c03837a.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" class=\"rich_pages wxw-img\" style=\"vertical-align: middle; max-width: 100%; box-sizing: border-box;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-8d71948380954375fa98cb840c03837a.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.6629213\" data-type=\"jpeg\" data-w=\"445\" \/><\/div><\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<section style=\"margin: 50px 0% 10px; display: flex; flex-flow: row nowrap; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: auto; vertical-align: top; background-color: #f7f7f9; flex: 100 100 0%; height: auto; align-self: stretch; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: -22px 0% 10px; display: flex; flex-flow: row nowrap; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; min-width: 10%; max-width: 100%; flex: 0 0 auto; height: auto; line-height: 0; align-self: center; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 55px; height: 55px; vertical-align: top; overflow: hidden; border-radius: 185px; background-color: #000000; box-sizing: border-box; border: 0px none #3e3e3e;\">\n<section style=\"justify-content: center; transform: translate3d(1px, 0px, 0px); -webkit-transform: translate3d(1px, 0px, 0px); -moz-transform: translate3d(1px, 0px, 0px); -o-transform: translate3d(1px, 0px, 0px); margin: 28px 0% 0px; box-sizing: border-box;\">\n<section style=\"letter-spacing: 0px; color: #ffffff; line-height: 0.1; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u76ee\u5f55<\/strong><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: top; width: auto; flex: 0 0 0%; height: auto; line-height: 0; align-self: flex-start; box-sizing: border-box;\">\n<section style=\"transform: rotateZ(145deg); -webkit-transform: rotateZ(145deg); -moz-transform: rotateZ(145deg); -o-transform: rotateZ(145deg); box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 10px; vertical-align: top; border-bottom: 2px solid #f5ac97; border-bottom-right-radius: 0px; height: auto; box-sizing: border-box;\">\n<section style=\"transform: rotateZ(24deg); -webkit-transform: rotateZ(24deg); -moz-transform: rotateZ(24deg); -o-transform: rotateZ(24deg); box-sizing: border-box;\">\n<section style=\"margin: 0px 0% 8px; box-sizing: border-box;\">\n<section style=\"background-color: #31302f; height: 2px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"margin: 20px 0%; box-sizing: border-box;\">\n<section style=\"line-height: 1.8; letter-spacing: 1px; padding: 0px 26px; color: #000000; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: #827fc4; box-sizing: border-box;\">\u4e00\uff1a<\/span>iptables\u5e38\u89c1\u6982\u5ff5<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"margin: 20px 0%; box-sizing: border-box;\">\n<section style=\"line-height: 1.8; letter-spacing: 1px; padding: 0px 26px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: #827fc4; box-sizing: border-box;\">\u4e8c\uff1a <span style=\"color: #000000; box-sizing: border-box;\">iptables\u670d\u52a1\u5668\u5b89\u88c5\u53ca\u76f8\u5173\u914d\u7f6e\u6587\u4ef6<\/span><\/span><\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"margin: 20px 0%; box-sizing: border-box;\">\n<section style=\"line-height: 1.8; letter-spacing: 1px; padding: 0px 26px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: #827fc4; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u4e09\uff1a<\/strong><\/span><strong style=\"box-sizing: border-box;\"> \u5b9e\u6218\uff1aiptables\u4f7f\u7528\u65b9\u6cd5<\/strong><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u8bf4\u660e:<\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">Centos7.X \u5f00\u59cb,\u7cfb\u7edf\u81ea\u5e26\u7684\u9632\u706b\u5899\u7ba1\u7406\u5de5\u5177\u662ffirewalld\uff0c\u4f46\u662f\u4e5f\u540c\u6837\u652f\u6301iptables\uff0c\u672c\u8282\u8bfe\u6211\u4eec\u4ecd\u7136\u7528iptables\u6765\u4f5c\u4e3a\u9632\u706b\u5899\u6765\u4e3b\u8bb2\uff0c\u4e0b\u6b21\u8bfe\u6211\u4eec\u4e5f\u4f1a\u7ed9\u5927\u5bb6\u8be6\u7ec6\u8bb2\u89e3firewalld\u7684\u5e38\u7528\u914d\u7f6e\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables\u670d\u52a1\u7aef\uff1axuegod63 \u00a0\u00a0IP\uff1a192.168.1.63<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables\u5ba2\u6237\u7aef\uff1axuegod64\u00a0\u00a0\u00a0IP\uff1a192.168.1.64<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"margin: 10px 0%; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 100%; vertical-align: top; border-width: 1px; border-style: solid none; border-color: #3e3e3e; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"align-items: center; display: flex; margin: -3px 0%; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 0 0 auto; border-width: 0px 0px 0px 2px; border-style: none none none solid; border-color: #3e3e3e; overflow: hidden; box-sizing: border-box;\">\n<section style=\"text-align: center; margin: 0px 0%; transform: translate3d(-10px, 0px, 0px); -webkit-transform: translate3d(-10px, 0px, 0px); -moz-transform: translate3d(-10px, 0px, 0px); -o-transform: translate3d(-10px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; min-width: 10%; max-width: 100%; vertical-align: top; transform: matrix(1, 0, -0.2, 1, 0, 0); -webkit-transform: matrix(1, 0, -0.2, 1, 0, 0); -moz-transform: matrix(1, 0, -0.2, 1, 0, 0); -o-transform: matrix(1, 0, -0.2, 1, 0, 0); padding: 6px 10px 6px 20px; background-color: #000000; box-sizing: border-box; border: 2px solid #3e3e3e;\">\n<section style=\"line-height: 1; letter-spacing: 0px; padding: 0px; color: #ffffff; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">No.1<\/strong><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 1 1 auto; border-width: 0px; box-sizing: border-box;\">\n<section style=\"line-height: 1; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">iptables\u5e38\u89c1\u6982\u5ff5<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 0 0 auto; overflow: hidden; box-sizing: border-box; border: 0px none #3e3e3e;\">\n<section style=\"text-align: center; margin: -2px 0%; transform: translate3d(10px, 0px, 0px); -webkit-transform: translate3d(10px, 0px, 0px); -moz-transform: translate3d(10px, 0px, 0px); -o-transform: translate3d(10px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; min-width: 10%; max-width: 100%; vertical-align: top; transform: matrix(1, 0, -0.2, 1, 0, 0); -webkit-transform: matrix(1, 0, -0.2, 1, 0, 0); -moz-transform: matrix(1, 0, -0.2, 1, 0, 0); -o-transform: matrix(1, 0, -0.2, 1, 0, 0); padding: 6px 10px; background-color: #ffffff; box-sizing: border-box; border: 2px solid #3e3e3e;\">\n<section style=\"line-height: 1; letter-spacing: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">netfilter\/iptables\u662f\u96c6\u6210\u5728\u5185\u6838\u4e2d\u7684\u5305\u8fc7\u6ee4\u9632\u706b\u5899\u7cfb\u7edf\u3002\u8be5\u67b6\u6784\u53ef\u4ee5\u5b9e\u73b0\u6570\u636e\u5305\u8fc7\u6ee4\uff0c\u7f51\u7edc\u5730\u5740\u8f6c\u6362\u4ee5\u53ca\u6570\u636e\u5305\u7ba1\u7406\u529f\u80fd\u3002linux\u4e2d\u9632\u706b\u5899\u5206\u4e3a\u4e24\u90e8\u5206\uff1anetfilter\u548ciptables\u3002netfilter\u4f4d\u4e8e\u5185\u6838\u7a7a\u95f4\uff0c\u76ee\u524d\u662fLinux\u5185\u6838\u7684\u7ec4\u6210\u90e8\u5206\u3002netfilter\u53ef\u4ee5\u5bf9\u672c\u673a\u6240\u6709\u6d41\u5165\uff0c\u6d41\u51fa\uff0c\u8f6c\u53d1\u7684\u6570\u636e\u5305\u8fdb\u884c\u67e5\u770b\uff0c\u4fee\u6539\uff0c\u4e22\u5f03\uff0c\u62d2\u7edd\u7b49\u64cd\u4f5c\u3002netfilter\u4f4d\u4e8e\u5185\u6838\u7a7a\u95f4\u4e2d\uff0c\u7528\u6237\u65e0\u6cd5\u63a5\u89e6\u5185\u6838\u548c\u4fee\u6539\u5185\u6838\uff0c\u9700\u8981\u4f7f\u7528iptables\u6216Firewalld\u7b49\u5de5\u5177\u6765\u8fdb\u884c\u7ba1\u7406\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">1.1 \u00a0iptables\u6982\u8ff0<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">netfilter\/iptables\uff1aIP\u4fe1\u606f\u5305\u8fc7\u6ee4\u7cfb\u7edf\uff0c\u5b83\u5b9e\u9645\u4e0a\u7531\u4e24\u4e2a\u7ec4\u4ef6netfilter \u548c iptables \u7ec4\u6210\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">netfilter\/iptables \u5173\u7cfb\uff1a<\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">netfilter \u7ec4\u4ef6\u4e5f\u79f0\u4e3a\u5185\u6838\u7a7a\u95f4\uff08kernelspace\uff09\uff0c\u662f\u5185\u6838\u7684\u4e00\u90e8\u5206\uff0c\u7531\u4e00\u4e9b\u4fe1\u606f\u5305\u8fc7\u6ee4\u8868\u7ec4\u6210\uff0c\u8fd9\u4e9b\u8868\u5305\u542b\u5185\u6838\u7528\u6765\u63a7\u5236\u4fe1\u606f\u5305\u8fc7\u6ee4\u5904\u7406\u7684\u89c4\u5219\u96c6\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables \u7ec4\u4ef6\u662f\u4e00\u79cd\u5de5\u5177\uff0c\u4e5f\u79f0\u4e3a\u7528\u6237\u7a7a\u95f4\uff08userspace\uff09\uff0c\u5b83\u4f7f\u63d2\u5165\u3001\u4fee\u6539\u548c\u9664\u53bb\u4fe1\u606f\u5305\u8fc7\u6ee4\u8868\u4e2d\u7684\u89c4\u5219\u53d8\u5f97\u5bb9\u6613\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">netfilter\/iptables \u540e\u671f\u7b80\u79f0\u4e3a\uff1a<strong style=\"box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables<\/span><\/strong>\u3002 iptables\u662f\u57fa\u4e8e\u5185\u6838\u7684\u9632\u706b\u5899\uff0c\u529f\u80fd\u975e\u5e38\u5f3a\u5927\uff0ciptables\u5185\u7f6e\u4e86filter\uff0cnat\u548cmangle\u3001raw\u56db\u5f20\u8868\u3002\u6240\u6709\u89c4\u5219\u914d\u7f6e\u540e\uff0c\u7acb\u5373\u751f\u6548\uff0c\u4e0d\u9700\u8981\u91cd\u542f\u670d\u52a1\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">1.2 \u00a0\u56db\u5f20\u8868\u4ecb\u7ecd<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">filter\u8d1f\u8d23\u8fc7\u6ee4\u6570\u636e\u5305\uff0c\u5305\u62ec\u7684\u89c4\u5219\u94fe\u6709\uff0cinput\uff0coutput\u548cforward\uff1b<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">nat\u5219\u6d89\u53ca\u5230\u7f51\u7edc\u5730\u5740\u8f6c\u6362\uff0c\u5305\u62ec\u7684\u89c4\u5219\u94fe\u6709\uff0cprerouting\uff0cpostrouting\u548coutput\uff1b<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">mangle\u8868\u5219\u4e3b\u8981\u5e94\u7528\u5728\u4fee\u6539\u6570\u636e\u5305\u5185\u5bb9\u4e0a\uff0c\u7528\u6765\u505a\u6d41\u91cf\u6574\u5f62\u7684\uff0c\u7ed9\u6570\u636e\u5305\u6253\u4e2a\u6807\u8bc6\uff0c\u9ed8\u8ba4\u7684\u89c4\u5219\u94fe\u6709\uff1aINPUT\uff0cOUTPUT\u3001\u00a0forward\uff0cPOSTROUTING\uff0cPREROUTING\uff1b<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">raw\u8868\u4f18\u5148\u7ea7\u6700\u9ad8\uff08\u4e0d\u5e38\u7528\uff09\uff0c\u53ea\u4f7f\u7528\u5728PREROUTING\u94fe\u548cOUTPUT\u94fe\u4e0a\uff0c\u4f1a\u8df3\u8fc7NAT\u8868\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">1.3 \u00a0iptables\u7684\u4e94\u4e2a\u94fe<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">input\uff1a\u5339\u914d\u76ee\u6807IP\u662f\u672c\u673a\u7684\u6570\u636e\u5305\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">output\uff1a\u51fa\u53e3\u6570\u636e\u5305\uff0c\u4e00\u822c\u4e0d\u5728\u6b64\u94fe\u4e0a\u505a\u914d\u7f6e<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">forward\uff1a\u5339\u914d\u6d41\u7ecf\u672c\u673a\u7684\u6570\u636e\u5305\uff0c<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">prerouting\uff1a\u7528\u6765\u4fee\u6539\u76ee\u7684\u5730\u5740\uff0c\u7528\u6765\u505aDNAT\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5982\uff1a\u628a\u5185\u7f51\u4e2d\u768480\u7aef\u53e3\u6620\u5c04\u5230\u8def\u7531\u5668\u5916\u7f51\u7aef\u53e3\u4e0a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">postrouting\u7528\u6765\u4fee\u6539\u6e90\u5730\u5740\u7528\u6765\u505aSNAT\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5982\uff1a\u5185\u7f51\u901a\u8fc7\u8def\u7531\u5668NAT\u8f6c\u6362\u529f\u80fd\u5b9e\u73b0\u5185\u7f51PC\u673a\u901a\u8fc7\u4e00\u4e2a\u516c\u7f51IP\u5730\u5740\u4e0a\u7f51<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">1. iptables\u56db\u4e2a\u8868\uff0c5\u4e2a\u94fe\u63a5\uff0c\u7ed3\u6784\u5982\u56fe\uff1a<\/p>\n<\/section>\n<section style=\"text-align: center; margin-top: 10px; margin-bottom: 10px; box-sizing: border-box;\">\n<section style=\"max-width: 100%; vertical-align: middle; display: inline-block; line-height: 0; box-sizing: border-box;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-53a85c747ac282f0d14fbe3fe987b07e.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" class=\"rich_pages wxw-img\" style=\"vertical-align: middle; max-width: 100%; box-sizing: border-box;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-53a85c747ac282f0d14fbe3fe987b07e.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.5338895\" data-type=\"png\" data-w=\"959\" \/><\/div><\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">raw \u8868\uff1a\u7528\u4e8e\u5904\u7406\u5f02\u5e38\uff0c\u5305\u62ec\u7684\u89c4\u5219\u94fe\u6709\uff0cprerouting\uff0coutput\uff1b \u4e00\u822c\u4f7f\u7528\u4e0d\u5230\uff0craw\u5728\u6574\u4e2a\u9632\u706b\u5899\u4f53\u7cfb\u4f18\u5148\u7ea7\u6700\u9ad8\uff0c\u5982\u679c\u542f\u52a8\u7528raw\u8868\uff0c\u6570\u636e\u5c06\u4f1a\u8df3\u8fc7conntrack\uff08\u8fde\u63a5\u8ddf\u8e2a\u673a\u5236\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\uff1a\u67e5\u770braw\u8868\u4e2d\u7684\u5185\u5bb9\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t raw -L<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\"><span class=\"code-snippet__function\" style=\"box-sizing: border-box;\">Chain <span class=\"code-snippet__title\" style=\"box-sizing: border-box;\">PREROUTING<\/span> <span class=\"code-snippet__params\" style=\"box-sizing: border-box;\">(policy ACCEPT)<\/span><\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">target \u00a0 \u00a0 prot opt source \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 destination \u00a0 \u00a0 \u00a0 \u00a0 <\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">Chain <span class=\"code-snippet__title\" style=\"box-sizing: border-box;\">OUTPUT<\/span> <span class=\"code-snippet__params\" style=\"box-sizing: border-box;\">(policy ACCEPT)<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">target \u00a0 \u00a0 prot opt source \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 destination <\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">2. Iptables\u8fc7\u6ee4\u5c01\u5305\u6d41\u7a0b\uff0c\u8868-&gt;\u94fe-&gt;\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6570\u636e\u8d70\u5411\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5916\u90e8\u8bbf\u95ee\u672c\u673a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u672c\u673a\u8bbf\u95ee\u5916\u90e8<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u672c\u673a\u8d1f\u8d23\u8f6c\u53d1<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"text-align: center; margin-top: 10px; margin-bottom: 10px; box-sizing: border-box;\">\n<section style=\"max-width: 100%; vertical-align: middle; display: inline-block; line-height: 0; box-sizing: border-box;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-f0de975ba2268a9fd95a04d37ad497d0.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" class=\"rich_pages wxw-img\" style=\"vertical-align: middle; max-width: 100%; box-sizing: border-box;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-f0de975ba2268a9fd95a04d37ad497d0.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.5210084\" data-type=\"png\" data-w=\"714\" \/><\/div><\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">3. \u6574\u4f53\u6570\u636e\u5305\u5206\u4e24\u7c7b\uff1a\u53d1\u7ed9\u9632\u706b\u5899\u672c\u8eab\u7684\u6570\u636e\u5305\uff0c\u548c\u9700\u8981\u7ecf\u8fc7\u9632\u706b\u5899\u7684\u6570\u636e\u5305\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5f53\u4e00\u4e2a\u6570\u636e\u5305\u8fdb\u5165\u7f51\u5361\u65f6\uff0c\u5b83\u9996\u5148\u8fdb\u5165PREROUTING\u94fe\uff0c\u5185\u6838\u6839\u636e\u6570\u636e\u5305\u76ee\u7684IP\u5224\u65ad\u662f\u5426\u9700\u8981\u8f6c\u9001\u51fa\u53bb\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5982\u679c\u6570\u636e\u5305\u5c31\u662f\u8fdb\u5165\u672c\u673a\u7684\uff0c\u5b83\u5c31\u4f1a\u6cbf\u7740\u56fe\u5411\u4e0b\u79fb\u52a8\uff0c\u5230\u8fbeINPUT\u94fe\u3002\u6570\u636e\u5305\u5230\u4e86INPUT\u94fe\u540e\uff0c\u4efb\u4f55\u8fdb\u7a0b\u90fd\u4f1a\u6536\u5230\u5b83\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u672c\u673a\u4e0a\u8fd0\u884c\u7684\u7a0b\u5e8f\u53ef\u4ee5\u53d1\u9001\u6570\u636e\u5305\uff0c\u8fd9\u4e9b\u6570\u636e\u5305\u4f1a\u7ecf\u8fc7OUTPUT\u94fe\uff0c\u7136\u540e\u5230\u8fbePOSTROUTING\u94fe\u8f93\u51fa\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5982\u679c\u6570\u636e\u5305\u662f\u8981\u8f6c\u53d1\u51fa\u53bb\u7684\uff0c\u4e14\u5185\u6838\u5141\u8bb8\u8f6c\u53d1\uff0c\u6570\u636e\u5305\u5c31\u4f1a\u5982\u56fe\u6240\u793a\u5411\u53f3\u79fb\u52a8\uff0c\u7ecf\u8fc7FORWARD\u94fe\uff0c\u7136\u540e\u5230\u8fbePOSTROUTING\u94fe\u8f93\u51fa\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">4. \u8868\u3001\u94fe\u3001\u89c4\u5219\u5904\u7406\u7684\u987a\u5e8f<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u8868\u95f4\u7684\u4f18\u5148\u987a\u5e8f<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">raw &gt; mangle &gt; nat &gt; filter<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u94fe\u95f4\u7684\u5339\u914d\u987a\u5e8f<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5165\u7ad9\u6570\u636e\uff1aPREROUTING\u3001INPUT<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u51fa\u7ad9\u6570\u636e\uff1aOUTPUT\u3001POSTROUTING<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u8f6c\u53d1\u6570\u636e\uff1aPREROUTING\u3001FORWARD\u3001POSTROUTING<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u94fe\u5185\u7684\u5339\u914d\u987a\u5e8f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u81ea\u4e0a\u5411\u4e0b\u6309\u987a\u5e8f\u4f9d\u6b21\u8fdb\u884c\u68c0\u67e5\uff0c\u627e\u5230\u76f8\u5339\u914d\u7684\u89c4\u5219\u5373\u505c\u6b62<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u82e5\u5728\u8be5\u94fe\u5185\u627e\u4e0d\u5230\u7684\u76f8\u5339\u914d\u7684\u89c4\u5219\uff0c\u5219\u6309\u8be5\u94fe\u7684\u9ed8\u8ba4\u7b56\u7565\u5904\u7406\uff08\u672a\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\uff0c\u9ed8\u8ba4\u7b56\u7565\u4e3a\u5141\u8bb8\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a\u89c4\u5219\u7684\u6b21\u5e8f\u975e\u5e38\u5173\u952e\uff0c\u8c01\u7684\u89c4\u5219\u8d8a\u4e25\u683c\uff0c\u5e94\u8be5\u653e\u7684\u8d8a\u9760\u524d\uff0c\u800c\u68c0\u67e5\u89c4\u5219\u7684\u65f6\u5019\uff0c\u662f\u6309\u7167\u4ece\u4e0a\u5f80\u4e0b\u7684\u65b9\u5f0f\u8fdb\u884c\u68c0\u67e5\u7684\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"margin: 10px 0%; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 100%; vertical-align: top; border-width: 1px; border-style: solid none; border-color: #3e3e3e; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"align-items: center; display: flex; margin: -3px 0%; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 0 0 auto; border-width: 0px 0px 0px 2px; border-style: none none none solid; border-color: #3e3e3e; overflow: hidden; box-sizing: border-box;\">\n<section style=\"text-align: center; margin: 0px 0%; transform: translate3d(-10px, 0px, 0px); -webkit-transform: translate3d(-10px, 0px, 0px); -moz-transform: translate3d(-10px, 0px, 0px); -o-transform: translate3d(-10px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; min-width: 10%; max-width: 100%; vertical-align: top; transform: matrix(1, 0, -0.2, 1, 0, 0); -webkit-transform: matrix(1, 0, -0.2, 1, 0, 0); -moz-transform: matrix(1, 0, -0.2, 1, 0, 0); -o-transform: matrix(1, 0, -0.2, 1, 0, 0); padding: 6px 10px 6px 20px; background-color: #000000; box-sizing: border-box; border: 2px solid #3e3e3e;\">\n<section style=\"line-height: 1; letter-spacing: 0px; padding: 0px; color: #ffffff; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">No.2<\/strong><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 1 1 auto; border-width: 0px; box-sizing: border-box;\">\n<section style=\"line-height: 1; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u00a0iptables\u670d\u52a1\u5668\u5b89\u88c5\u53ca\u76f8\u5173\u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 0 0 auto; overflow: hidden; box-sizing: border-box; border: 0px none #3e3e3e;\">\n<section style=\"text-align: center; margin: -2px 0%; transform: translate3d(10px, 0px, 0px); -webkit-transform: translate3d(10px, 0px, 0px); -moz-transform: translate3d(10px, 0px, 0px); -o-transform: translate3d(10px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; min-width: 10%; max-width: 100%; vertical-align: top; transform: matrix(1, 0, -0.2, 1, 0, 0); -webkit-transform: matrix(1, 0, -0.2, 1, 0, 0); -moz-transform: matrix(1, 0, -0.2, 1, 0, 0); -o-transform: matrix(1, 0, -0.2, 1, 0, 0); padding: 6px 10px; background-color: #ffffff; box-sizing: border-box; border: 2px solid #3e3e3e;\">\n<section style=\"line-height: 1; letter-spacing: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">Iptables\u90e8\u7f72<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">Iptables\u662f\u903b\u8f91\u6027\u6bd4\u8f83\u5f3a\u7684\u670d\u52a1\uff0c\u6240\u4ee5\u6211\u4eec\u4e00\u4e2a\u4e00\u4e2a\u7684\u5b9e\u9a8c\u758f\u901a\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">2.1 \u00a0\u5b89\u88c5iptables<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5173\u95edfirewall<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 \u00a0~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># systemctl stop firewalld.service \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u505c\u6b62firewall<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\">\r\n<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 \u00a0~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># systemctl disable firewalld.service \u00a0 \u00a0 \u00a0 \u00a0#\u7981\u6b62firewall\u5f00\u673a\u542f\u52a8<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5b89\u88c5\u5b89\u88c5iptables\u9632\u706b\u5899\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 \u00a0~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># yum install iptables-services \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u5b89\u88c5<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">2.2 \u00a0iptables\u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\"><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># ls \/etc\/sysconfig\/iptables<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">\/etc\/sysconfig\/iptables<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">2.3 \u00a0\u542f\u52a8\u670d\u52a1<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># systemctl start iptables.service<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># systemctl enable iptables.service<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"margin: 10px 0%; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 100%; vertical-align: top; border-width: 1px; border-style: solid none; border-color: #3e3e3e; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"align-items: center; display: flex; margin: -3px 0%; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 0 0 auto; border-width: 0px 0px 0px 2px; border-style: none none none solid; border-color: #3e3e3e; overflow: hidden; box-sizing: border-box;\">\n<section style=\"text-align: center; margin: 0px 0%; transform: translate3d(-10px, 0px, 0px); -webkit-transform: translate3d(-10px, 0px, 0px); -moz-transform: translate3d(-10px, 0px, 0px); -o-transform: translate3d(-10px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; min-width: 10%; max-width: 100%; vertical-align: top; transform: matrix(1, 0, -0.2, 1, 0, 0); -webkit-transform: matrix(1, 0, -0.2, 1, 0, 0); -moz-transform: matrix(1, 0, -0.2, 1, 0, 0); -o-transform: matrix(1, 0, -0.2, 1, 0, 0); padding: 6px 10px 6px 20px; background-color: #000000; box-sizing: border-box; border: 2px solid #3e3e3e;\">\n<section style=\"line-height: 1; letter-spacing: 0px; padding: 0px; color: #ffffff; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">No.3<\/strong><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 1 1 auto; border-width: 0px; box-sizing: border-box;\">\n<section style=\"line-height: 1; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u00a0\u5b9e\u6218\uff1aiptables\u4f7f\u7528\u65b9\u6cd5<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: bottom; width: auto; flex: 0 0 auto; overflow: hidden; box-sizing: border-box; border: 0px none #3e3e3e;\">\n<section style=\"text-align: center; margin: -2px 0%; transform: translate3d(10px, 0px, 0px); -webkit-transform: translate3d(10px, 0px, 0px); -moz-transform: translate3d(10px, 0px, 0px); -o-transform: translate3d(10px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; min-width: 10%; max-width: 100%; vertical-align: top; transform: matrix(1, 0, -0.2, 1, 0, 0); -webkit-transform: matrix(1, 0, -0.2, 1, 0, 0); -moz-transform: matrix(1, 0, -0.2, 1, 0, 0); -o-transform: matrix(1, 0, -0.2, 1, 0, 0); padding: 6px 10px; background-color: #ffffff; box-sizing: border-box; border: 2px solid #3e3e3e;\">\n<section style=\"line-height: 1; letter-spacing: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables\u547d\u4ee4\u7684\u8bed\u6cd5\u683c\u5f0f<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">Iptables [-t \u8868\u540d] \u7ba1\u7406\u9009\u9879 [\u94fe\u540d] [\u6761\u4ef6\u5339\u914d] [-j \u76ee\u6807\u52a8\u4f5c\u6216\u8df3\u8f6c]<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\u4e8b\u9879<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4e0d\u6307\u5b9a\u8868\u540d\u65f6\uff0c\u9ed8\u8ba4\u8868\u793afilter\u8868<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4e0d\u6307\u5b9a\u94fe\u540d\u65f6\uff0c\u9ed8\u8ba4\u8868\u793a\u8be5\u8868\u5185\u6240\u6709\u94fe<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u9664\u975e\u8bbe\u7f6e\u89c4\u5219\u94fe\u7684\u7f3a\u7701\u7b56\u7565\uff0c\u5426\u5219\u9700\u8981\u6307\u5b9a\u5339\u914d\u6761\u4ef6<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables\u8bed\u6cd5\u603b\u7ed3\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"text-align: center; margin-top: 10px; margin-bottom: 10px; box-sizing: border-box;\">\n<section style=\"max-width: 100%; vertical-align: middle; display: inline-block; line-height: 0; box-sizing: border-box;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-4ac87dac29ff890a63b67ae717dfda91.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" class=\"rich_pages wxw-img\" style=\"vertical-align: middle; max-width: 100%; box-sizing: border-box;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-4ac87dac29ff890a63b67ae717dfda91.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.5219178\" data-type=\"png\" data-w=\"730\" \/><\/div><\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">3.1 \u00a0iptables\u547d\u4ee4\u4f7f\u7528\u65b9\u6cd5<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables [-t \u8981\u64cd\u4f5c\u7684\u8868]<\/span><\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;\u64cd\u4f5c\u547d\u4ee4&gt;<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[\u8981\u64cd\u4f5c\u7684\u94fe]<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[\u89c4\u5219\u53f7\u7801]<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[\u5339\u914d\u6761\u4ef6]<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[-j \u5339\u914d\u5230\u4ee5\u540e\u7684\u52a8\u4f5c]<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">\u64cd\u4f5c\u547d\u4ee4<\/span><\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-A \u00a0\u6dfb\u52a0\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-I\u00a0num \u63d2\u5165\uff0c\u628a\u5f53\u524d\u89c4\u5219\u63d2\u5165\u4e3a\u7b2c\u51e0\u6761<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-D\u00a0num \u5220\u9664\uff0c\u660e\u786e\u6307\u5b9a\u5220\u9664\u7b2c\u51e0\u6761\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-P \u00a0\u8bbe\u7f6e\u9ed8\u8ba4\u7b56\u7565\u7684<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-F \u00a0\u6e05\u7a7a\u89c4\u5219\u94fe\u7684<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">\u67e5\u770b\u547d\u4ee4<\/span><\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-[vn]L<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-L\u5217\u51fa\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-n\u4ee5\u6570\u5b57\u683c\u5f0f\u663e\u793aip\u548cport\uff0c\u9700\u8981\u914d\u5408-L\u9009\u9879\u4f7f\u7528<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-v \u00a0\u663e\u793a\u4fe1\u606f\uff0c\u4ee5\u8be6\u7ec6\u4fe1\u606f\u663e\u793a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-A &lt;\u94fe\u540d&gt; \u00a0\u00a0\u00a0APPEND\uff0c\u8ffd\u52a0\u4e00\u6761\u89c4\u5219\uff08\u653e\u5230\u6700\u540e\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t filter -A INPUT -j DROP \u00a0 \u00a0 #\u62d2\u7edd\u6240\u6709\u4eba\u8bbf\u95ee\u670d\u52a1\u5668<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5728 filter \u8868\u7684 INPUT \u94fe\u91cc\u8ffd\u52a0\u4e00\u6761\u89c4\u5219\uff08\u4f5c\u4e3a\u6700\u540e\u4e00\u6761\u89c4\u5219\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5339\u914d\u6240\u6709\u8bbf\u95ee\u672c\u673a IP \u7684\u6570\u636e\u5305\uff0c\u5339\u914d\u5230\u7684\u4e22\u5f03<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables \u00a0-L -n \u00a0\u00a0\u00a0\u67e5\u770b<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables \u00a0-Ln \u00a0\u4e0d\u751f\u6548\uff0c\u4f46\u662fiptables \u00a0-nL\u53ef\u4ee5<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-I &lt;\u94fe\u540d&gt; [\u89c4\u5219\u53f7\u7801] \u00a0\u00a0\u00a0\u00a0INSERT\uff0c\u63d2\u5165\u4e00\u6761\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -I INPUT -j DROP<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5728 filter \u8868\u7684 INPUT \u94fe\u91cc\u63d2\u5165\u4e00\u6761\u89c4\u5219\uff08\u63d2\u5165\u6210\u7b2c 1 \u6761\uff09\u7acb\u5373\u751f\u6548\uff0cxshell\u4f1a\u65ad\u5f00\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables -I INPUT 5\u00a0-j DROP<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5728 filter \u8868\u7684 INPUT \u94fe\u91cc\u63d2\u5165\u4e00\u6761\u89c4\u5219\uff08\u63d2\u5165\u6210\u7b2c 5\u00a0\u6761\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-t filter \u53ef\u4e0d\u5199\uff0c\u4e0d\u5199\u5219\u81ea\u52a8\u9ed8\u8ba4\u662f filter \u8868<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-I \u94fe\u540d [\u89c4\u5219\u53f7\u7801]\uff0c\u5982\u679c\u4e0d\u5199\u89c4\u5219\u53f7\u7801\uff0c\u5219\u9ed8\u8ba4\u662f 1<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u786e\u4fdd\u89c4\u5219\u53f7\u7801 \u2264 \uff08\u5df2\u6709\u89c4\u5219\u6570 + 1\uff09\uff0c\u5426\u5219\u62a5\u9519<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-R num\uff1aReplays\u66ff\u6362\/\u4fee\u6539\u7b2c\u51e0\u6761\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u683c\u5f0f\uff1aiptables \u2013t filter -R INPUT 3 \u2026\u2026\u2026 \u4fee\u6539filter\u7684INPUT\u94fe\u7b2c\u4e09\u6761\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables -R INPUT 5 -j ACCEPT<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-D &lt;\u94fe\u540d&gt; &lt;\u89c4\u5219\u53f7\u7801 | \u5177\u4f53\u89c4\u5219\u5185\u5bb9&gt; \u00a0\u00a0\u00a0DELETE\uff0c\u5220\u9664\u4e00\u6761\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">iptables -D INPUT 1\uff08\u6309\u53f7\u7801\u5339\u914d\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5220\u9664 filter \u8868 INPUT \u94fe\u4e2d\u7684\u7b2c1\u6761\u89c4\u5219<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -L<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\"><span class=\"code-snippet__function\" style=\"box-sizing: border-box;\">Chain <span class=\"code-snippet__title\" style=\"box-sizing: border-box;\">INPUT<\/span> <span class=\"code-snippet__params\" style=\"box-sizing: border-box;\">(policy ACCEPT)<\/span><\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">target \u00a0 \u00a0 prot opt source \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 destination \u00a0 \u00a0 \u00a0 \u00a0 <\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -D INPUT -j DROP \u00a0 \u00a0#\u6309\u5185\u5bb9\u5339\u914d\u3002<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -D INPUT -s 192.168.0.1 -j DROP<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5220\u9664 filter \u8868 INPUT \u94fe\u4e2d\u5185\u5bb9\u4e3a\u201c-s 192.168.0.1 -j DROP\u201d\u7684\u89c4\u5219(\u4e0d\u7ba1\u5176\u4f4d\u7f6e\u5728\u54ea\u91cc\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u82e5\u89c4\u5219\u5217\u8868\u4e2d\u6709\u591a\u6761\u76f8\u540c\u7684\u89c4\u5219\u65f6\uff0c\u6309\u5185\u5bb9\u5339\u914d\u53ea\u5220\u9664\u5e8f\u53f7\u6700\u5c0f\u7684\u4e00\u6761<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u53f7\u7801\u5339\u914d\u5220\u9664\u65f6\uff0c\u786e\u4fdd\u89c4\u5219\u53f7\u7801 \u2264 \u5df2\u6709\u89c4\u5219\u6570\uff0c\u5426\u5219\u62a5\u9519<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u5185\u5bb9\u5339\u914d\u5220\u9664\u65f6\uff0c\u786e\u4fdd\u89c4\u5219\u5b58\u5728\uff0c\u5426\u5219\u62a5\u9519<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-P &lt;\u94fe\u540d&gt; &lt;\u52a8\u4f5c&gt; \u00a0\u00a0\u00a0POLICY\uff0c\u8bbe\u7f6e\u67d0\u4e2a\u94fe\u7684\u9ed8\u8ba4\u89c4\u5219<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -L \u00a0 #\u67e5\u770b\u9ed8\u8ba4\u89c4\u5219\u662fACCEPT<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\"><span class=\"code-snippet__function\" style=\"box-sizing: border-box;\">Chain <span class=\"code-snippet__title\" style=\"box-sizing: border-box;\">INPUT<\/span> <span class=\"code-snippet__params\" style=\"box-sizing: border-box;\">(policy ACCEPT)<\/span><\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">target \u00a0 \u00a0 prot opt source \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 des ation \u00a0tin<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -P INPUT DROP<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">\u8bbe\u7f6e filter \u8868 INPUT \u94fe\u7684\u9ed8\u8ba4\u89c4\u5219\u662f DROP<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -L \u00a0 #\u67e5\u770b\u5df2\u7ecf\u53d8\u4e3aDROP<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">Chain <span class=\"code-snippet__title\" style=\"box-sizing: border-box;\">INPUT<\/span> <span class=\"code-snippet__params\" style=\"box-sizing: border-box;\">(policy DROP)<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">target \u00a0 \u00a0 prot opt source \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 destination \u00a0 <\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u00a0\u6ce8\u610f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5f53\u6570\u636e\u5305\u6ca1\u6709\u88ab\u89c4\u5219\u5217\u8868\u91cc\u7684\u4efb\u4f55\u89c4\u5219\u5339\u914d\u5230\u65f6\uff0c\u6309\u6b64\u9ed8\u8ba4\u89c4\u5219\u5904\u7406\u3002\u52a8\u4f5c\u524d\u9762\u4e0d\u80fd\u52a0 \u2013j\uff0c\u8fd9\u4e5f\u662f\u552f\u4e00 \u4e00\u79cd\u5339\u914d\u52a8\u4f5c\u524d\u9762\u4e0d\u52a0 \u2013j \u7684\u60c5\u51b5\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u00a0-F [\u94fe\u540d] \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0FLUSH\uff0c\u6e05\u7a7a\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6dfb\u52a0\u89c4\u5219\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -<span class=\"code-snippet__function\" style=\"box-sizing: border-box;\">P INPUT \u00a0<span class=\"code-snippet__title\" style=\"box-sizing: border-box;\">ACCEPT<\/span><span class=\"code-snippet__params\" style=\"box-sizing: border-box;\">(\u9632\u6b62xshell\u65ad\u5f00)<\/span><\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t filter -A INPUT -j DROP<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -F INPUT \u00a0 \u00a0#\u6e05\u9664INPUT\u94fe\u4e0a\u7684\u89c4\u5219<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -F \u00a0 \u00a0#\u6e05\u9664filter\u8868\u4e2d\u6240\u6709\u94fe\u4e0a\u7684\u89c4\u5219<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">\u7acb\u5373\u751f\u6548\uff0cxshell\u4f1a\u65ad\u5f00<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t nat -F \u00a0 #\u6e05\u7a7aNAT\u8868\u4e2d\u6240\u6709\u94fe\u4e0a\u7684\u89c4\u5219<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t nat -F PREROUTING \u00a0 #\u6e05\u7a7aNAT\u8868\u4e2dPREROUTING\u94fe\u4e0a\u7684\u89c4\u5219<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-F \u4ec5\u4ec5\u662f\u6e05\u7a7a\u94fe\u4e2d\u89c4\u5219\uff0c\u5e76\u4e0d\u5f71\u54cd -P \u8bbe\u7f6e\u7684\u9ed8\u8ba4\u89c4\u5219\u3002<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -P INPUT ACCEPT<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\"> \u00a0 \u00a0-P \u8bbe\u7f6e\u4e86 DROP \u540e\uff0c\u4f7f\u7528 -F \u4e00\u5b9a\u8981\u5c0f\u5fc3\uff01\uff01<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">#\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u4f7f\u7528-P DROP \u8fd9\u6761\u89c4\u5219\uff0c\u4e00\u5b9a\u8981\u5c0f\u5fc3\uff0c\u8bbe\u7f6e\u4e4b\u524d\u6700\u597d\u914d\u7f6e\u4e0b\u9762\u4e24\u4e2a\u4efb\u52a1\u8ba1\u5212\uff0c\u5426\u5219\u5bb9\u6613\u628a\u81ea\u5df1drop\u6389\uff0c\u94fe\u63a5\u4e0d\u4e0a\u8fdc\u7a0b\u4e3b\u673a\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u914d\u7f6ecrontab :<\/strong><\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">*\/<span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">15<\/span> * * * * \u00a0iptables -P INPUT ACCEPT<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-Z \u00a0\u00a0\u5c06\u5c01\u5305\u8ba1\u6570\u5668\u5f52\u96f6\uff0c\u5c01\u5305\u8ba1\u6570\u5668\u662f\u7528\u6765\u8ba1\u7b97\u540c\u4e00\u5c01\u5305\u51fa\u73b0\u6b21\u6570<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -Z INPUT<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-L [\u94fe\u540d] \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0LIST\uff0c\u5217\u51fa\u89c4\u5219<\/p>\n<p style=\"text-indent: 0em; white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">v\uff1a\u663e\u793a\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u6bcf\u6761\u89c4\u5219\u7684\u5339\u914d\u5305\u6570\u91cf\u548c\u5339\u914d\u5b57\u8282\u6570<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">x\uff1a\u5728 v \u7684\u57fa\u7840\u4e0a\uff0c\u7981\u6b62\u81ea\u52a8\u5355\u4f4d\u6362\u7b97\uff08K\u3001M\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">n\uff1a\u53ea\u663e\u793a IP \u5730\u5740\u548c\u7aef\u53e3\u53f7\u7801\uff0c\u4e0d\u663e\u793a\u57df\u540d\u548c\u670d\u52a1\u540d\u79f0<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;line-number\uff1a\u53ef\u4ee5\u67e5\u770b\u5230\u89c4\u5219\u53f7<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -L<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u7c97\u7565\u5217\u51fa filter \u8868\u6240\u6709\u94fe\u53ca\u6240\u6709\u89c4\u5219<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -t nat -vnL<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u7528\u8be6\u7ec6\u65b9\u5f0f\u5217\u51fa nat \u8868\u6240\u6709\u94fe\u7684\u6240\u6709\u89c4\u5219\uff0c\u53ea\u663e\u793a IP \u5730\u5740\u548c\u7aef\u53e3\u53f7<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -t nat -vxnL PREROUTING<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u7528\u8be6\u7ec6\u65b9\u5f0f\u5217\u51fa nat \u8868 PREROUTING \u94fe\u7684\u6240\u6709\u89c4\u5219\u4ee5\u53ca\u8be6\u7ec6\u6570\u5b57\uff0c\u4e0d\u53cd\u89e3<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -t nat -xvnL &#8211;line-number<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">3.2 \u00a0iptables\u5339\u914d\u6761\u4ef6<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"color: #000000; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6d41\u5165\u3001\u6d41\u51fa\u63a5\u53e3\uff08-i\u3001-o\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6765\u6e90\u3001\u76ee\u7684\u5730\u5740\uff08-s\u3001-d\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u534f\u8bae\u7c7b\u578b \u00a0\u00a0\u00a0\u00a0\u00a0\uff08-p\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6765\u6e90\u3001\u76ee\u7684\u7aef\u53e3\uff08&#8211;sport\u3001&#8211;dport\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">1. \u6309\u7f51\u7edc\u63a5\u53e3\u5339\u914d<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-i &lt;\u5339\u914d\u6570\u636e\u8fdb\u5165\u7684\u7f51\u7edc\u63a5\u53e3&gt;<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">#\u6b64\u53c2\u6570\u4e3b\u8981\u5e94\u7528\u4e8enat\u8868\uff0c\u4f8b\u5982\u76ee\u6807\u5730\u5740\u8f6c\u6362<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-i ens33\u00a0\u00a0<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5339\u914d\u662f\u5426\u4ece\u7f51\u7edc\u63a5\u53e3 ens33\u00a0\u8fdb\u6765<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-i ppp0<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5339\u914d\u662f\u5426\u4ece\u7f51\u7edc\u63a5\u53e3 ppp0 \u8fdb\u6765<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-o \u00a0\u5339\u914d\u6570\u636e\u6d41\u51fa\u7684\u7f51\u7edc\u63a5\u53e3<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-o ens33<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-o ppp0<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">2. \u6309\u6765\u6e90\u76ee\u7684\u5730\u5740\u5339\u914d<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"font-size: 14px; box-sizing: border-box;\">-s &lt;\u5339\u914d\u6765\u6e90\u5730\u5740&gt;<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u53ef\u4ee5\u662f IP\u3001\u00a0\u7f51\u6bb5\u3001\u57df\u540d\uff0c\u4e5f\u53ef\u7a7a\uff08\u4efb\u4f55\u5730\u5740\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-s 192.168.0.1 \u00a0\u00a0\u00a0\u00a0\u5339\u914d\u6765\u81ea 192.168.0.1 \u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-s 192.168.1.0\/24 \u00a0\u5339\u914d\u6765\u81ea 192.168.1.0\/24 \u7f51\u7edc\u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-s 192.168.0.0\/16 \u00a0\u5339\u914d\u6765\u81ea 192.168.0.0\/16 \u7f51\u7edc\u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\uff1aiptables -A INPUT -s 192.168.0.1 -j DROP<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u67e5\u770b\uff1aiptables -vnL<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-d &lt;\u5339\u914d\u76ee\u7684\u5730\u5740&gt;<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u53ef\u4ee5\u662f IP\u3001\u00a0\u7f51\u6bb5\u3001\u57df\u540d\uff0c\u4e5f\u53ef\u4ee5\u7a7a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-d 202.106.0.20<\/span>\uff0c\u5339\u914d\u53bb202.106.0.20 \u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-d 202.106.0.0\/16<\/span>\uff0c\u5339\u914d\u53bb202.106.0.0\/16 \u7f51\u7edc\u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-d www.abc.com<\/span>\uff0c\u5339\u914d\u53bb\u57df\u540d www.abc.com \u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\uff1a<span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -A INPUT -d 202.106.0.20 -j DROP<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: #000000; box-sizing: border-box;\">\u67e5\u770b\uff1a<\/span><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -vnL<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">3. \u6309\u534f\u8bae\u7c7b\u578b\u5339\u914d<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-p &lt;\u5339\u914d\u534f\u8bae\u7c7b\u578b&gt;<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u53ef\u4ee5\u662f TCP\u3001UDP\u3001ICMP \u7b49\uff0c\u4e5f\u53ef\u4e3a\u7a7a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-p tcp<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-p udp<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-p icmp &#8211;icmp-type \u00a0\u7c7b\u578b<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">ping: type 8 \u00a0\u00a0\u00a0\u00a0\u00a0pong: type 0<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">4. \u6309\u6765\u6e90\u76ee\u7684\u7aef\u53e3\u5339\u914d<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;sport &lt;\u5339\u914d\u6e90\u7aef\u53e3&gt;<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u53ef\u4ee5\u662f\u4e2a\u522b\u7aef\u53e3\uff0c\u53ef\u4ee5\u662f\u7aef\u53e3\u8303\u56f4<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;sport 1000\uff1a\u5339\u914d\u6e90\u7aef\u53e3\u662f 1000 \u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;sport 1000:3000\uff1a\u5339\u914d\u6e90\u7aef\u53e3\u662f 1000-3000 \u7684\u6570\u636e\u5305\uff08\u542b1000\u30013000\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;sport :3000\uff1a\u5339\u914d\u6e90\u7aef\u53e3\u662f 3000 \u4ee5\u4e0b\u7684\u6570\u636e\u5305\uff08\u542b 3000\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;sport 1000:\u5339\u914d\u6e90\u7aef\u53e3\u662f 1000 \u4ee5\u4e0a\u7684\u6570\u636e\u5305\uff08\u542b 1000\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;dport &lt;\u5339\u914d\u76ee\u7684\u7aef\u53e3&gt;\u53ef\u4ee5\u662f\u4e2a\u522b\u7aef\u53e3\uff0c\u53ef\u4ee5\u662f\u7aef\u53e3\u8303\u56f4<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;dport 80\uff1a\u5339\u914d\u76ee\u7684\u7aef\u53e3\u662f 80 \u7684\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;dport 6000:8000\uff1a\u5339\u914d\u76ee\u7684\u7aef\u53e3\u662f 6000-8000 \u7684\u6570\u636e\u5305\uff08\u542b6000\u30018000\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;dport :3000\uff1a\u5339\u914d\u76ee\u7684\u7aef\u53e3\u662f 3000 \u4ee5\u4e0b\u7684\u6570\u636e\u5305\uff08\u542b 3000\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;dport 1000:\u5339\u914d\u76ee\u7684\u7aef\u53e3\u662f 1000 \u4ee5\u4e0a\u7684\u6570\u636e\u5305\uff08\u542b 1000\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a&#8211;sport \u548c &#8211;dport \u5fc5\u987b\u914d\u5408 -p \u53c2\u6570\u4f7f\u7528<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">5. \u5339\u914d\u5e94\u7528\u4e3e\u4f8b<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u7aef\u53e3\u5339\u914d<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-p udp &#8211;dport 53<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5339\u914d\u7f51\u7edc\u4e2d\u76ee\u7684\u7aef\u53e3\u662f 53 \u7684 UDP \u534f\u8bae\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5730\u5740\u5339\u914d\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-s 10.1.0.0\/24 -d 172.17.0.0\/16<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5339\u914d\u6765\u81ea 10.1.0.0\/24 \u53bb\u5f80 172.17.0.0\/16 \u7684\u6240\u6709\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u7aef\u53e3\u548c\u5730\u5740\u8054\u5408\u5339\u914d<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-s 192.168.0.1 -d www.abc.com -p tcp &#8211;dport 80<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5339\u914d\u6765\u81ea 192.168.0.1\uff0c\u53bb\u5f80 www.abc.com \u7684 80 \u7aef\u53e3\u7684 TCP \u534f\u8bae\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"text-align: center; margin-top: 10px; margin-bottom: 10px; box-sizing: border-box;\">\n<section style=\"max-width: 100%; vertical-align: middle; display: inline-block; line-height: 0; box-sizing: border-box;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-e79879be3f03c3e3d87389a38a0f3b06.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" class=\"rich_pages wxw-img\" style=\"vertical-align: middle; max-width: 100%; box-sizing: border-box;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-e79879be3f03c3e3d87389a38a0f3b06.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.112037\" data-type=\"png\" data-w=\"1080\" \/><\/div><\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">&#8211;sport\u3001&#8211;dport \u5fc5\u987b\u8054\u5408 -p \u4f7f\u7528\uff0c\u5fc5\u987b\u6307\u660e\u534f\u8bae\u7c7b\u578b\u662f\u4ec0\u4e48<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6761\u4ef6\u5199\u7684\u8d8a\u591a\uff0c\u5339\u914d\u8d8a\u7ec6\u81f4\uff0c\u5339\u914d\u8303\u56f4\u8d8a\u5c0f<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">3.3 \u00a0iptables\u52a8\u4f5c\uff08\u5904\u7406\u65b9\u5f0f\uff09<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">ACCEPT<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">DROP<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">REJECT<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">SNAT<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">DNAT<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">MASQUERADE<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-j ACCEPT<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u901a\u8fc7\uff0c\u5141\u8bb8\u6570\u636e\u5305\u901a\u8fc7\u672c\u94fe\u800c\u4e0d\u62e6\u622a\u5b83<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -A INPUT -j ACCEPT<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5141\u8bb8\u6240\u6709\u8bbf\u95ee\u672c\u673a IP \u7684\u6570\u636e\u5305\u901a\u8fc7<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-j DROP<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4e22\u5f03\uff0c\u963b\u6b62\u6570\u636e\u5305\u901a\u8fc7\u672c\u94fe\u800c\u4e22\u5f03\u5b83<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">iptables -A FORWARD -s 192.168.80.39 -j DROP<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u963b\u6b62\u6765\u6e90\u5730\u5740\u4e3a 192.168.80.39 \u7684\u6570\u636e\u5305\u901a\u8fc7\u672c\u673a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-j SNAT &#8211;to IP[-IP][:\u7aef\u53e3-\u7aef\u53e3]\uff08nat \u8868\u7684 POSTROUTING \u94fe\uff09<\/span><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6e90\u5730\u5740\u8f6c\u6362\uff0cSNAT \u652f\u6301\u8f6c\u6362\u4e3a\u5355 IP\uff0c\u4e5f\u652f\u6301\u8f6c\u6362\u5230 IP \u5730\u5740\u6c60\uff08\u4e00\u7ec4\u8fde\u7eed\u7684 IP \u5730\u5740\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t nat -A POSTROUTING -s 192.168.0.0\/24 -j SNAT --to 1.1.1.1<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\"> #\u5c06\u5185\u7f51 <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">192.168<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.0<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.0<\/span>\/<span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">24<\/span> \u7684\u539f\u5730\u5740\u4fee\u6539\u4e3a <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">1.1<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.1<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.1<\/span>\uff0c\u7528\u4e8e NAT<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -t nat -A POSTROUTING -s <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">192.168<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.0<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.0<\/span>\/<span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">24<\/span> \u00a0-j SNAT --to <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">1.1<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.1<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.1<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">-1.1<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.1<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.10<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">\u540c\u4e0a\uff0c\u53ea\u4e0d\u8fc7\u4fee\u6539\u6210\u4e00\u4e2a\u5730\u5740\u6c60\u91cc\u7684 IP<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">-j DNAT --to IP[-IP][:\u7aef\u53e3-\u7aef\u53e3]\uff08nat \u8868\u7684 PREROUTING \u94fe\uff09<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">\u76ee\u7684\u5730\u5740\u8f6c\u6362\uff0cDNAT \u652f\u6301\u8f6c\u6362\u4e3a\u5355 IP\uff0c\u4e5f\u652f\u6301\u8f6c\u6362\u5230 IP \u5730\u5740\u6c60\uff08\u4e00\u7ec4\u8fde\u7eed\u7684 IP \u5730\u5740\uff09<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u8868\u8fbe\u65b9\u5f0f1\uff1a<\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u628a\u4ece ens33 \u8fdb\u6765\u7684\u8981\u8bbf\u95ee TCP\/80 \u7684\u6570\u636e\u5305\u76ee\u7684\u5730\u5740\u6539\u4e3a 192.168.0.1.<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t nat -A PREROUTING -i ens33 -p tcp --dport 80 -j DNAT --to 192.168.0.1<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u8868\u8fbe\u65b9\u5f0f2\uff1a<\/strong><\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t nat -A PREROUTING -i ens33 -p tcp --dport 81 -j DNAT --to 192.168.0.1:81<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u8868\u8fbe\u65b9\u5f0f3\uff1a<\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u628a\u4ece ens33 \u8fdb\u6765\u7684\u8981\u8bbf\u95ee TCP\/80 \u7684\u6570\u636e\u5305\u76ee\u7684\u5730\u5740\u6539\u4e3a192.168.0.1-192.169.0.10<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t nat -A PREROUTING -i ens33 -p tcp --dport 80 -j DNAT --to 192.168.0.1-192.169.0.10 <\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-j MASQUERADE \u00a0\u00a0\u00a0\u4f2a\u88c5<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u52a8\u6001\u6e90\u5730\u5740\u8f6c\u6362\uff08\u52a8\u6001 IP \u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># iptables -t nat -A POSTROUTING -s 192.168.0.0\/24 -o ens33 -j MASQUERADE<\/span><\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5c06\u6e90\u5730\u5740\u662f 192.168.0.0\/24 \u7684\u6570\u636e\u5305\u8fdb\u884c\u5730\u5740\u4f2a\u88c5\uff0c\u8f6c\u6362\u6210ens33\u4e0a\u7684IP\u5730\u5740\u3002ens33\u4e3a\u8def\u7531\u5668\u5916\u7f51\u51fa\u53e3IP\u5730\u5740<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"height: auto; box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 10px 0% 15px; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 84.3137 84.3137 0%; height: auto; border-radius: 12px; overflow: hidden; padding: 5px 10px; background-color: #000000; align-self: center; margin: 0px; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"color: #ffffff; letter-spacing: 0px; box-sizing: border-box;\">\n<p style=\"margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">3.4 \u00a0\u6269\u5c55\uff1a\u9644\u52a0\u6a21\u5757<\/strong><\/p>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 10 10 0%; height: auto; box-sizing: border-box;\">\n<section style=\"box-sizing: border-box;\">\n<section style=\"display: flex; flex-flow: row nowrap; margin: 0px 0%; text-align: center; justify-content: center; box-sizing: border-box;\">\n<section style=\"display: inline-block; vertical-align: middle; width: auto; flex: 100 100 0%; height: auto; align-self: center; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"margin: 0.5em 0px; box-sizing: border-box;\">\n<section style=\"background-color: #3e3e3e; height: 1px; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"display: inline-block; vertical-align: middle; width: auto; align-self: center; flex: 0 0 0%; height: auto; line-height: 0.1; box-sizing: border-box;\">\n<section style=\"text-align: right; justify-content: flex-end; box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 22px; height: 22px; vertical-align: top; overflow: hidden; border-radius: 50%; background-color: rgba(255, 255, 255, 0); line-height: 0; box-sizing: border-box; border: 1px solid #3e3e3e;\">\n<section style=\"transform: rotateZ(315deg); -webkit-transform: rotateZ(315deg); -moz-transform: rotateZ(315deg); -o-transform: rotateZ(315deg); box-sizing: border-box;\">\n<section style=\"text-align: center; justify-content: center; margin: 9px 0% 0px; transform: translate3d(3px, 0px, 0px); -webkit-transform: translate3d(3px, 0px, 0px); -moz-transform: translate3d(3px, 0px, 0px); -o-transform: translate3d(3px, 0px, 0px); box-sizing: border-box;\">\n<section style=\"display: inline-block; width: 8px; height: 8px; vertical-align: top; overflow: hidden; border-style: solid none none solid; border-width: 1px; border-color: #3e3e3e #ffffff #ffffff #3e3e3e; box-sizing: border-box;\">\n<section><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u5305\u72b6\u6001\u5339\u914d\uff1a\uff08state\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u6765\u6e90 MAC \u5339\u914d\uff1a\uff08mac\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u5305\u901f\u7387\u5339\u914d\uff1a\uff08limit\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u591a\u7aef\u53e3\u5339\u914d\uff1a\uff08multiport\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u5305\u72b6\u6001\u5339\u914d\uff1a\uff08state\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">-m state &#8211;state \u72b6\u6001<\/span><\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u72b6\u6001\uff1aNEW\u3001RELATED\u3001ESTABLISHED\u3001INVALID<\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">\u00a0<\/strong><\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">NEW\uff1a<\/span><\/strong>\u6709\u522b\u4e8e tcp \u7684 syn \u00a0\u00a0#\u5982\u679c\u6211\u4eec\u53d1\u9001\u4e00\u4e2a\u6d41\u7684\u521d\u59cb\u5316\u5305\uff0c\u72b6\u6001\u5c31\u4f1a\u5728OUTPUT\u94fe \u91cc\u88ab\u8bbe\u7f6e\u4e3aNEW\uff0c\u5f53\u6211\u4eec\u6536\u5230\u56de\u5e94\u7684\u5305\u65f6\uff0c\u72b6\u6001\u5c31\u4f1a\u5728PREROUTING\u94fe\u91cc\u88ab\u8bbe\u7f6e\u4e3aESTABLISHED\u3002\u5982\u679c\u7b2c\u4e00\u4e2a\u5305\u4e0d\u662f\u672c\u5730\u4ea7\u751f\u7684\uff0c\u90a3\u5c31\u4f1a\u5728PREROUTING\u94fe\u91cc\u88ab\u8bbe\u7f6e\u4e3aNEW\u72b6 \u6001\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">ESTABLISHED\uff1a<\/strong><\/span>\u8fde\u63a5\u6001<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\">RELATED\uff1a<\/strong><\/span>\u884d\u751f\u6001\uff0c\u4e0e conntrack \u5173\u8054\uff08FTP\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\"><strong style=\"box-sizing: border-box;\"><span style=\"color: rgba(242, 8, 23, 0.92); box-sizing: border-box;\">INVALID\uff1a<\/span><\/strong>\u4e0d\u80fd\u88ab\u8bc6\u522b\u5c5e\u4e8e\u54ea\u4e2a\u8fde\u63a5\u6216\u6ca1\u6709\u4efb\u4f55\u72b6\u6001<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -A INPUT -m state --state RELATED,ESTABLISHED \u00a0-j ACCEPT<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u56db\u4e2a\u72b6\u6001\u8be6\u89e3\uff1a<\/p>\n<\/section>\n<section style=\"text-align: center; margin-top: 10px; margin-bottom: 10px; box-sizing: border-box;\">\n<section style=\"max-width: 100%; vertical-align: middle; display: inline-block; line-height: 0; box-sizing: border-box;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-31f66daa9010269078bfefdb9b8bbbfe.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" class=\"rich_pages wxw-img\" style=\"vertical-align: middle; max-width: 100%; box-sizing: border-box;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2022\/03\/wxsync-2022-03-31f66daa9010269078bfefdb9b8bbbfe.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.820197\" data-type=\"png\" data-w=\"812\" \/><\/div><\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u8fd9\u4e9b\u72b6\u6001\u53ef\u4ee5\u4e00\u8d77\u4f7f\u7528\uff0c\u4ee5\u4fbf\u5339\u914d\u6570\u636e\u5305\u3002\u8fd9\u53ef\u4ee5\u4f7f\u6211\u4eec\u7684\u9632\u706b\u5899\u975e\u5e38\u5f3a\u58ee\u548c\u6709\u6548\u3002\u4ee5\u524d\uff0c\u6211\u4eec\u7ecf\u5e38\u6253 \u5f001024\u4ee5\u4e0a\u7684\u6240\u6709\u7aef\u53e3\u6765\u653e\u884c\u5e94\u7b54\u7684\u6570\u636e\u3002\u73b0\u5728\uff0c\u6709\u4e86\u72b6\u6001\u673a\u5236\uff0c\u5c31\u4e0d\u9700\u518d\u8fd9\u6837\u4e86\u3002\u56e0\u4e3a\u6211\u4eec\u53ef\u4ee5\u53ea\u5f00\u653e\u90a3\u4e9b\u6709\u5e94\u7b54\u6570\u636e\u7684\u7aef\u53e3\uff0c\u5176\u4ed6\u7684\u90fd\u53ef\u4ee5\u5173\u95ed\u3002\u8fd9\u6837\u5c31\u5b89\u5168\u591a\u4e86\u3002<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u6765\u6e90 MAC \u5339\u914d\uff08mac\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-m mac &#8211;mac-source MAC<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5339\u914d\u67d0\u4e2a MAC \u5730\u5740<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -A FORWARD -m mac --mac-source xx:xx:xx:xx:xx:xx -j DROP<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u963b\u65ad\u6765\u81ea\u67d0 MAC \u5730\u5740\u7684\u6570\u636e\u5305\u901a\u8fc7\u672c\u673a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u62a5\u6587\u7ecf\u8fc7\u8def\u7531\u540e\uff0c\u6570\u636e\u5305\u4e2d\u539f\u6709\u7684 mac \u4fe1\u606f\u4f1a\u88ab\u66ff\u6362\uff0c\u6240\u4ee5\u5728\u8def\u7531\u540e\u7684 iptables \u4e2d\u4f7f\u7528 mac \u6a21\u5757\u662f\u6ca1\u6709\u610f\u4e49\u7684<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6309\u5305\u901f\u7387\u5339\u914d\uff08limit\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-m limit &#8211;limit \u5339\u914d\u901f\u7387 [&#8211;burst \u7f13\u51b2\u6570\u91cf]<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u7528\u4e00\u5b9a\u901f\u7387\u53bb\u5339\u914d\u6570\u636e\u5305<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -A FORWARD -d <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">192.168<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.0<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.1<\/span> -m limit --limit <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">50<\/span>\/s \u00a0-j ACCEPT<\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -A FORWARD -d <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">192.168<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.0<\/span><span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">.1<\/span> -j DROP<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">limit \u82f1\u8bed\u4e0a\u770b\u662f\u9650\u5236\u7684\u610f\u601d\uff0c\u4f46\u5b9e\u9645\u4e0a\u53ea\u662f\u6309\u4e00\u5b9a\u901f\u7387\u53bb\u5339\u914d\u800c\u5df2\uff0c50\/s\u8868\u793a1\u79d2\u4e2d\u8f6c\u53d150\u4e2a\u6570\u636e\u5305\uff0c\u8981\u60f3\u9650\u5236\u7684\u8bdd\u540e\u9762\u8981\u518d\u8ddf\u4e00\u6761 DROP<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u591a\u7aef\u53e3\u5339\u914d\uff08multiport\uff09<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">-m multiport &lt;&#8211;sports|&#8211;dports|&#8211;ports&gt; \u7aef\u53e31[,\u7aef\u53e32,..,\u7aef\u53e3n]<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4e00\u6b21\u6027\u5339\u914d\u591a\u4e2a\u7aef\u53e3\uff0c\u53ef\u4ee5\u533a\u5206\u6e90\u7aef\u53e3\uff0c\u76ee\u7684\u7aef\u53e3\u6216\u4e0d\u6307\u5b9a\u7aef\u53e3<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4f8b\u5982\uff1a<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables -A INPUT -p tcp -m multiport --dports <span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">21<\/span>,<span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">22<\/span>,<span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">25<\/span>,<span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">80<\/span>,<span class=\"code-snippet__number\" style=\"box-sizing: border-box;\">110<\/span> -j ACCEPT<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u6ce8\u610f\uff1a\u5fc5\u987b\u4e0e -p \u53c2\u6570\u4e00\u8d77\u4f7f\u7528<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4fdd\u5b58\u5230\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u5148\u770b\u4e00\u4e0b\/etc\/sysconfig\/iptables\u5185\u5bb9<\/p>\n<\/section>\n<section style=\"font-size: 17px; box-sizing: border-box;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<pre class=\"code-snippet__js\" data-lang=\"c\"><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">[root@xuegod63 ~]<span class=\"code-snippet__meta\" style=\"box-sizing: border-box;\"># service iptables save<\/span><\/span><\/code><code style=\"box-sizing: border-box;\"><span class=\"code-snippet_outer\" style=\"box-sizing: border-box;\">iptables: Saving firewall rules to \/etc\/sysconfig\/iptables:[ \u00a0\u786e\u5b9a \u00a0]<\/span><\/code><\/pre>\n<\/section>\n<\/section>\n<section style=\"box-sizing: border-box;\">\n<p style=\"white-space: normal; margin: 0px; padding: 0px; box-sizing: border-box;\">\u4fdd\u5b58\u540e\u5bf9\u6bd4\/etc\/sysconfig\/iptables\u4e4b\u524d\u5185\u5bb9<\/p>\n<\/section>\n<\/section>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55 \u4e00\uff1aiptables\u5e38\u89c1\u6982\u5ff5 \u4e8c\uff1a iptables\u670d\u52a1\u5668\u5b89\u88c5\u53ca\u76f8\u5173\u914d\u7f6e\u6587\u4ef6 \u4e09\uff1a \u5b9e\u6218\uff1aiptable [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-6504","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/6504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6504"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/6504\/revisions"}],"predecessor-version":[{"id":6568,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/6504\/revisions\/6568"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}