WSL icon indicating copy to clipboard operation
WSL copied to clipboard

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

Open wpwoodjr opened this issue 11 months ago • 15 comments

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  ...

wpwoodjr avatar Jan 27 '25 19:01 wpwoodjr

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

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 If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please 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:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar Jan 27 '25 19:01 github-actions[bot]

Logs attached

WslLogs-2025-01-27_15-28-25.zip

wpwoodjr avatar Jan 27 '25 20:01 wpwoodjr

Diagnostic information
.wslconfig found
Detected appx version: 2.3.26.0

github-actions[bot] avatar Jan 27 '25 20:01 github-actions[bot]

Just want to confirm that I am seeing the same thing after upgrading wsl with bridged mode being deprecated.

NFS is completely broken in wsl2 with mirrored networking, works fine on my other Linux boxes.

Info:

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

Logs: WslLogs-2025-01-31_18-26-08.zip

Networking Logs: WslNetworkingLogs-2025-01-31_18-28-01.zip

kpatdev avatar Jan 31 '25 23:01 kpatdev

same issue

ljcbaby avatar Feb 01 '25 06:02 ljcbaby

BUMP. Is there any work being done to address this? To deprecate Bridged mode and not have a working replacement (at least not working with NFS as it previously did) in Mirrored mode is a shame.

Pretty much every file I want to access within wsl2 is located on my Unraid NAS so wsl2 is just dead for me until/if someone comes up with a fix for this weird issue.

kpatdev avatar Feb 08 '25 21:02 kpatdev

Is anyone able to get this to work with even NAT networking? Seems like a firewall issue because I can't get it to work with NAT networking either.

sudo mount -v NFS_HOST_IP:/mnt/user/data/media/movies /mnt/nfs/movies
mount.nfs: timeout set for Tue Feb 11 15:57:23 2025
mount.nfs: trying text-based options 'vers=4.2,addr=NFS_HOST_IP,clientaddr=NFS_CLIENT_IP'
mount.nfs: mount(2): Invalid argument
mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=NFS_HOST_IP,clientaddr=NFS_CLIENT_IP'
mount.nfs: mount(2): Operation not permitted
mount.nfs: trying text-based options 'addr=NFS_HOST_IP'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying NFS_HOST_IP prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying NFS_HOST_IP prog 100005 vers 3 prot UDP port 42220
mount.nfs: mount(2): Permission denied
mount.nfs: Operation not permitted

Does this have something to do with Hyper-V firewall? Bridged mode this was working fine but with NAT or mirrored I am unable to get NFS mounts to work. Sigh.


Edit: I was able to get nfs mounts to work using "insecure" option on the NFS host with NAT networking (I'm assuming this works for mirrored as well). Bridged didn't require this since there was no port translation.

So we're back to square one of broken NFS on WSL2 with mirrored networking (where there should be no port translation going on).

kpatdev avatar Feb 11 '25 21:02 kpatdev

BUMP. Is there any work being done to address this? To deprecate Bridged mode and not have a working replacement (at least not working with NFS as it previously did) in Mirrored mode is a shame.

Pretty much every file I want to access within wsl2 is located on my Unraid NAS so wsl2 is just dead for me until/if someone comes up with a fix for this weird issue.

Dude, you maybe try smb +cifs.

wikiliu avatar Feb 26 '25 09:02 wikiliu

BUMP. Is there any work being done to address this? To deprecate Bridged mode and not have a working replacement (at least not working with NFS as it previously did) in Mirrored mode is a shame.

Pretty much every file I want to access within wsl2 is located on my Unraid NAS so wsl2 is just dead for me until/if someone comes up with a fix for this weird issue.

Dude, you maybe try smb +cifs.

Yeah I'm generally moving over to SMB/CIFS but I may need some additional tuning as the performance at this time as not as good as NFS.

kpatdev avatar Feb 26 '25 14:02 kpatdev

I think the socket opened by the kernel will fail. I tested the handshake using nc with a privileged source port, and the handshake succeeded. However, when capturing the actual handshake, tcpdump did not show the SYN+ACK, while Wireshark did.

# nc -zvp 714 192.168.0.100 2049
Connection to 192.168.0.100 2049 port [tcp/nfs] succeeded!

kedama222 avatar Mar 16 '25 03:03 kedama222

It is the same for me. Since I mount my WSL home directory over NFS along with various only-available-over-NFS management shares, this effectively renders current WSL useless to me until we have a fix for this; until then, back to 2.4.13 I go.

What was the problem with bridged mode in the first place?

cerebrate avatar Mar 26 '25 04:03 cerebrate

I was able to get wsl with mirrored mode to connect using the following command, not sure why but looks like the issue is with it using trusted ports below 1024

sudo mount -t nfs -o noresvport NFS_HOST_IP:/mnt/share/nfs /mnt/nfs_share

r-teller avatar Mar 30 '25 22:03 r-teller

Adding noresvport to the options in /etc/auto.net resolved this for autofs as well.

igorkolker avatar Aug 03 '25 15:08 igorkolker

bolte@Personal:~$ sudo mount -t nfs -o noresvport 192.168.0.20:/datastore /mnt/datastore mount.nfs: Operation not permitted

This is the error I get when I try. It's the same problem, pings work, showmount works, connecting to NFS just hangs if I don't use -o noresvport

BolteDev avatar Sep 02 '25 21:09 BolteDev

@r-teller

You saved my hours! I have to use mirrored network expose ComfyUI API endpoint. I am using docker and docker-compose.yaml, just need to add noresvport accordingly.

guhuajun avatar Nov 09 '25 22:11 guhuajun