Skip to content

WSL networking and interoperability

WSL networking and interoperability refers to the network configuration and file system interactions between the Windows host and the Windows Subsystem for Linux (WSL). It enables seamless communication and data sharing across the two operating systems.

Networking

WSL 2 creates a virtualized networking environment that operates with a distinct IP address from the Windows host^[wsl.md#L25-27].

  • Accessing Linux from Windows: You can access network applications running inside WSL (like a web server) via localhost on Windows^[wsl.md#L24-25].
  • Accessing Windows from Linux: To access network applications hosted on Windows from within the Linux environment, you must use the Windows host machine's IP address^[wsl.md#L26-27]. This address can typically be found by querying cat /etc/resolv.conf within the WSL terminal^[wsl.md#L26-27].

File System Interoperability

WSL provides command-line tools to bridge the Windows and Linux file systems, allowing for cross-platform file access.

Integration and File Access

  • Windows File Explorer: You can launch the Windows File Explorer directly from the WSL command line to view the current Linux directory structure using the command explorer.exe .^[wsl.md#L18].
  • Windows Tools from Linux: Windows commands can be executed directly from the Linux shell (e.g., wsl ls -la in PowerShell or explorer.exe . in Bash)^[wsl.md#L18][wsl.md#L34].

Data Storage Best Practice: For performance and data integrity, it is recommended not to store files that will be accessed by both operating systems across the file systems (e.g., avoiding working with Windows files from within WSL or vice versa)^[wsl.md#L32]. It is generally better to keep working files within the WSL file system if they are being used primarily in Linux.

  • [[WSL]]
  • [[Docker]]

Sources

^[wsl.md]