

{"id":275,"date":"2023-09-30T17:31:56","date_gmt":"2023-09-30T09:31:56","guid":{"rendered":"https:\/\/www.01j.top\/?p=275"},"modified":"2023-09-30T17:32:35","modified_gmt":"2023-09-30T09:32:35","slug":"%e7%bd%91%e7%bb%9c%e5%ae%89%e5%85%a8%e5%b7%a5%e5%85%b7-netsh-ipsec","status":"publish","type":"post","link":"https:\/\/www.01j.top\/?p=275","title":{"rendered":"Windows\u81ea\u5e26\u7684\u7f51\u7edc\u5b89\u5168\u5de5\u5177 Netsh IPsec"},"content":{"rendered":"\n<h2 id=\"h2-0\">1\u3001IPsec\u7ec4\u6210\u53ca\u64cd\u4f5c\u57fa\u672c\u6d41\u7a0b<\/h2>\n\n\n\n<p>IP\u5b89\u5168\u7b56\u7565\u5217\u8868\uff1a\u7531\u591a\u4e2aIP\u5b89\u5168\u7b56\u7565\u7ec4\u6210<\/p>\n\n\n\n<p>IP\u5b89\u5168\u7b56\u7565\uff1a\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u89c4\u5219\u7684\u7ec4\u6210<\/p>\n\n\n\n<p>\u89c4\u5219\uff1a\u7531\u4e00\u4e2aIP\u7b5b\u9009\u5668\u5217\u8868\u548c\u4e00\u4e2a\u76f8\u5e94\u7684\u7b5b\u9009\u5668\u64cd\u4f5c\u7684\u7ec4\u6210<\/p>\n\n\n\n<p>IP\u7b5b\u9009\u5668\u5217\u8868\uff1a\u7531\u4e00\u4e2a\u6216\u591a\u4e2aIP\u7b5b\u9009\u5668\u7ec4\u6210<\/p>\n\n\n\n<p>\u7b5b\u9009\u5668\u64cd\u4f5c\uff1apermit\u6216block<\/p>\n\n\n\n<p>\u64cd\u4f5c\u6d41\u7a0b\uff1a\u521b\u5efaIP\u5b89\u5168\u7b56\u7565&#8211;>\u521b\u5efa\u7b5b\u9009\u5668\u64cd\u4f5c&#8211;>\u521b\u5efaIP\u7b5b\u9009\u5668\u5217\u8868&#8211;>\u521b\u5efa\u7b56\u7565\u89c4\u5219&#8211;>\u6fc0\u6d3bIP\u5b89\u5168\u7b56\u7565<\/p>\n\n\n\n<h2 id=\"h2-1\">2\u3001\u5b8c\u6574\u5b9e\u4f8b<\/h2>\n\n\n\n<p>REM \u6e05\u7a7a\u7b56\u7565<\/p>\n\n\n\n<p>netsh ipsec static del all<\/p>\n\n\n\n<p>REM \u521b\u5efaIP\u5b89\u5168\u7b56\u7565<\/p>\n\n\n\n<p>netsh ipsec static add policy name=MyIPSec<\/p>\n\n\n\n<p>REM \u521b\u5efa\u7b5b\u9009\u5668\u64cd\u4f5c\uff08block\u548cpermit\uff09&nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filteraction name=Permit action=permit&nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filteraction name=Block action=block&nbsp;<\/p>\n\n\n\n<p>REM \u9996\u5148\u7981\u6b62\u6240\u6709\u8bbf\u95ee\uff08\u521b\u5efaIP\u7b5b\u9009\u5668\u5217\u8868\u3001\u521b\u5efa\u7b56\u7565\u89c4\u5219\uff09&nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filterlist name=AllAccess&nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=AllAccess srcaddr=Me dstaddr=Any mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add rule name=BlockAllAccess policy=MyIPSec filterlist=AllAccess filteraction=Block&nbsp;<\/p>\n\n\n\n<p>REM \u5f00\u653e\u67d0\u4e9bIP\u65e0\u9650\u5236\u8bbf\u95ee\uff08\u521b\u5efaIP\u7b5b\u9009\u5668\u5217\u8868\u3001\u521b\u5efa\u7b56\u7565\u89c4\u5219\uff09&nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filterlist name=UnLimitedIP&nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=UnLimitedIP srcaddr=192.168.120.83 dstaddr=Me mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add rule name=AllowUnLimitedIP policy=MyIPSec filterlist=UnLimitedIP filteraction=Permit&nbsp;<\/p>\n\n\n\n<p>REM \u5f00\u653e\u67d0\u4e9b\u7aef\u53e3\uff08\u521b\u5efaIP\u7b5b\u9009\u5668\u5217\u8868\u3001\u521b\u5efa\u7b56\u7565\u89c4\u5219\uff09 &nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filterlist name=OpenSomePort&nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=OpenSomePort srcaddr=Any dstaddr=Me dstport=3389 protocol=TCP mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add rule name=AllowOpenSomePort policy=MyIPSec filterlist=OpenSomePort filteraction=Permit&nbsp;<\/p>\n\n\n\n<p>REM \u5f00\u653e\u67d0\u4e9bip\u53ef\u4ee5\u8bbf\u95ee\u67d0\u4e9b\u7aef\u53e3\uff08\u521b\u5efaIP\u7b5b\u9009\u5668\u5217\u8868\u3001\u521b\u5efa\u7b56\u7565\u89c4\u5219\uff09 &nbsp;<\/p>\n\n\n\n<p>netsh ipsec static add filterlist name=SomeIPSomePort<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=SomeIPSomePort srcaddr=Me dstaddr=Any protocol=ICMP mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=SomeIPSomePort srcaddr=Me dstaddr=Any dstport=80 protocol=TCP mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=SomeIPSomePort srcaddr=Me dstaddr=Any dstport=443 protocol=TCP mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=SomeIPSomePort srcaddr=Me dstaddr=Any dstport=53 protocol=TCP mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add filter filterlist=SomeIPSomePort srcaddr=Me dstaddr=Any dstport=53 protocol=UDP mirrored=yes<\/p>\n\n\n\n<p>netsh ipsec static add rule name=AllowSomeIPSomePort policy=MyIPSec filterlist=SomeIPSomePort filteraction=Permit&nbsp;<\/p>\n\n\n\n<p>REM \u6fc0\u6d3bIP\u5b89\u5168\u7b56\u7565<\/p>\n\n\n\n<p>netsh ipsec static set policy name=MyIPSec assign=y&nbsp;<\/p>\n\n\n\n<h2 id=\"h2-2\">REM =================\u7ed3\u675f================&nbsp;<\/h2>\n\n\n\n<h2 id=\"h2-3\">3\u3001\u64cd\u4f5c\u8865\u5145<\/h2>\n\n\n\n<p>\u5220\u9664\u89c4\u5219<\/p>\n\n\n\n<p>netsh ipsec static del rule name=BlockAllAccess policy=MyIPSec<\/p>\n\n\n\n<p>\u5220\u9664\u7b5b\u9009\u5668\u5217\u8868<\/p>\n\n\n\n<p>netsh ipsec static add filterlist name=AllAccess&nbsp;<\/p>\n\n\n\n<p>\u5bfc\u51fa\u7b56\u7565<\/p>\n\n\n\n<p>netsh ipsec static exportpolicy file=d:\\MyIPSec.ipsec<\/p>\n\n\n\n<p>\u5bfc\u5165\u7b56\u7565<\/p>\n\n\n\n<p>netsh ipsec static importpolicy file=d:\\MyIPSec.ipsc<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-text-align-center\">\u5239\u9505\uff01\u6492\u82b1<\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001IPsec\u7ec4\u6210\u53ca\u64cd\u4f5c\u57fa\u672c\u6d41\u7a0b IP\u5b89\u5168\u7b56\u7565\u5217\u8868\uff1a\u7531\u591a\u4e2aIP\u5b89\u5168\u7b56\u7565\u7ec4\u6210 IP\u5b89\u5168\u7b56\u7565\uff1a\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u89c4\u5219\u7684\u7ec4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[49,40,48,47],"_links":{"self":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts\/275"}],"collection":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=275"}],"version-history":[{"count":2,"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts\/275\/revisions"}],"predecessor-version":[{"id":277,"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts\/275\/revisions\/277"}],"wp:attachment":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}