-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port Conflict Between Multiple WSL2 Systems in Bridged Networking Mode #12331
Comments
Logs are required for review from WSL teamIf this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. How to collect WSL logsDownload and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done. If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here Once completed please upload the output files to this Github issue. Click here for more info on logging View similar issuesPlease view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it! Open similar issues:
Closed similar issues:
|
@try-agaaain you just hit one of the WSL2 limits! All WSL instances are sharing the same network namespace. It's by design. |
Are there any related posts that explain why this design was chosen? Is there a possibility of adding a feature in the future where different WSL instances have independent networks? |
Sad news:
Bridged mode works very well as it is now in WSL-Version: 2.4.5.0 |
Is your feature request related to a problem? Please describe.
I have installed two WSL2 systems: Ubuntu-22.04 and Ubuntu-24.04. I want to configure independent networking for both systems, so I switched to a bridged networking mode with the .wslconfig file:
The
my-wsl-switch
is a virtual switch I created in Hyper-V, and it works correctly.I assigned static IP addresses to the two WSL2 systems using netplan (e.g., 192.168.123.100 and 192.168.123.101).
However, when I start the SSH service on both systems, only one system's SSH service can run successfully. If I try to start the SSH service on the other system, it fails with the following error:
I suspect that even in bridged mode, the two WSL2 systems might be sharing the same IP stack or network resources, causing a conflict where only one system can use port 22 at a time.
Describe the solution you'd like
I would like each WSL2 system to have truly independent IP addresses and networking, such that services like SSH running on standard port 22 can coexist without conflicts.
Describe alternatives you've considered
I considered using Docker to create separate containers for each environment, but Docker is too cumbersome for me. I prefer working with WSL due to the simplicity of the file system and ease of access compared to Docker. Therefore, I am looking for a way to achieve network isolation for each WSL2 system without switching to Docker.
Additional context
The Windows version I use is Windows 11 23H2.
The text was updated successfully, but these errors were encountered: