Not finding target hardware working in WSL - is it an ip address problem?

Working with a Windows host PC running VS Code,
Torizon IDE sets up a WSL development environment and creates a project.
But it is not discovering the development board (Apalis) plugged in to the same network.
Is it because WSL is not using the host pc ip address
TEZI on the dev board shows ip address 10.222.222.191/24
Host PC ip address is 10.222.222.192
But in WSL the ip addresss shows as 172.24.160.1
Do I need to force the WSLto use the host IP and if so how?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for reaching out regarding your networking issue with the Torizon IDE Extension and WSL on your Windows host.

Your observation is correct: WSL2 creates its own virtual network interface, so it assigns a different IP address (e.g., 172.24.160.1), which is not the same as your host PC’s IP address on your LAN (10.222.222.192). This difference can prevent your Apalis board from discovering/connect to the development services running on your PC.

How to resolve this:

You do not need to force WSL to use your host IP. Instead, you should instruct the Torizon IDE Extension to use your actual host PC IP address for proper communication. You can do this by overriding the automatically detected IP:

Steps:

  1. Open your project in VS Code.

  2. Navigate to your project’s .vscode/settings.json file.

  3. Add or update the following setting to match your host PC’s IP address (10.222.222.192):

    {
      "torizon.overwriteHostIp": "10.222.222.192"
    }
    

    Alternatively, ensure the host_ip property is set accordingly in the same file.

  4. Save the changes and try re-discovering or connecting to the development board.

This configuration instructs the IDE extension to use your Windows host’s LAN IP when it communicates with the Toradex board, resolving the network reachability issue between WSL2 and your Apalis board.

For more information, you can refer to the following documentation:

Let me know if you need further assistance!

Best regards, Toradex AI Assistant.

The network uses DHCP to assign ip addresses when devices connect. Therefore the address may change. Is there a way to automatically set to use the host ip rather than hardcoding with “torizon.overwriteHostIp”?

Trying to set the target ip address directly I get the error “ECONNREFUSED”

Greetings @Gideon1,

But in WSL the ip addresss shows as 172.24.160.1
Do I need to force the WSLto use the host IP and if so how?

This seems normal for WSL on my setup in WSL if I try to get the IP address from within the WSL Linux distro I get 172.27.210.160. Even though my network is a standard 192.168.1.XXX.

Though VSCode can detect and connect to my devices as expected.

The network uses DHCP to assign ip addresses when devices connect. Therefore the address may change. Is there a way to automatically set to use the host ip rather than hardcoding with “torizon.overwriteHostIp”?

Wait are you saying the VSCode extension is not properly detecting the host IP of the machine VSCode is running on? Does your host machine have multiple network interfaces? If yes, then that would explain why it can’t detect your target device if it’s not searching on the correct network interface.

The extension tries to determine what is the default network interface, but can be confused if there are multipe. That is what the torizon.overwriteHostIp setting is for if the extension is not choosing the right network interface for the host. Right now this is the only mechanism to set the host IP to something other than the default deteciton.

Trying to set the target ip address directly I get the error “ECONNREFUSED”

Okay, so now this is in addition to the whole detection issue correct? Basically even ignoring the detection problem if you force the VSCode extension to connect to the device via IP address that fails as well.

Are there any other logs or is this the only message? As a sanity test from within your WSL Linux distro can you manually SSH to the target device via the IP address?

Best Regards,
Jeremias

My mistake. :confounded:
SoM had been reset to have Torizon Easy Installer on it not a working Torizon OS.

Solution was to (re)install a Torizon OS image now the device is properly detected.

Well I’m glad the issue was simple to resolve at least.

Best Regards,
Jeremias