{"id":22,"date":"2005-01-24T18:34:47","date_gmt":"2005-01-24T10:34:47","guid":{"rendered":"http:\/\/192.168.0.1\/blog_4.4.2\/?p=22"},"modified":"2005-01-24T18:34:47","modified_gmt":"2005-01-24T10:34:47","slug":"linux-u-iptables-nat-yigatewaya-port-mapping","status":"publish","type":"post","link":"https:\/\/blog.worren.net\/?p=22","title":{"rendered":"Linux \u4e0b iptables \u7684 NAT \u4e4b\u6a5f\u5668\u4e0d\u7528\u8a2dgateway\u4e5f\u80fd port mapping"},"content":{"rendered":"<div class='drop-case'> <p> provided by pank@pank.org &#038; kelly@qkelly.com<\/div>\n <p> \u7bc4\u4f8b <br \/> \nWAN IP 211.72.242.40 NETMASK 255.255.255.0 <br \/> \nLAN IP 192.168.1.1 NETMASK 255.255.255.0\n <p> \u5167\u90e8\u6a5f\u5668 192.168.1.246, gateway \u4efb\u610f, \u4e5f\u53ef\u4ee5\u4e0d\u8a2d\n <p> port 2222 mapping \u5230 192.168.1.246:22\n <p> iptables -t nat -I PREROUTING -p tcp -d 211.72.242.40 &#8211;dport 2222 -j DNAT &#8211;to 192.168.1.246:22 <br \/> \niptables -t nat -I POSTROUTING -p tcp -d 192.168.1.246 &#8211;dport 22 -j SNAT &#8211;to 192.168.1.1\n","protected":false},"excerpt":{"rendered":" <p> provided by pank@pank.org &#038; kelly@qkelly.com \u7bc4\u4f8b WAN IP 211.72.242.40 NETMASK 255.255.255.0 LAN IP 192.168.1.1 NETMASK 255.255.255.0 \u5167\u90e8\u6a5f\u5668 192.168.1.246, gateway \u4efb\u610f, \u4e5f\u53ef\u4ee5\u4e0d\u8a2d port 2222 mapping \u5230 192.168.1.246:22 iptables -t nat -I PREROUTING -p tcp -d 211.72.242.40 &#8211;dport 2222 -j DNAT &#8211;to 192.168.1.246:22 iptables -t nat -I POSTROUTING -p tcp -d 192.168.1.246 &#8211;dport 22 -j SNAT &#8211;to &hellip; <a href=\"https:\/\/blog.worren.net\/?p=22\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux \u4e0b iptables \u7684 NAT \u4e4b\u6a5f\u5668\u4e0d\u7528\u8a2dgateway\u4e5f\u80fd port mapping&#8221;<\/span><\/a> <\/p> \n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.worren.net\/index.php?rest_route=\/wp\/v2\/posts\/22"}],"collection":[{"href":"https:\/\/blog.worren.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.worren.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.worren.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.worren.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22"}],"version-history":[{"count":0,"href":"https:\/\/blog.worren.net\/index.php?rest_route=\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.worren.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.worren.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.worren.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}