skorhone / wsl2-custom-network Goto Github PK
View Code? Open in Web Editor NEWThis project contains powershell scripts for creating custom network for WSL2
This project contains powershell scripts for creating custom network for WSL2
I have been using WSL2 for 1 year in an corporate/enterprise setting. I can't thank-you enough, perhaps got a lead on a solution for a BILLION DOLLAR T-REX LEVEL BUG that first came out a long time ago with WSL1. WSL2 could so easily have been a flagship app of Microsoft, but for networking it SUCKS so bad many bigger companies forbid WSL2 use, WSL2 networking just fails to ping network dies randomly. Many frustrated users who hold down real jobs get so mad with WSL2 teams programmers who then get "hurt feelings" this problems is for sure beyond "hurt feelings" ALREADY.
I am a key Linux developer right down to my code running on every mobile network.
So me coding a C++ fix for Microsoft's by far most ignored bug is hilarious!
I have tried about 30 different approaches to the fix but the way WSL2 configures networks is broken at the design level, the
design sucks. WSL1 and WSL2 teams have closed THOUSANDS OF BUG REPORTS, ALL 100% CRITICAL (not Major) and all UNFIXED. Yup thousands! So I comment on them closing it: "You are a genius, so glad you closed this bug as it therefor must be fixed magically with no code changes, you fixed a 13 year old CRITICAL bug."
The following bruit force and no intelligence script works RANDOMLY, but your one is intelligent.
echo "Restarting WSL Service"
wsl --shutdown
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
A primary symptom is if you manage to get WSL2 networks working the PC going to sleep breaks it but not other apps networks.
Sadly corporate/enterprise IT prevents PowerShell scripts from running even in admin mode in sensitive organisations (actually I
approve of PowerShell being blocked as it is UNTRUSTED) - but ironically you can cut and past scripts (your nice script) into ADMIN PowerShell directly and it works. Hence I'm taking your solution and coding it in C++ but also creating another tool that displays the network configs (for randomly working WSL2 enterprise networks that work 1 in 8 reboots - hitting by accident an authorised subnet). 7 out of those 8 reboots triggering major security alerts - YA WAY-TO-GO WSL2 and Microsoft for your MAD and RANDOM
network settings for WSL2 that violate security in a massive way that encourages IT to open the IP doors too wide to make buggy-wuggy-WSL2 work.
Windows applications work over the network just fine, but corporate/enterprise WSL2 Networks fail and it SUCKS!
Microsoft's most valued customers get this bug the most, and it's worse as IT prevent PowerShell scripts running even in admin mode.
Your PowerShell fix is based off of some C or C++ code from here and that is a nice start. So thank-you.
So I found an existing HCN powershell module... https://www.powershellgallery.com/packages/HNS/0.2.4
What's the difference?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.