Skip to content

oratual/WslNetworkFixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WSL Network Fixer

License: MIT PowerShell WSL2

Fix WSL2 network connectivity issues with Windows host. Solves the common ERR_NETWORK_ACCESS_DENIED error when accessing WSL2 services from Windows.

🚀 Quick Start

  1. Download the latest release
  2. Run install.bat as Administrator
  3. Restart WSL: wsl --shutdown
  4. Access your services via localhost!

✅ Verified Working Solution

This solution has been tested and confirmed working on Windows 11 with WSL2 v2.5.7.0 (June 2025).

See VERIFIED-SOLUTION.md for detailed test results.

🔧 What it does

This tool configures WSL2 with networkingMode=mirrored, which:

  • Shares the same IP address between WSL2 and Windows
  • Eliminates NAT issues
  • Allows localhost to work seamlessly
  • No more port forwarding needed!

📋 Requirements

  • Windows 10/11 with WSL2
  • PowerShell 5.0 or higher
  • Administrator privileges (for first-time setup)

🛠️ Installation

Option 1: Automated (Recommended)

install.bat

Option 2: Manual

Create/edit %USERPROFILE%\.wslconfig:

[wsl2]
networkingMode=mirrored
memory=4GB
processors=2
autoMemoryReclaim=gradual
sparseVhd=true

📖 Usage

After installation:

  1. Restart WSL: wsl --shutdown
  2. Start your service in WSL (e.g., npm run dev)
  3. Access from Windows: http://localhost:3000

🐛 Troubleshooting

Still getting ERR_NETWORK_ACCESS_DENIED?

  1. Ensure WSL is updated: wsl --update
  2. Restart Windows completely
  3. Check Windows Firewall settings
  4. Run diagnose.bat for detailed troubleshooting

Performance Issues?

Adjust memory allocation in .wslconfig:

memory=8GB  # Increase if needed

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

👏 Acknowledgments

  • Microsoft WSL Team for the networkingMode=mirrored feature
  • Community members who reported and helped solve network issues
  • Contributors to this project

📊 Stats

GitHub stars GitHub forks


Made with ❤️ by Oratual

About

Fix WSL2 network connectivity issues with Windows host. Solves ERR_NETWORK_ACCESS_DENIED.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors