Skip to content

Port Conflict Between Multiple WSL2 Systems in Bridged Networking Mode #12331

Open
@try-agaaain

Description

@try-agaaain

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:

[wsl2]
networkingMode=bridged # Bridged mode
vmSwitch=my-wsl-switch # Name of the virtual switch created in Hyper-V
ipv6=true # Enable IPv6

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:

$ sudo systemctl start ssh
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xeu ssh.service" for details.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions