microsoft / microsoft/WSL

Mirrored networking: Wrong source address selection for multi-IP interfaces

Open
#13,505 4 comments 0 reactions 0 assignees View on GitHub
network question
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.26100.6584]

### WSL Version

2.6.0.0

### Are you using WSL 1 or WSL 2?

- [x] WSL 2
- [ ] WSL 1

### Kernel Version

6.6.87.2-1

### Distro Version

Ubuntu 22.04

### Other Software

_No response_

### Repro Steps

1. Configure Windows interface with IPs: 192.168.9.147/24 and 192.168.101.147/24
2. Add Windows route: 192.168.102.0/24 via 192.168.101.238
3. In WSL2: ping 192.168.101.238
4. Observe: Source address is incorrectly 192.168.9.147 instead of 192.168.101.147

### Expected Behavior

WSL2 should select source address from the same subnet as the next-hop.

### Actual Behavior

WSL2 creates route without source hint:
`192.168.101.238 dev eth3 scope link`
Should be:
`192.168.101.238 dev eth3 src 192.168.101.147 scope link`

### Diagnostic Logs

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the WSL2 mirrored-networking scenario using the listed interface addresses, route, and ping command, then inspect the generated route and selected source address. The work is done when the route to 192.168.101.238 includes source 192.168.101.147 and traffic uses that address.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, ubuntu
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.