File size: 1,225 Bytes
65e80b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Accessing Network Applications with WSL

This guide details how to access network applications using the Windows Subsystem for Linux (WSL) by mirroring the network configuration. This method allows you to use `localhost` to connect seamlessly between Windows and WSL.

## Step 1: Create a WSL Configuration File

To configure network mirroring in WSL, you need to create a `.wslconfig` file in your home directory.

1. **Open File Explorer:** Paste `%UserProfile%` in the address bar to navigate to your home directory.
2. **Create the File:** Right-click in the folder, select "New > Text Document," and name the file `.wslconfig`.

### Configure the File

Copy and paste the following content into the `.wslconfig` file:

```text
[wsl2]
networkingMode=mirrored
```

## Step 2: Restart WSL

For the changes to take effect, you need to restart the WSL virtual machine.

Open a Command Prompt or PowerShell window and execute the following commands:

```bash
# Shut down WSL
wsl --shutdown

# Start WSL
wsl
```

## Further Information

For additional details and advanced settings, refer to the official WSL Networking documentation:

[WSL Networking Documentation](https://learn.microsoft.com/en-us/windows/wsl/networking)