{"id":135,"date":"2023-11-14T00:46:04","date_gmt":"2023-11-13T16:46:04","guid":{"rendered":"https:\/\/blog.maoyulong.club\/?p=135"},"modified":"2023-11-14T00:46:09","modified_gmt":"2023-11-13T16:46:09","slug":"%e5%85%b3%e4%ba%8ewindows%e8%8e%b7%e5%8f%96%e5%a4%9a%e4%ba%8e%e4%b8%80%e4%b8%aaipv6%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.maoyulong.club\/?p=135","title":{"rendered":"\u5173\u4e8ewindows\u83b7\u53d6\u591a\u4e8e\u4e00\u4e2aipv6\u7684\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p>\u8fd0\u8425\u5546\u4f1a\u5728\u6bcf\u5929\u7684\u4e00\u4e2a\u65f6\u95f4\u8fdb\u884c\u91cd\u65b0\u62e8\u53f7\uff0c\u8fd9\u79cd\u60c5\u51b5\u5bf9\u4e8elinux\u6765\u8bf4\u53ef\u80fd\u6ca1\u95ee\u9898\uff0c\u4f46\u662fwindows \u4e0d\u4f1a\u91ca\u653eipv6\u5730\u5740\uff0c\u51fa\u73b0\u5730\u5740\u5e76\u5b58<\/p>\n<p>\u5bf9\u4e8e\u4e34\u65f6\u5730\u5740\u8fc7\u591a\u7684\u60c5\u51b5\u6765\u8bf4\uff0c\u5173\u95edipv6\u4e34\u65f6\u5730\u5740\u53ef\u80fd\u4f1a\u8d77\u5230\u4f5c\u7528\uff08\u4f46\u662f\u8fd9\u4f1a\u6d89\u53ca\u5230\u4e00\u4e9b\u5b89\u5168\u95ee\u9898\uff09\uff1a<\/p>\n<pre><code class=\"language-powershell\" lang=\"powershell\">netsh interface ipv6 set privacy state=disabled store=active\nnetsh interface ipv6 set privacy state=disabled store=persistent\nnetsh interface ipv6 set global randomizeidentifiers=disabled store=active\nnetsh interface ipv6 set global randomizeidentifiers=disabled store=persistent\n<\/code><\/pre>\n<p>\u5982\u679c\u8def\u7531\u662f\u53ef\u63a7\u7684\uff0c\u5c06RA interval\u8c03\u6574\u5230\u4e00\u4e2a\u8f83\u4f4e\u7684\u503c\u5373\u53ef\u3002<\/p>\n<p>\u4f46\u662f\u6709\u53ef\u80fd\u4f1a\u51fa\u73b0\uff0c\u4e0d\u4ec5\u662f\u4e34\u65f6\u5730\u5740\uff0cipv6\u5730\u5740\u672c\u8eab\u4e5f\u88ab\u8fc7\u671f\u672a\u91ca\u653e\u7684\u5730\u5740\u62a2\u5360\uff0c\u8fd9\u65f6\u5019\u53ef\u4ee5\u76d1\u63a7\u7f51\u53e3\u7684ipv6\u6570\u91cf\uff0c\u8d85\u8fc7\u5373\u91cd\u542f\u534f\u8bae\u6808\u3002<\/p>\n<p>\u7f16\u5199powershell\u811a\u672c\u5982\u4e0b(\u4e2a\u6570\u4e3a2\u7684):<\/p>\n<pre><code class=\"language-powershell\" lang=\"powershell\"># Replace 'Ethernet' with your interface name\n$interface = '\u4ee5\u592a\u7f51\u5b9e\u4f8b 0'\n\n$ipv6Addresses = Get-NetIPAddress -InterfaceAlias $interface -AddressFamily IPv6\n\nif ($ipv6Addresses.Count -gt 2) {\n    Write-Output \"More than one IPv6 address detected. Restarting IPv6...\"\n\n    # Disable IPv6\n    Set-NetAdapterBinding -Name $interface -ComponentID ms_tcpip6 -Enabled $false\n\n    # Enable IPv6\n    Set-NetAdapterBinding -Name $interface -ComponentID ms_tcpip6 -Enabled $true\n} else {\n    Write-Output \"Only one IPv6 address detected. No action needed.\"\n}\n<\/code><\/pre>\n<p>\u6216\u8005\u53ef\u4ee5\u7f16\u5199cmd\u547d\u4ee4\uff0c\u4f46\u662f\u53ea\u80fd\u91cd\u542f\u7f51\u5361\uff1a<\/p>\n<pre><code class=\"language-cmd\" lang=\"cmd\">@echo off\nsetlocal enabledelayedexpansion\n\n:: Replace 'Ethernet' with your interface name\nset \"interface=\u4ee5\u592a\u7f51\u5b9e\u4f8b 0\"\n\nfor \/f \"delims=\" %%i in ('netsh interface ipv6 show address \"%interface%\" ^| find \/i \"\u5730\u5740 \" \/c') do set count=%%i\n\necho %count%\nif %count% GTR 2 (\n    echo More than two IPv6 address detected. Restarting the network interface...\n    :: Disable IPv6\n    Set-NetAdapterBinding -Name $interface -ComponentID ms_tcpip6 -Enabled $false\n\n    :: Enable IPv6\n    Set-NetAdapterBinding -Name $interface -ComponentID ms_tcpip6 -Enabled $true\n) else (\n    echo Only two IPv6 address detected. No action needed.\n)\n\nendlocal\n<\/code><\/pre>\n<p>\u8fd9\u4e4b\u540e\uff0c\u5c06\u8fd9\u4e2a\u811a\u672c\u6dfb\u52a0\u5230windows\u5b9a\u65f6\u4efb\u52a1\u4e2d\uff0c\u5728\u8ba1\u7b97\u673a\u7ba1\u7406-&gt;\u7cfb\u7edf\u5de5\u5177-&gt;\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f \u4e2d\uff0c\u8fdb\u884c\u5982\u4e0b\u6dfb\u52a0<\/p>\n<p>\u52fe\u9009 \u5b89\u5168\u9009\u9879-&gt;\u4e0d\u7ba1\u7528\u6237\u662f\u5426\u767b\u5f55\u90fd\u8981\u8fd0\u884c\/\u4f7f\u7528\u6700\u9ad8\u6743\u9650\u8fd0\u884c<\/p>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/blog.maoyulong.club\/wp-content\/uploads\/2023\/11\/\u5c4f\u5e55\u622a\u56fe-2023-11-14-002518.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/blog.maoyulong.club\/wp-content\/uploads\/2023\/11\/\u5c4f\u5e55\u622a\u56fe-2023-11-14-002518.png\" \/><\/p><\/noscript>\n<p>\u89e6\u53d1\u5668\u53ef\u6309\u5982\u4e0b\u914d\u7f6e<\/p>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/blog.maoyulong.club\/wp-content\/uploads\/2023\/11\/\u5c4f\u5e55\u622a\u56fe-2023-11-14-003118.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/blog.maoyulong.club\/wp-content\/uploads\/2023\/11\/\u5c4f\u5e55\u622a\u56fe-2023-11-14-003118.png\" \/><\/p><\/noscript>\n<p>\u64cd\u4f5c \u542f\u52a8\u7a0b\u5e8f<\/p>\n<p>\u7a0b\u5e8f\u6216\u811a\u672c\u9009\u62e9 C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe<\/p>\n<p>\u6dfb\u52a0\u53c2\u6570 -command \". 'c:\\test.ps1'\"<\/p>\n<p><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/blog.maoyulong.club\/wp-content\/uploads\/2023\/11\/\u5c4f\u5e55\u622a\u56fe-2023-11-14-003558.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  \/><\/p >\n<noscript><img decoding=\"async\" src=\"https:\/\/blog.maoyulong.club\/wp-content\/uploads\/2023\/11\/\u5c4f\u5e55\u622a\u56fe-2023-11-14-003558.png\" \/><\/p><\/noscript>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd0\u8425\u5546\u4f1a\u5728\u6bcf\u5929\u7684\u4e00\u4e2a\u65f6\u95f4\u8fdb\u884c\u91cd\u65b0\u62e8\u53f7\uff0c\u8fd9\u79cd\u60c5\u51b5\u5bf9\u4e8elinux\u6765\u8bf4\u53ef\u80fd\u6ca1\u95ee\u9898\uff0c\u4f46\u662fwindows \u4e0d\u4f1a\u91ca\u653eipv6\u5730\u5740\uff0c\u51fa\u73b0\u5730\u5740\u5e76\u5b58 &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-135","post","type-post","status-publish","format-standard","hentry","category-9"],"_links":{"self":[{"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=\/wp\/v2\/posts\/135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=135"}],"version-history":[{"count":1,"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":136,"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions\/136"}],"wp:attachment":[{"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.maoyulong.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}