Created
February 6, 2022 21:42
-
-
Save saade/d0810d7d25193c37d600cc74ef06aa1d to your computer and use it in GitHub Desktop.
Fix WSL ethernet connection.
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
============================================================================= | |
FIX WSL2 NETWORKING IN WINDOWS 10 | |
============================================================================= | |
cmd as admin: | |
wsl --shutdown | |
netsh winsock reset | |
netsh int ip reset all | |
netsh winhttp reset proxy | |
ipconfig /flushdns | |
Windows Search > Network Reset | |
Restart Windows | |
----------------------------------------------------------------------------- |
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
# Fix network issues | |
# Delete auto-generated files | |
[root@PC-NAME user]# rm /etc/resolv.conf || true | |
[root@PC-NAME user]# rm /etc/wsl.conf || true | |
# Enable changing /etc/resolv.conf | |
# Enable extended attributes on Windows drives | |
[root@PC-NAME user]# cat <<EOF > /etc/wsl.conf | |
[network] | |
generateResolvConf = false | |
[automount] | |
enabled = true | |
options = "metadata" | |
mountFsTab = false | |
EOF | |
# Use google nameservers for DNS resolution | |
[root@PC-NAME user]# cat <<EOF > /etc/resolv.conf | |
nameserver 8.8.8.8 | |
nameserver 8.8.4.4 | |
EOF | |
Exit Linux WSL | |
cmd as admin: | |
wsl --shutdown | |
netsh winsock reset | |
netsh int ip reset all | |
netsh winhttp reset proxy | |
ipconfig /flushdns | |
Windows Search > Network Reset | |
Restart Windows |
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
https://github.com/microsoft/WSL/issues/5336 |
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
New-NetFirewallRule -DisplayName "WSL allow in" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment