microsoft / microsoft/WSL

WSL 2 mirrored networking breaks NFS mounts (“Connection timed out”)

Open
#12,508 15 comments 11 reactions 0 assignees View on GitHub
needs-attention network
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.2894]

### WSL Version

WSL version: 2.3.26.0 Kernel version: 5.15.167.4-1 WSLg version: 1.0.65 MSRDC version: 1.2.5620 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26100.1-240331-1435.ge-release Windows version: 10.0.26100.2894

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

- [x] WSL 2
- [ ] WSL 1

### Kernel Version

5.15.167.4-microsoft-standard-WSL2

### Distro Version

Ubuntu 22.04.5 LTS

### Other Software

When using WSL 2 mirrored networking mode, any attempt to mount an NFS share from within WSL 2 fails with errors:
```
$ sudo mount -v -t nfs ub-nuc:/home/wpwoodjr /home/wpwoodjr/ub-nuc
mount.nfs: timeout set for Mon Jan 27 13:45:44 2025
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.86.200,clientaddr=192.168.86.41'
mount.nfs: mount(2): Invalid argument
mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=192.168.86.200,clientaddr=192.168.86.41'
mount.nfs: mount(2): Connection timed out
mount.nfs: Connection timed out
```
**Key Observations**
- Mount works from other Linux clients on the same network (e.g., a Raspberry Pi).
- Mount works if I revert WSL 2 to the legacy NAT networking mode.
- Turning off Windows Firewall does not help.
- Pinging or otherwise accessing the NFS server (e.g. rpcinfo -p serverIP) still works, but mount -t nfs … fails.

**Request**
- Fix or provide guidance on how to use mirrored networking with protocols like NFS that may rely on particular port/protocol interactions.
- Alternatively, document known limitations of mirrored networking mode for advanced protocols.

Thank you for looking into this issue!

### Repro Steps

Enable mirrored networking (set networkingMode=mirrored in .wslconfig).
Install NFS client tools in WSL:
```
sudo apt-get update
sudo apt-get install nfs-common
```
Attempt to mount an exported NFS share:
```
sudo mount -v -t nfs serverIP:/path /mnt/test
```
The command eventually returns an error:
```
mount.nfs: mount: Connection timed out
```

### Expected Behavior

The NFS share should mount successfully inside WSL 2, just like it does from a Raspberry Pi or other standard Linux environment on the same LAN.

### Actual Behavior

The mount attempt times out.
No traffic is visibly blocked by the Windows Firewall (which I turned off for testing).
Reverting to non-mirrored networking mode in .wslconfig and restarting WSL immediately fixes the issue.
So it appears mirrored networking specifically interferes with NFS.

### Diagnostic Logs

From wsl client with mirrored networking:
```
$ rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper

$ showmount -e ub-nuc
Export list for ub-nuc:
/home/wpwoodjr 192.168.86.0/24

$ nc -vz ub-nuc 2049
Connection to ub-nuc (192.168.86.200) 2049 port [tcp/nfs] succeeded!

$ sudo mount -v -t nfs ub-nuc:/home/wpwoodjr /home/wpwoodjr/ub-nuc
mount.nfs: timeout set for Mon Jan 27 13:45:44 2025
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.86.200,clientaddr=192.168.86.41'
mount.nfs: mount(2): Invalid argument
mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=192.168.86.200,clientaddr=192.168.86.41'
mount.nfs: mount(2): Connection timed out
mount.nfs: Connection timed out
```

After disabling mirrored networking:
```
$ sudo mount -v -t nfs ub-nuc:/home/wpwoodjr /home/wpwoodjr/ub-nuc
mount.nfs: timeout set for Mon Jan 27 14:44:39 2025
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.86.200,clientaddr=172.24.87.14'
mount.nfs: mount(2): Invalid argument
mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=192.168.86.200,clientaddr=172.24.87.14'

$ ls ub-nuc
Desktop Downloads Music Public Videos linux-dev snap win10.log
Documents ...
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with networkingMode=mirrored in .wslconfig, nfs-common, and the documented mount command, then compare it with legacy NAT networking. Use the supplied rpcinfo, showmount, and nc results to investigate where the NFS mount path differs; done means mirrored networking mounts the export successfully or its NFS limitation is documented.

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
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.