microsoft / microsoft/WSL

Binding WSL2 ports to a different IP address in 127.0.0.0/8 range

Open
#5,732 12 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

Is your feature request related to a problem? Please describe.
If I have webserver or a database running on specific port in Windows, I cannot start server in WSL that listens that same port because it is already in use. For example, if I have IIS running on port 80, I cannot start php server inside WSL with php -S 0.0.0.0:80.

There are 16777216 addresses in the loopback range and apps always wants to use 127.0.0.1 and then listen on a random, hopefully unused port. Why not use a different IP?

Can we have an option to specify a custom IP in the loopback range?

Describe the solution you'd like
A configuration option to specify a custom IP address in the 127.0.0.0/8 range for mapping WSL ports

Describe alternatives you've considered
Using a different ports between host and guest or binding host's processes to something other than 127.0.0.1 so that WSL can use 127.0.0.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or implementation entry points are identified. Start by locating WSL's port-mapping and configuration entry points, then define how a custom address in the 127.0.0.0/8 range should be configured and verify that Windows and WSL services can share a port without conflicts.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
networking, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.