{"id":7104,"date":"2021-06-08T11:37:54","date_gmt":"2021-06-08T03:37:54","guid":{"rendered":"https:\/\/blog.pfchina.org\/?p=7104"},"modified":"2021-07-24T10:53:32","modified_gmt":"2021-07-24T02:53:32","slug":"opnsense%e9%98%b2%e7%81%ab%e5%a2%99%e8%a7%84%e5%88%99%e5%88%ab%e5%90%8d%e7%9a%84%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/blog.pfchina.org\/?p=7104","title":{"rendered":"OPNsense\u9632\u706b\u5899\u522b\u540d\u7684\u4f7f\u7528"},"content":{"rendered":"<p style=\"text-align: justify;\">\u5728\u6211\u4eec\u7f16\u5199\u9632\u706b\u5899\u89c4\u5219\u65f6\uff0c\u53ef\u80fd\u53ea\u662f\u7b80\u5355\u5730\u4f7f\u7528\u4e86\u7f51\u7edc\u63a5\u53e3\/\u7aef\u53e3\u548c IP \u5730\u5740\u7684\u9884\u5b9a\u4e49\u522b\u540d\uff0c\u4f8b\u5982\u201cLAN net\u201d\u3001\u201cLAN interface\u201d\u3001\u201cHTTP\u201d\u3001\u201cHTTPS\u201d\u3001\u7b49\u7b49\uff0c\u4f7f\u7528\u9884\u5b9a\u4e49\u7684\u522b\u540d\u4e0d\u4ec5\u65b9\u4fbf\uff0c\u800c\u4e14\u6709\u52a9\u4e8e\u7406\u89e3\u89c4\u5219\u3002<\/p>\n<p style=\"text-align: justify;\">\u5f53\u6211\u4eec\u5f00\u59cb\u6269\u5c55\u6216\u9694\u79bb\u6211\u4eec\u7684\u7f51\u7edc\u65f6\uff0c\u53ef\u80fd\u4f1a\u53d1\u73b0\u7ef4\u62a4\u89c4\u5219\u53d8\u5f97\u6709\u70b9\u56f0\u96be\uff0c\u7279\u522b\u662f\u5982\u679c\u5728\u89c4\u5219\u4e2d\u4e3a\u6240\u6709\u5177\u6709\u9759\u6001\u5730\u5740\u7684\u8bbe\u5907\u4f7f\u7528 IP \u5730\u5740\uff0c\u5982\u679c\u6ca1\u6709\u4e3a\u89c4\u5219\u8f93\u5165\u51c6\u786e\u7684\u63cf\u8ff0\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u5fd8\u8bb0\u4e00\u4e9b\u89c4\u5219\u7684\u76ee\u7684\u3002<\/p>\n<p style=\"text-align: justify;\">\u8fd9\u4e2a\u65f6\u5019\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528\u9632\u706b\u5899\u89c4\u5219\u7684\u522b\u540d\uff0c\u522b\u540d\u5141\u8bb8\u5c06\u4e00\u4e2a\u6216\u591a\u4e2a IP \u5730\u5740\u3001\u7f51\u7edc\u5730\u5740\u3001\u7aef\u53e3\u548c\u4e3b\u673a\u540d\u5206\u7ec4\u5e76\u5728\u89c4\u5219\u4e2d\u5f15\u7528\u3002\u522b\u540d\u53ef\u4ee5\u5e2e\u6211\u4eec\u51cf\u5c11\u7f16\u5199\u7684\u89c4\u5219\u6570\u91cf\u3002<\/p>\n<p style=\"text-align: justify;\">\u5f53\u6211\u4eec\u4f7f\u7528\u4e86\u522b\u540d\u65f6\uff0c\u5728\u67e5\u770b\u6bcf\u4e2a\u63a5\u53e3\u7684\u9632\u706b\u5899\u89c4\u5219\u65f6\uff0c\u5c06\u9f20\u6807\u60ac\u505c\u5728\u522b\u540d\u4e0a\u65f6\uff0c\u5c31\u4f1a\u770b\u5230\u4e00\u4e2a\u5de5\u5177\u63d0\u793a\u3002\u5de5\u5177\u63d0\u793a\u5c06\u663e\u793a\u522b\u540d\u7684\u5185\u5bb9\u4ee5\u53ca\u8f93\u5165\u7684\u63cf\u8ff0\uff0c\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<h1 id=\"creating-an-alias\" style=\"text-align: justify;\">\u521b\u5efa\u522b\u540d<\/h1>\n<p style=\"text-align: justify;\">\u4e0b\u9762\u4ee5\u521b\u5efa\u4e3b\u673a\u522b\u540d\u4f5c\u4e3a\u793a\u4f8b\u3002\u8f6c\u81f3\u201c\u9632\u706b\u5899 &gt; \u522b\u540d\u201d\u9875\u9762\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5217\u8868\u4e2d\u6709 4 \u4e2a\u9884\u5b9a\u4e49\u7684\u522b\u540d\u3002\u5355\u51fb\u201c<strong>+<\/strong>\u201d\u6309\u94ae\u6dfb\u52a0\u522b\u540d\u3002<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7106\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1.png\" alt=\"\u6dfb\u52a0\u65b0\u7684\u9632\u706b\u5899\u522b\u540d\" width=\"1672\" height=\"694\" srcset=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1.png 1672w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1-300x125.png 300w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1-1024x425.png 1024w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1-768x319.png 768w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1-1536x638.png 1536w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-1-500x208.png 500w\" sizes=\"auto, (max-width: 1672px) 100vw, 1672px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">\u8f93\u5165\u522b\u540d\u7684\u201c\u540d\u79f0\u201d\u3002\u4ece\u4e0b\u62c9\u5217\u8868\u4e2d\u9009\u62e9\u201c\u7c7b\u578b\u201d\u3002\u6709\u591a\u79cd\u522b\u540d\u53ef\u4f9b\u9009\u62e9\u3002\u201c\u5185\u5bb9\u201d\u53d6\u51b3\u4e8e\u9009\u62e9\u7684\u522b\u540d\u7c7b\u578b\u3002\u5728\u672c\u793a\u4f8b\u4e2d\uff0c\u5bf9\u4e8e\u201cHost(s)\u201d\u522b\u540d\uff0c\u53ef\u4ee5\u8f93\u5165 IP \u5730\u5740\u6216\u4e3b\u673a\u540d\u3002\u4e5f\u53ef\u4ee5\u5305\u542b\u53e6\u4e00\u4e2a\u522b\u540d\u3002\u8f93\u5165\u201c\u63cf\u8ff0\u201d\u5185\u5bb9\uff0c\u5e2e\u52a9\u4e86\u89e3\u522b\u540d\u7684\u7528\u9014\u6216\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7107\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-2.png\" alt=\"\u6dfb\u52a0\u65b0\u7684\u9632\u706b\u5899\u522b\u540d\" width=\"1359\" height=\"506\" srcset=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-2.png 1359w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-2-300x112.png 300w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-2-1024x381.png 1024w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-2-768x286.png 768w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-2-500x186.png 500w\" sizes=\"auto, (max-width: 1359px) 100vw, 1359px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">\u5355\u51fb\u201c\u4fdd\u5b58\u201d\u540e\uff0c\u5728\u5217\u8868\u4e2d\u5c31\u53ef\u4ee5\u770b\u5230\u65b0\u522b\u540d\u3002\u8fd9\u65f6\u8fd8\u4f1a\u51fa\u73b0\u4e00\u4e2a\u901a\u77e5\uff0c\u6307\u51fa\u9700\u8981\u5e94\u7528\u66f4\u6539\u624d\u80fd\u5728\u9632\u706b\u5899\u89c4\u5219\u4e2d\u4f7f\u7528\u522b\u540d\u3002\u5b8c\u6210\u540e\u5355\u51fb\u201c\u5e94\u7528\u201d\u6309\u94ae\u3002<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7108\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3.png\" alt=\"\u6dfb\u52a0\u65b0\u7684\u9632\u706b\u5899\u522b\u540d\" width=\"1660\" height=\"790\" srcset=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3.png 1660w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3-300x143.png 300w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3-1024x487.png 1024w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3-768x365.png 768w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3-1536x731.png 1536w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/add-new-firewall-alias-3-500x238.png 500w\" sizes=\"auto, (max-width: 1660px) 100vw, 1660px\" \/><\/a><\/p>\n<h1 id=\"types-of-aliases\" style=\"text-align: justify;\">\u522b\u540d\u7c7b\u578b<\/h1>\n<p style=\"text-align: justify;\">\u522b\u540d\u7c7b\u578b\u6709\u5f88\u591a\u79cd\uff0c\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e00\u79cd\u7c7b\u578b\u3002<\/p>\n<h2 id=\"hosts\" style=\"text-align: justify;\">\u4e3b\u673a<\/h2>\n<p style=\"text-align: justify;\">\u201c\u4e3b\u673a\u201d\u522b\u540d\u7c7b\u578b\u5141\u8bb8\u8f93\u5165 IP \u5730\u5740\u3001\u672c\u5730\u4e3b\u673a\u540d\u6216\u5b8c\u5168\u9650\u5b9a\u57df\u540d (FQDN)\u3002\u5982\u679c\u9700\u8981\u7ecf\u5e38\u5728\u89c4\u5219\u4e2d\u5f15\u7528 IP \u5730\u5740\uff0c\u5219\u53ef\u4ee5\u5c06\u5176\u8bbe\u4e3a\u4e3b\u673a\u522b\u540d\u5e76\u5728\u89c4\u5219\u4e2d\u4f7f\u7528\u8be5\u522b\u540d\u3002\u7531\u4e8e\u9632\u706b\u5899\u89c4\u5219\u4ec5\u5141\u8bb8 IP \u6216\u7f51\u7edc\u5730\u5740\uff0c\u56e0\u6b64\u5fc5\u987b\u4f7f\u7528\u522b\u540d\u624d\u80fd\u5728\u89c4\u5219\u4e2d\u4f7f\u7528\u4e3b\u673a\u540d\u6216 FQDN\u3002<\/p>\n<p style=\"text-align: justify;\">\u4e3b\u673a\u522b\u540d\u8fd8\u5141\u8bb8\u4f7f\u7528\u201c\uff01\u201d\u6392\u9664\u5bf9\u8c61\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8f93\u5165\u300e!192.168.1.10\u300f\uff0c\u5219\u8868\u793a\u6392\u9664192.168.1.10\u3002\u6392\u9664\u9009\u9879\u53ea\u5bf9 IP \u5730\u5740\u6709\u6548\u3002<\/p>\n<p style=\"text-align: justify;\">\u4e3b\u673a\u522b\u540d\u793a\u4f8b\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>IP \u5730\u5740<em>\uff1a<\/em>\u00a0192.168.1.10 \u6216 !192.168.1.10\uff08\u4e5f\u5141\u8bb8 IPv6 \u5730\u5740\uff09<\/li>\n<li>\u672c\u5730\u4e3b\u673a\u540d\uff08\u4e0d\u5e26\u57df\u540d\uff09<em>\uff1a<\/em>\u00a0myserver \u6216 !myserver<\/li>\n<li>FQDN<em>\uff1a<\/em> blog.pfchina.org\u6216 !blog.pfchina.org<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u53ef\u4ee5\u5728\u522b\u540d\u4e2d\u8f93\u5165\u4ee5\u9017\u53f7\u5206\u9694\u7684 IP \u5730\u5740\u3001\u4e3b\u673a\u540d\u548c FQDN \u7684\u4efb\u610f\u7ec4\u5408\u7684\u591a\u4e2a\u503c\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>192.168.1.10, 192.168.1.11, myserver1, blog.pfchina.org<\/li>\n<\/ul>\n<h2 id=\"networks\" style=\"text-align: justify;\">\u7f51\u7edc<\/h2>\n<p style=\"text-align: justify;\">\u201c\u7f51\u7edc\u201d\u522b\u540d\u5141\u8bb8\u4ee5 CIDR \u683c\u5f0f\u8f93\u5165\u7f51\u7edc\u7684 IP \u5730\u5740\u8303\u56f4\u3002CIDR \u8868\u793a\u6cd5\u662f\u901a\u8fc7\u4f7f\u7528\u8bbe\u7f6e\u4e3a1 \u7684\u4f4d\u6570\u6765\u5b9a\u4e49\u5b50\u7f51\u63a9\u7801\u7684\u65b9\u6cd5\u3002\u5176\u4f59\u8bbe\u7f6e\u4e3a 0\u3002\u5728 192.168.1.0\/24 \u7684\u793a\u4f8b\u4e2d\uff0c\u201c\/24\u201d\u662f CIDR \u8868\u793a\u6cd5\u7f51\u7edc\u5730\u5740\u7684\u4e00\u90e8\u5206\uff0c\u76f8\u5f53\u4e8e\u5b50\u7f51\u63a9\u7801 255.255.255.0\u3002\u5141\u8bb8\u6392\u9664\u7f51\u7edc\u522b\u540d\uff0c\u5982\u4e3b\u673a\u522b\u540d\u3002<\/p>\n<p style=\"text-align: justify;\">\u7f51\u7edc\u522b\u540d\u793a\u4f8b\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>192.168.1.0\/24 \u6216 !192.168.1.0\/24\uff08\u4e5f\u5141\u8bb8 IPv6 \u5730\u5740\uff09<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u53ef\u4ee5\u8f93\u5165\u591a\u4e2a\u7f51\u7edc\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>192.168.1.0\/24, 192.168.2.0\/24<\/li>\n<\/ul>\n<h2 id=\"ports\" style=\"text-align: justify;\">\u7aef\u53e3<\/h2>\n<p style=\"text-align: justify;\">\u201c\u7aef\u53e3)\u201d\u522b\u540d\u5141\u8bb8\u6307\u5b9a\u7aef\u53e3\u53f7\u3002\u53ef\u4ee5\u8f93\u5165 0 \u5230 65,535 \u4e4b\u95f4\u7684\u6570\u5b57\u3002\u8981\u6307\u5b9a\u4e00\u7cfb\u5217\u8fde\u7eed\u7aef\u53e3\uff0c\u8bf7\u5728\u7aef\u53e3\u53f7\u4e4b\u95f4\u4f7f\u7528\u5192\u53f7\u3002<\/p>\n<p style=\"text-align: justify;\">\u7aef\u53e3\u522b\u540d\u793a\u4f8b\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>\u7aef\u53e3<em>\uff1a<\/em>\u00a08080<\/li>\n<li>\u7aef\u53e3\u8303\u56f4<em>\uff1a<\/em>\u00a08000:8080<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u53ef\u4ee5\u8f93\u5165\u591a\u4e2a\u7aef\u53e3\uff0c\u5305\u62ec\u7aef\u53e3\u8303\u56f4\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>22, 8000:8080<\/li>\n<\/ul>\n<h2 id=\"url-ips\" style=\"text-align: justify;\">URL (IPs)<\/h2>\n<p style=\"text-align: justify;\">\u201c\u7f51\u5740(IPs)\u201d\u522b\u540d\u7528\u4e8e\u6258\u7ba1\u5728\u7f51\u7ad9\u4e0a\u7684 IP \u5730\u5740\u5217\u8868\u3002\u5728OPNsense\u6587\u6863\u4e2d\u6ca1\u6709\u63d0\u53ca\u201cURL (IPs)\u201d\u7684\u522b\u540d\u7c7b\u578b\u3002\u5c06\u201cURL (IPs)\u201d\u4e0e\u201cURL Table (IPs)\u201d\u8fdb\u884c\u6bd4\u8f83\u65f6\uff0c\u4e3b\u8981\u533a\u522b\u5728\u4e8e\u201c\u5237\u65b0\u9891\u7387\u201d\uff0cURL (IPs)\u201d\u7528\u4e8e IP \u5730\u5740\u7684\u9759\u6001\u5217\u8868\u3002<\/p>\n<p id=\"url-ips\" style=\"text-align: justify;\">URL (IPs)\u522b\u540d\u793a\u4f8b\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>https:\/\/domainname.com\/ip-list.txt<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u53ef\u4ee5\u8f93\u5165\u591a\u4e2a URL\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>https:\/\/domainname.com\/ip-list.txt,\u00a0https:\/\/domainname2.com\/ip-list2.txt<\/li>\n<\/ul>\n<h2 id=\"url-table-ips\" style=\"text-align: justify;\">URL Table (IPs)<\/h2>\n<p style=\"text-align: justify;\">\u201cURL Table (IPs)\u201d\u522b\u540d\u7528\u4e8e IP \u5730\u5740\u5217\u8868\uff0c\u5982\u201cURL (IPs)\u201d\u522b\u540d\u3002\u5927\u591a\u6570\u7528\u6237\u6700\u559c\u6b22\u4f7f\u7528\u8fd9\u4e2a URL \u522b\u540d\u7c7b\u578b\uff0c\u5b83\u53ef\u4ee5\u5b9a\u671f\u5237\u65b0\uff0c\u5bf9\u4e8e\u963b\u6b62\u5217\u8868\u5f88\u6709\u7528\u3002URL Table (IPs)\u522b\u540d\u53ef\u4ee5\u6307\u5b9a\u66f4\u65b0\u95f4\u9694\u3002<\/p>\n<p style=\"text-align: justify;\">URL Table (IPs)\u522b\u540d\u793a\u4f8b\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>https:\/\/domainname.com\/ip-list.txt<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u53ef\u4ee5\u8f93\u5165\u591a\u4e2a URL\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>https:\/\/domainname.com\/ip-list.txt,\u00a0https:\/\/domainname2.com\/ip-list2.txt<\/li>\n<\/ul>\n<h2 id=\"geoip\" style=\"text-align: justify;\">GeoIP<\/h2>\n<p style=\"text-align: justify;\">\u5f53\u9700\u8981\u963b\u6b62\u6765\u81ea\u5176\u4ed6\u56fd\u5bb6\/\u5730\u533a\u7684 IP\/\u7f51\u7edc\u5730\u5740\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u201cGeoIP\u201d\u522b\u540d\u3002\u6258\u7ba1\u5728\u4e91\u4e0a\u7684\u670d\u52a1\u548c\u901a\u8fc7 VPN\u3001Tor \u6216 SSH \u5efa\u7acb\u96a7\u9053\u7f51\u7edc\u8fde\u63a5\uff0c\u5f88\u5bb9\u6613\u7ed5\u8fc7GeoIP\u963b\u6b62\u3002\u4f46\u662f\u5b83\u4ecd\u7136\u5f88\u6709\u7528\uff0c\u5b83\u53ef\u4ee5\u963b\u6b62\u6765\u81ea\u4e0d\u719f\u7ec3\u7684\u653b\u51fb\u8005\u6216\u6765\u81ea\u5176\u4ed6\u56fd\u5bb6\u7684\u53d7\u611f\u67d3\u673a\u5668\u7684\u968f\u673a\u653b\u51fb\u3002<\/p>\n<p style=\"text-align: justify;\">\u8981\u8bbe\u7f6e\u201cGeoIP\u201d\u522b\u540d\uff0c\u5fc5\u987b\u6ce8\u518c<a href=\"https:\/\/maxmind.com\/\" target=\"_blank\" rel=\"noopener\">MaxMind<\/a>\u7684 GeoIP \u670d\u52a1\u4ee5\u83b7\u53d6\u5b8c\u5168\u914d\u7f6e GeoIP \u522b\u540d\u6240\u9700\u7684 GeoIP \u5730\u5740\u8303\u56f4\u3002<\/p>\n<h2 id=\"network-group\" style=\"text-align: justify;\">\u7f51\u7edc\u7ec4<\/h2>\n<p style=\"text-align: justify;\">\u201c\u7f51\u7edc\u7ec4\u201d\u522b\u540d\u53ef\u7528\u4e8e\u5bf9\u9664\u201c\u7aef\u53e3\u201d\u548c\u201c\u5916\u90e8\uff08\u9ad8\u7ea7\uff09\u201d\u522b\u540d\u7c7b\u578b\u4e4b\u5916\u7684\u5176\u4ed6\u522b\u540d\u7c7b\u578b\u8fdb\u884c\u5206\u7ec4\u3002\u8be5\u522b\u540d\u7c7b\u578b\u4ec5\u5141\u8bb8\u5bf9\u517c\u5bb9\u7684\u522b\u540d\u8fdb\u884c\u5206\u7ec4\u3002\u4f7f\u7528\u201c\u7f51\u7edc\u7ec4\u201d\u522b\u540d\u7684\u4e3b\u8981\u597d\u5904\u662f\u5b83\u53ef\u4ee5\u9632\u6b62\u5bf9\u4e0d\u517c\u5bb9\u7684\u522b\u540d\u8fdb\u884c\u5206\u7ec4\u3002<\/p>\n<p style=\"text-align: justify;\">\u7f51\u7edc\u7ec4\u522b\u540d\u793a\u4f8b\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>hostalias1, hostalias2, urlalias\uff08\u4ece\u4e0b\u62c9\u5217\u8868\u4e2d\u9009\u62e9\uff09<\/li>\n<\/ul>\n<h2 id=\"mac-address\" style=\"text-align: justify;\">MAC\u5730\u5740<\/h2>\n<p style=\"text-align: justify;\">\u201cMAC \u5730\u5740\u201d\u522b\u540d\u5141\u8bb8\u5728\u522b\u540d\u4e2d\u4f7f\u7528 MAC \u5730\u5740\u3002\u201cMAC \u5730\u5740\u201d\u522b\u540d\u65e0\u6cd5\u675c\u7edd\u6076\u610f\u7528\u6237\u4f7f\u7528\u6b3a\u9a97MAC\u5730\u5740\uff0c\u8fd9\u662f\u8be5\u522b\u540d\u4f7f\u7528\u5b58\u5728\u7684\u7f3a\u9677\u3002<\/p>\n<p style=\"text-align: justify;\">MAC \u5730\u5740\u522b\u540d\u793a\u4f8b\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>3f:cf:3f:1f:7f:bf<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">\u4e5f\u53ef\u4ee5\u8f93\u5165\u591a\u4e2a MAC \u5730\u5740\uff1a<\/p>\n<ul style=\"text-align: justify;\">\n<li>3f:cf:3f:1f:7f:bf, 3e:ce:3e:1e:7e:be<\/li>\n<\/ul>\n<h2 id=\"external-advanced\" style=\"text-align: justify;\">\u5916\u90e8\uff08\u9ad8\u7ea7\uff09<\/h2>\n<p style=\"text-align: justify;\">\u5f53\u5e0c\u671b\u5916\u90e8\u8fdb\u7a0b\u7ba1\u7406\u9632\u706b\u5899\u4e2d\u522b\u540d\u7684\u503c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u201c\u5916\u90e8\uff08\u9ad8\u7ea7\uff09\u201d\u522b\u540d\u7c7b\u578b\u3002\u5982\u679c\u9700\u8981\u52a8\u6001\u66f4\u6539\u522b\u540d\u7684\u503c\uff0c\u8fd9\u4f1a\u975e\u5e38\u65b9\u4fbf\u3002\u7531\u4e8e OPNsense \u5177\u6709<a href=\"https:\/\/docs.opnsense.org\/development\/api\/core\/firewall.html\" target=\"_blank\" rel=\"noopener\">\u9632\u706b\u5899 API<\/a>\uff0c\u53ef\u4ee5\u66f4\u597d\u7684\u4ece\u5916\u90e8\u8fdb\u7a0b\u66f4\u65b0\/\u7ba1\u7406\u9632\u706b\u5899\u89c4\u5219\u3002<\/p>\n<h1 id=\"nesting-firewall-rule-aliases\" style=\"text-align: justify;\">\u522b\u540d\u5d4c\u5957<\/h1>\n<p style=\"text-align: justify;\">\u5bf9\u4e8e\u6240\u6709\u522b\u540d\u7c7b\u578b\uff0c\u53ef\u4ee5\u5728\u522b\u540d\u4e2d\u5d4c\u5957\u522b\u540d\u3002\u5982\u679c\u5e0c\u671b\u5c06\u591a\u4e2a\u522b\u540d\u7ec4\u5408\u5728\u4e00\u8d77\uff0c\u8fd9\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6709\u201cserver1\u201d\u548c\u201cserver2\u201d\u7684\u522b\u540d\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cmyservers\u201d\u7684\u7b2c\u4e09\u4e2a\u522b\u540d\uff0c\u5176\u4e2d\u5305\u542b\u201cserver1\u201d\u548c\u201cserver2\u201d\u3002\u8fd9\u6837\u505a\uff0c\u53ef\u4ee5\u5728\u5b83\u4eec\u81ea\u5df1\u7684\u7279\u5b9a\u9632\u706b\u5899\u89c4\u5219\u4e2d\u4f7f\u7528\u201cserver1\u201d\u548c\u201cserver2\u201d\u522b\u540d\uff0c\u4f46\u968f\u540e\u6709\u9002\u7528\u4e8e\u4e24\u4e2a\u670d\u52a1\u5668\u7684\u66f4\u5e7f\u6cdb\u7684\u9632\u706b\u5899\u89c4\u5219\u3002<\/p>\n<h1 id=\"deleting-a-firewall-alias\" style=\"text-align: justify;\">\u5220\u9664\u522b\u540d<\/h1>\n<p style=\"text-align: justify;\">\u8981\u5220\u9664\u5d4c\u5957\u5728\u53e6\u4e00\u4e2a\u522b\u540d\u4e2d\u548c\/\u6216\u9632\u706b\u5899\u89c4\u5219\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u7684\u522b\u540d\uff0c\u5c06\u6536\u5230\u9519\u8bef\u6d88\u606f\u3002\u8fd9\u6837\u7684\u8bbe\u7f6e\u53ef\u4ee5\u9632\u6b62\u8fdd\u53cd\u4efb\u4f55\u9632\u706b\u5899\u89c4\u5219\u3002<\/p>\n<h1 id=\"firewall-rule-example\" style=\"text-align: justify;\">\u89c4\u5219\u793a\u4f8b<\/h1>\n<p style=\"text-align: justify;\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c06\u201cMyServer\u201d\u4e3b\u673a\u522b\u540d\u7528\u4f5c\u76ee\u6807\uff0c\u5047\u8bbe\u670d\u52a1\u5668\u5b58\u5728\u4e8e\u53e6\u4e00\u4e2aDMZ\u7f51\u7edc\u4e2d\u3002\u8be5\u793a\u4f8b\u663e\u793a\u4e86\u521b\u5efa LAN \u89c4\u5219\u4ee5\u5141\u8bb8\u4ece LAN \u7f51\u7edc\u4e2d\u7684\u8bbe\u5907\u8bbf\u95ee DMZ \u7f51\u7edc\u4e2d\u7684\u670d\u52a1\u5668\u3002<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-using-alias-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7109\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-using-alias-example.png\" alt=\"\u4f7f\u7528\u522b\u540d\u7684\u9632\u706b\u5899\u89c4\u5219\" width=\"1003\" height=\"1532\" srcset=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-using-alias-example.png 1003w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-using-alias-example-196x300.png 196w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-using-alias-example-670x1024.png 670w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-using-alias-example-768x1173.png 768w\" sizes=\"auto, (max-width: 1003px) 100vw, 1003px\" \/><\/a><\/p>\n<h1 id=\"minimizing-the-number-of-firewall-rules\" style=\"text-align: justify;\">\u51cf\u5c11\u89c4\u5219\u6570\u91cf<\/h1>\n<p style=\"text-align: justify;\">\u5728\u4f7f\u7528\u522b\u540d\u4e4b\u524d\uff0c\u67092\u4e2a\u89c4\u5219\u5141\u8bb8 HTTPS \u8bbf\u95ee DMZ \u7f51\u7edc\u4e2d\u7684 2 \u4e2a\u670d\u52a1\u5668\u3002\u7531\u4e8e\u4e00\u6b21\u53ea\u80fd\u5728\u6ca1\u6709\u522b\u540d\u7684\u89c4\u5219\u4e2d\u8f93\u5165\u4e00\u4e2a IP \u5730\u5740\uff0c\u56e0\u6b64\u6bcf\u4e2a\u670d\u52a1\u5668\u90fd\u9700\u8981\u4e00\u4e2a\u89c4\u5219\uff1a<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-before-alias.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7110\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-before-alias.png\" alt=\"\u522b\u540d\u524d\u7684\u9632\u706b\u5899\u89c4\u5219\" width=\"1295\" height=\"530\" srcset=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-before-alias.png 1295w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-before-alias-300x123.png 300w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-before-alias-1024x419.png 1024w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-before-alias-768x314.png 768w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-before-alias-500x205.png 500w\" sizes=\"auto, (max-width: 1295px) 100vw, 1295px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">\u4f8b\u5982\uff0c\u5982\u679c\u4f7f\u7528\u522b\u540d\u8c03\u7528\u201cMyServers\u201d\uff0c\u5b83\u5305\u542b\u4e24\u4e2a\u6709IP\u5730\u5740\u7684\u670d\u52a1\u5668\uff0c\u5219\u53ea\u9700\u521b\u5efa\u4e00\u4e2a\u5c06\u201cMyServers\u201d\u522b\u540d\u4f5c\u4e3a\u201c\u76ee\u6807\u201d\u7684\u89c4\u5219\uff0c\u4ee5\u5141\u8bb8\u5bf9 DMZ \u4e2d\u7684\u4e24\u4e2a\u670d\u52a1\u5668\u8fdb\u884c HTTPS \u8bbf\u95ee\uff1a<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-after-alias.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7111\" src=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-after-alias.png\" alt=\"\u522b\u540d\u540e\u7684\u9632\u706b\u5899\u89c4\u5219\" width=\"1296\" height=\"492\" srcset=\"https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-after-alias.png 1296w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-after-alias-300x114.png 300w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-after-alias-1024x389.png 1024w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-after-alias-768x292.png 768w, https:\/\/blog.pfchina.org\/wp-content\/uploads\/2021\/06\/firewall-rule-after-alias-500x190.png 500w\" sizes=\"auto, (max-width: 1296px) 100vw, 1296px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">\u7531\u6b64\u53ef\u89c1\uff0c\u522b\u540d\u51cf\u5c11\u4e86\u9700\u8981\u521b\u5efa\u7684\u89c4\u5219\u6570\u91cf\uff0c\u540c\u65f6\u4f7f\u89c4\u5219\u66f4\u6613\u4e8e\u7406\u89e3\u3002<\/p>\n<h1 id=\"conclusion\" style=\"text-align: justify;\">\u7ed3\u8bba<\/h1>\n<p style=\"text-align: justify;\">\u9632\u706b\u5899\u522b\u540d\u662f\u4e00\u4e2a\u7b80\u5355\u4f46\u975e\u5e38\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u5982\u679c\u5e0c\u671b\u638c\u63e1\u7f16\u5199\u9632\u706b\u5899\u89c4\u5219\uff0c\u5e76\u4f7f\u89c4\u5219\u6613\u4e8e\u7406\u89e3\u548c\u4f7f\u7528\uff0c\u5219\u5e94\u91cd\u89c6\u522b\u540d\u7684\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u6211\u4eec\u7f16\u5199\u9632\u706b\u5899\u89c4\u5219\u65f6\uff0c\u53ef\u80fd\u53ea\u662f\u7b80\u5355\u5730\u4f7f\u7528\u4e86\u7f51\u7edc\u63a5\u53e3\/\u7aef\u53e3\u548c IP \u5730\u5740\u7684\u9884\u5b9a\u4e49 &hellip; <a href=\"https:\/\/blog.pfchina.org\/?p=7104\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[189],"class_list":["post-7104","post","type-post","status-publish","format-standard","hentry","category-opnsense","tag-189"],"_links":{"self":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/7104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7104"}],"version-history":[{"count":0,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/7104\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}