Created
January 26, 2023 18:22
-
-
Save Postroggy/ae293440504695f587544e90d8514691 to your computer and use it in GitHub Desktop.
WSL2 不能正确分配IP地址的解决方法。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Restarting WSL Service" | |
| Restart-Service LxssManager | |
| echo "Restarting Host Network Service" | |
| Stop-Service -name "hns" | |
| Start-Service -name "hns" | |
| echo "Restarting Hyper-V adapters" | |
| Get-NetAdapter -IncludeHidden | Where-Object ` | |
| {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} ` | |
| | Disable-NetAdapter -Confirm:$False | |
| Get-NetAdapter -IncludeHidden | Where-Object ` | |
| {$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} ` | |
| | Enable-NetAdapter -Confirm:$False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment