Simulink on Windows 11 cannot talk to WSL2 app over UDP sockets

29 views (last 30 days)
Hi,
I'm running a Simulink model on Windows 11 Pro that has "UDP Send" blocks. The "UDP Send" block will send UDP packets to the address and port you specify. I am trying to communicate from an executing Simulink model over UDP to a simple UDP client running on WSL2. My WSL2 system is configured for mirrored networking with loopback addressing enabled. However, I cannot receive any packets on my WSL2 UDP client, although when I run the exact same program ported to Windows it works perfectly fine. I can send UDP packets manually from Windows 11 to WSL2 on the command line in PowerShell, so I know the network path is fine. Something about the Simulink UDP implementation is unusual in that is does not send UDP packets to sockets in my WSL2 environment. I have tried so many things (using physical IP address, broadcast, loopback, etc.) and I have disabled checksums in WSL2 and temporarily turned off the both the Windows Defender firewall and Hyper-V firewall. Nothing works. Anyone have any ideas?
Thanks,
-Luke

Answers (1)

Luke
Luke on 27 Oct 2025 at 15:25
Moved: Walter Roberson on 27 Oct 2025 at 16:51
In case anyone is interested, I looked into this further and determined the root cause is due to oversized UDP packets not being delivering from Windows host to WSL2. The packets are essentially dropped for no reason, maybe MTU differences or related issues. I was unable to find a solution or workaround. It's not a firewall issue, I think it's a limitation or bug with WSL2 mirrored networking mode. Cheers
-Luke

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!