{"id":368,"date":"2020-08-28T02:05:36","date_gmt":"2020-08-27T18:05:36","guid":{"rendered":"http:\/\/log.tanxiaodian.com\/?p=368"},"modified":"2020-11-04T20:19:22","modified_gmt":"2020-11-04T12:19:22","slug":"iptables-%e8%bd%ac%e5%8f%91%e8%ae%be%e7%bd%ae%e5%92%8c%e6%9f%a5%e7%9c%8b","status":"publish","type":"post","link":"https:\/\/log.tanxiaodian.com\/?p=368","title":{"rendered":"iptables \u8f6c\u53d1\u8bbe\u7f6e\u548c\u67e5\u770b"},"content":{"rendered":"<p>iptables -t nat -nL\u00a0 <strong>\u67e5\u770b<\/strong><\/p>\n<p><strong>\u8bbe\u7f6e<\/strong><\/p>\n<table width=\"324\">\n<tbody>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">systemctl\u00a0stop\u00a0firewalld.service<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">systemctl\u00a0disable\u00a0firewalld.service<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">yum\u00a0-y\u00a0install\u00a0iptables-services<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">systemctl\u00a0enable\u00a0iptables.service<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">vi\u00a0\/etc\/sysctl.conf<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">net.ipv4.ip_forward\u00a0=\u00a01<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">sysctl\u00a0-p<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">echo\u00a01\u00a0&gt;\u00a0\/proc\/sys\/net\/ipv4\/ip_forward<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">iptables\u00a0-t\u00a0nat\u00a0-I\u00a0PREROUTING\u00a0-p\u00a0tcp\u00a0&#8211;dport\u00a080\u00a0-j\u00a0DNAT\u00a0&#8211;to\u00a0\u5bf9\u5e94\u7684\u5185\u7f51IP(\u5982\u679c\u4e0d\u662f\u4e00\u4e2a\u5c40\u57df\u7f51\u53ea\u80fd\u914d\u7f6e\u5916\u7f51IP)<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">iptables\u00a0-t\u00a0nat\u00a0-I\u00a0POSTROUTING\u00a0-p\u00a0tcp\u00a0&#8211;dport\u00a080\u00a0-j\u00a0MASQUERADE<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">iptables\u00a0-A\u00a0INPUT\u00a0-p\u00a0tcp\u00a0&#8211;dport\u00a080\u00a0-j\u00a0ACCEPT<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">iptables\u00a0-A\u00a0INPUT\u00a0-p\u00a0tcp\u00a0&#8211;dport\u00a020\u00a0-j\u00a0ACCEPT<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">iptables\u00a0-A\u00a0INPUT\u00a0-p\u00a0tcp\u00a0&#8211;dport\u00a021\u00a0-j\u00a0ACCEPT<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">iptables\u00a0-A\u00a0INPUT\u00a0-p\u00a0tcp\u00a0&#8211;dport\u00a022\u00a0-j\u00a0ACCEPT<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">service\u00a0iptables\u00a0save<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"font-weight: 400;\" width=\"81\">service\u00a0iptables\u00a0restart<\/td>\n<td style=\"font-weight: 400;\" width=\"81\">\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p>\u67e5\u770b\u8f6c\u53d1   cat \/etc\/sysconfig\/iptables<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iptables -t nat -nL\u00a0 \u67e5\u770b \u8bbe&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/log.tanxiaodian.com\/?p=368\">Continue reading<span class=\"screen-reader-text\">iptables \u8f6c\u53d1\u8bbe\u7f6e\u548c\u67e5\u770b<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/368"}],"collection":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=368"}],"version-history":[{"count":2,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/368\/revisions"}],"predecessor-version":[{"id":425,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/368\/revisions\/425"}],"wp:attachment":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}