Connecting Camera through WSL on Windows Host

General Information

  • Product: C57-4/1850-M
  • Serial Number: 232131
  • Ensenso SDK Version: 4.3.880
  • Operating System: Ubuntu 24.04 on Windows Host (WSL)

Problem / Question

Hello,

I have successfully installed NxView in WSL and can, for example, create virtual cameras without any issues. The application appears to be functioning normally in this environment.

I am now trying to connect and use a physical camera from within WSL. The camera is detected immediately on the Windows host system; however, it cannot be found in WSL.

To enable network access, I configured WSL to use mirrored networking. In NxTree, the correct network adapter (where the pyhsical camera is connected) appears and has the same configuration as on the Windows host, including: CableConnected = True,ReversePathFiltering = False, Active = True, ValidIPAdress = True

Despite this, the camera cannot be discovered. The Network Wizard is also unable to find the device, even when using the Blind Search mode with the camera’s MAC address specified manually.

Do you have any experience using NxView or Ensenso cameras within WSL, or could you provide any suggestions regarding additional network settings or configuration steps that may be required?

Thank you very much for your support and assistance.

Kind regards

Hello,

WSL is not supported, the discovery mechanism is L2 based, WSL does not connect directly to the Ethernet NIC but has a few layers on top, you can use our Windows release directly. As an alternative doing a NIC PCIe Pass-trough in a VM should work.

Regards,
Miguel

Hello Miguel,

Thank you for your fast reply.

Unfortunately, our application environment requires us to use a Python container running in WSL, where we would like to test and validate our image processing algorithms with a real camera. Therefore, using the native Windows release is not a viable option in our case.

If I understand your explanation correctly, the limitation primarily affects the discovery mechanism, as it relies on Layer 2 network communication. Since we already know the camera’s IP address and the device is reachable from within WSL through ping, would it be possible to establish a connection manually without relying on the discovery process?

Alternatively, are you aware of any workaround or supported approach that would allow access to a physical Ensenso camera from a WSL environment?

Thank you very much for your assistance.

Kind regards,

Hello,

Discovery is required by the NxLib, there is no way to connect directly via IP only.

  • You could try setting up an mDNS reflector (and/or a UDP broadcast relay) reachable from WSL and the Windows host.
  • Move your container to a Linux machine or VM with a PCIe NIC passthrough.
  • Have a look at the Firewall Configuration page in our manual for the ports/protocols involved.

Keep in mind that since WSL is not supported, there is no guarantee that any of this will work.

Regards,
Miguel

Hello,

I was digging a bit deeper and if you only need to run your Python code in WSL, access the camera remotely via NxLibRemote.

Run a small host app on Windows that opens the camera (or use ensenso-cli to launch a server), then connect from WSL via the NxLibRemote interface, it offers the same API as the NxLib, just over TCP/HTTP.

Regards,
Miguel

Hello Miguel,
Thank you for your suggestion regarding NxLibRemote.
I was able to start an NxLib server using:
ensenso-cli server launch --port 24000

The server is reachable locally on the Windows host:
Test-NetConnection localhost -Port 24000

However, from WSL I cannot reach the server:
socket.create_connection((“172.18.160.1”, 24000)) times out and socket.create_connection((“localhost”, 24000)) returns connection refused.
It appears that the NxLib server launched via ensenso-cli only listens on localhost.

Do you have any suggestions? Maybe we mixed something up.

Kind regards

Hello,

The server ensenso-cli starts should listen on all interfaces, double check your firewall configuration. If you are using Windows 11 try the Mirrored Networking Mode, this could potentially solve your issues.

Regards,
Miguel

We have a development environment that we run in WSL, and have managed to connect to cameras here, even if its not working perfectly and with slow communication.

I am using mirrored network, but also had to set the network category to private:
E.g.
Set-NetConnectionProfile -InterfaceAlias “Ethernet 2” -NetworkCategory “Private”

Thank you both for your help!

I could get it running.
Like you mentioned, I used mirrored network settings and set the Connection Profile of the interface to Private. I additionally had to use hostAddressLoopback=true in my .wslconfig.

My .wslconfig:

  • [wsl2]
    networkingMode=mirrored
    firewall=false
    dnsTunneling=false

  • [experimental]
    hostAddressLoopback=true