{"id":516907,"date":"2021-07-15T20:52:59","date_gmt":"2021-07-15T12:52:59","guid":{"rendered":"http:\/\/4563.org\/?p=516907"},"modified":"2021-07-15T20:52:59","modified_gmt":"2021-07-15T12:52:59","slug":"%e8%af%b7%e6%95%99freebsd-ipfw-nat-%e5%86%85%e6%a0%b8%e7%ba%a7%e7%ab%af%e5%8f%a3%e8%bd%ac%e5%8f%91%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=516907","title":{"rendered":"\u8bf7\u6559FreeBSD ipfw nat \u5185\u6838\u7ea7\u7aef\u53e3\u8f6c\u53d1\u95ee\u9898&#8230;"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>KDE<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u8bf7\u6559FreeBSD ipfw nat \u5185\u6838\u7ea7\u7aef\u53e3\u8f6c\u53d1\u95ee\u9898&#8230;<\/h3>\n<p>  \t\tcat \/etc\/rc.conf<br \/>  firewall_enable=&quot;YES&quot;<br \/>  firewall_type=&quot;open&quot;<br \/>  gateway_enable=&quot;YES&quot;<\/p>\n<p>  #!\/bin\/sh<br \/>  kldload ipfw_nat<br \/>  ipfw -q -f flush<br \/>  ipfw nat 1 config if em0 redirect_port tcp 10.1.1.254:80 80<br \/>  ipfw -q -add 65535 deny ip from any to any<\/p>\n<p>  \u9632\u706b\u5899\u6253\u7b97\u4ee5\u767d\u540d\u5355\u6a21\u5f0f\u8fd0\u884c,\u6240\u4ee5\u6700\u540e\u662f\u62d2\u7edd\u6ca1\u6709\u5141\u8bb8\u7684\u6d41\u91cf.<\/p>\n<p>  FreeBSD \u7cfb\u7edf\u7248\u672c12.2 &nbsp; &nbsp; &nbsp; &nbsp; \u8fd0\u884c\u5728\u5bb6\u91cc\u5c40\u57df\u7f51esxi<br \/>  FreeBSD \u7f51\u7edc\u63a5\u53e3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;em0&quot;<br \/>  FreeBSD IP\u5730\u5740&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;10.1.1.230&quot;<br \/>  \u9700\u8981\u8f6c\u53d1\u7684\u5730\u5740&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;10.1.1.254&quot;<br \/>  \u9700\u8981\u8f6c\u53d1\u7684\u7aef\u53e3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;TCP 80&quot;<\/p>\n<p>  \u5f53\u6211\u5173\u95ed\u9632\u706b\u5899,\u8f6c\u53d1\u547d\u4ee4\u624d\u751f\u6548,\u6211\u60f3\u77e5\u9053\u8f6c\u53d1\u7aef\u53e3\u8fd8\u9700\u8981\u4ec0\u4e48\u89c4\u5219\u7684???<br \/>  \u5173\u95ed\u9632\u706b\u5899\u7684\u547d\u4ee4,\u5728\u62d2\u7edd\u524d\u63d2\u5165.<br \/>  ipfw -q -add 65534 allow ip from any to any<\/p>\n<p>  &#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>  cat &lt;&lt;EOF&gt; \/root\/ipfw<br \/>  #!\/bin\/sh<br \/>  kldload ipfw_nat<br \/>  ipfw -q -f flush<br \/>  ipfw nat 1 config if em0 redirect_port tcp 10.1.1.254:80 80<br \/>  ipfw -q add 00100 allow all from any to any via lo0<br \/>  ipfw -q add 00200 allow icmp from any to any<br \/>  ipfw -q add 00300 allow tcp from any to any 22,2222,80,443,8443,53,853 setup keep-state<br \/>  ipfw -q add 00400 allow udp from any to any 53,853,4000,5000 keep-state<br \/>  ipfw -q -add 65535 deny ip from any to any<br \/>  EOF<\/p>\n<p>  \u8fd9\u662f\u767d\u540d\u5355\u6a21\u5f0f&#8230;.<\/p>\n<p>  \u5173\u4e86\u9632\u706b\u5899ipfw\u8f6c\u53d1\u624d\u751f\u6548&#8230;.\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>optimism<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd9\u5c31\u8981\u7b49\u4e2a\u5927\u4f6c\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>KDE<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\toptimism \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-7-15 20:40<br \/>  \u8fd9\u5c31\u8981\u7b49\u4e2a\u5927\u4f6c\u4e86<\/p>\n<p> \u5b98\u65b9\u8bba\u575b\u4e5f\u95ee\u4e86,\u5728\u7b49\u56de\u590d&#8230;..<\/p>\n<p>  https:\/\/forums.freebsd.org\/threads\/how-to-use-ipfw_nat-to-forward-ports.81337\/\/\/\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>KDE \u5927\u4f6c\u6709\u8bdd\u8bf4 : \u8bf7\u6559Fre&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/516907"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=516907"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/516907\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=516907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=516907"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=516907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}