Problem
When using LM Studio on Windows 11, accessing the server from WSL (Windows Subsystem for Linux) is not straightforward, even though the server is accessible locally. This issue occurs because LM Studio defaults to starting the server on 127.0.0.1
(localhost), which makes it accessible only to applications running directly on the Windows host. Requests from WSL or other hosts (e.g., using the Windows IP address) are blocked.
While LM Studio's interface allows configuring the port, it does not provide an option to modify the network interface (networkInterface
) the server listens on.
Solution
To make the server accessible from WSL, the network interface must be changed from 127.0.0.1
to 0.0.0.0
, allowing the server to listen on all network interfaces.
Steps to Resolve:
-
Start LM Studio: Open LM Studio and ensure the server is running as usual.
-
Edit the Configuration File:
- Navigate to the directory containing the internal configuration file:
%userprofile%\.cache\lm-studio\.internal
- Open the file
http-server-config.json
in a text editor.
- Navigate to the directory containing the internal configuration file:
-
Modify the Entry:
- Locate the
"networkInterface"
entry and change its value from"127.0.0.1"
to"0.0.0.0"
. - Example:
{ "networkInterface": "0.0.0.0", "port": 1234 }
- Locate the
-
Restart LM Studio Server: Stop and restart LM Studio Server in Developer Tab for the changes to take effect.
-
Test the Access:
- Determine the local IP address of the Windows host (e.g., using
ipconfig
). - Test the server access from WSL with the following command:
curl http://<windows-ip>:1234/v1/models
- The server should now be accessible.
- Determine the local IP address of the Windows host (e.g., using
Note
Changing the network interface to 0.0.0.0
theoretically makes the server accessible to other devices on the network. If this is not desirable, ensure that the Windows Firewall restricts access to localhost or specific IP ranges.
Conclusion
By modifying the http-server-config.json
file, the LM Studio server can be accessed from WSL Linux. This solution is simple and effective for integrating local development environments into hybrid workflows.