Hex-Rays License Server on WSL

Introduction

This tutorial will guide you through the steps to configure Windows Subsystem for Linux (WSL) to install and use the new Hex-Rays license server in a WSL Ubuntu instance.

You will learn how to:

  1. Install the Hex-Rays license server and verify it's up and running.

Prerequisites

To follow this tutorial:

  • Ensure you have an up-to-date Windows Subsystem for Linux with an installed Ubuntu distribution. If not, refer to this guide for installation instructions.

  • You should use Windows 11 version 22H2 or later, as we will enable the WSL mirrored mode networking.

WSL configuration

Mirrored mode

Enabling mirrored mode configures WSL to an entirely new networking architecture that replicates (mirrors) your Windows network interfaces within the Linux environment.

Create WSL configuration file

  1. To enable this mode, create a new file named %UserProfile%\\.wslconfig.

  2. Add the following lines to the file:

[wsl2]
networkingMode = mirrored
  1. Save the file.

Verify mirrored network configuration

  1. First, make sure that all the WSL instances are stopped and restart a fresh Ubuntu instance:

wsl --shutdown
wsl
  1. In the WSL instance, type:

ip a

Examples comparison

On our current machine, we have the following output:

...
10: eth7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether f4:7b:09:3f:7c:44 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.131/24 brd 192.168.1.255 scope global noprefixroute eth7
       valid_lft forever preferred_lft forever
    inet6 fe80::b944:ac9b:bd85:2a6c/64 scope link nodad noprefixroute
       valid_lft forever preferred_lft forever
...

On Windows, ipconfig /all output gives matching details:

...
Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Wi-Fi 6E AX210 160MHz
   Physical Address. . . . . . . . . : F4-7B-09-3F-7C-44
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::b944:ac9b:bd85:2a6c%12(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.131(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Wednesday, February 19, 2025 7:35:07 PM
   Lease Expires . . . . . . . . . . : Sunday, February 23, 2025 7:09:58 AM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 150240009
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-0A-D1-50-84-A9-38-6F-0B-65
   DNS Servers . . . . . . . . . . . : 192.168.1.1
   NetBIOS over Tcpip. . . . . . . . : Enabled
...

When properly configured, the wireless interface is "mirrored" in the WSL Ubuntu instance, i.e., the Windows machine and the WSL Ubuntu instance share the Wifi interface IP and MAC address. In fact, all the Windows interfaces are mirrored, but we focus on wireless network interface.

Systemd

The Hex-Rays license server installation supports configuring the server as a systemd service. To use this feature, you should enable systemd in your WSL instance.

  1. Start a WSL Ubuntu instance as root:

wsl -u root
  1. Use your preferred editor to create or add the following lines to the /etc/wsl.conf file:

[boot]
systemd = true
  1. Execute the following lines:

wsl --shutdown
wsl

Networking

To communicate with the WSL-hosted Hex-Rays license server from the network, you have to know the IP address of your WSL Ubuntu instance as seen by your Windows host.

Use wsl hostname -i command to retrieve the IP address:

wsl hostname -i
127.0.1.1

Setting up port forwarding

To allow external connections to reach the license server, you must forward incoming connections from the Windows host to the Ubuntu instance. This is achieved using the port proxy interface.

In this setup, we forward all connections coming to our Windows host on port 65435 to our license server listening on the default port 65434 in WSL.

  1. In an elevated command prompt, type the following command:

netsh interface portproxy add v4tov4 listenport=65435 listenaddress=192.168.1.131 connectport=65434 connectaddress=127.0.1.1
  1. Verify the result:

netsh interface portproxy show all

Listen on ipv4:             Connect to ipv4:

Address         Port        Address         Port
--------------- ----------  --------------- ----------
192.168.1.131   65435       127.0.1.1       65434

Firewall configuration

Finally, ensure that the Hyper-V firewall allows inbound connections on your port (in this example, 65434).

  1. Execute the following PowerShell command in an elevated command prompt:

New-NetFirewallHyperVRule -Name "H-RLicenseServer" -DisplayName "Hex-Rays License Servr" -Direction Inbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -LocalPorts 65434
  1. If your setup requires it, you might have to open the TCP forwarding port (65435 in our case) in the Windows firewall.

With this final step, the WSL networking configuration is complete.

Running WSL in the background - optional configuration

In a typical scenario, a WSL instance starts at system startup or within a command prompt, however when the command prompt is closed, WSL will silently stop after about a minute. To keep WSL running until it is explicitly stopped with wsl --shutdown, a simple script can be used.

  1. Create a script that executes the following command:

wsl --exec dbus-launch true
  1. To verify if your instance is still running, use the following command:

wsl --list --running
Windows Subsystem for Linux Distributions:
Ubuntu (Default)

Installing the Hex-Rays license server

After your WSL is properly configured, you can go ahead and install the Hex-Rays license server.

The procedure to install the Hex-Rays license server can be found here.

Verify the Hex-Rays license server is up and running

To verify that the Hex-Rays license server is accessible, make the following checks:

  1. Check the network configuration

In our exemplary case, we retrieved the IPv4 address of the Windows machine to ensure the correct network settings.

  1. Connect with Hex-Rays license server in IDA License Manager

In the License Manager, we set a server address at 192.168.1.131 and port 65435.

Troubleshooting

License server connection fails after reboot

We have noticed that for some reason, the Windows IP Helper service has to be restarted after rebooting your computer, otherwise an RST (Reset) response is received when trying to connect to the License server.

The solution: Restart the IP Helper automatically

Add this command to a startup script so that Windows runs it automatically after every reboot:

Restart-Service -Name iphlpsvc

Last updated

Was this helpful?