1. Home
  2. Knowledge Base
  3. Incoming Connections on WSL

Incoming Connections on WSL

If you have followed the instructions for installing Nova under WSL, you may have noticed that you cannot create inbound network connections to your Nova instance. This means that you cannot, for example, create a Modbus Slave and connect to it from an external device, nor run an OPC UA Server and browse its contents. This is because WSL’s default behavior is to use a dedicated virtual network adapter that provides only outbound NAT.

If you want to accept inbound connections to Nova, you must bind the WSL subsystem to a new virtual network adapter that is bridged with an external adapter, thereby allowing it to obtain its own IP address on which connections can be received. Note that this change will impact all your WSL distros, so if you are using WSL for other purposes, you may wish to live with the limitation.

Creating the Adapter

To create the virtual network adapter, you must first have the Hyper-V role installed on your machine. If Hyper-V is not present, bring up the Windows Features tool by typing Features into the Start Menu’s search box. Select the Hyper-V checkbox and allow Windows to perform the update. You may then open the Hyper-V Manager and create a virtual switch called (for example) External and bound to a physical Ethernet adapter.

Configuring WSL

To instruct WSL to use the adapter, run Notepad and create a file that contains the following text:

[wsl2]
networkingMode=bridged
vmSwitch=External

Save this file as %USERPROFILE%.wslconfig

Run wsl --shutdown from a command prompt to force WSL to update.

Was this article helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Support?

Can't find the answer you're looking for?
Contact Support
Scroll to Top