Skip to content

Commit

Permalink
Merge pull request #480 from amesserla/troubleshooting-update
Browse files Browse the repository at this point in the history
Update 07a-troubleshooting-wsl-update.md
  • Loading branch information
aregtech authored Jan 6, 2025
2 parents 3bc4ab3 + 439daf0 commit 57938b6
Showing 1 changed file with 80 additions and 1 deletion.
81 changes: 80 additions & 1 deletion docs/wiki/07a-troubleshooting-wsl-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ This document outlines solutions to common issues encountered while updating the
2. [Issue 2: Network Resolution (DNS) Issues](#issue-2-network-resolution-dns-issues)
- [Solution 1: Update DNS Settings in `/etc/resolv.conf`](#solution-1-update-dns-settings-in-etcresolvconf)
- [Solution 2: Enable Automatic DNS Resolution](#solution-2-enable-automatic-dns-resolution)
- [Solution 3: Reset WSL Network Configuration](#solution-3-reset-wsl-network-configuration)
- [Solution 3: Reset WSL Network Configuration](#solution-3-reset-wsl-network-configuration)
3. [Issue 3: Configuring communication between Windows and WSL](#issue-3-configuring-communication-between-windows-and-wsl)
- [Solution 1: Editing all IP address settings (Recommended)](#solution-1-editing-all-ip-address-settings-recommended)
- [Solution 2: Updating only necessary IP addresses](#solution-2-updating-only-necessary-ip-addresses)

---

Expand Down Expand Up @@ -117,3 +120,79 @@ If the issue persists, reset the WSL network configuration:

> [!TIP]
> These solutions should address most update and DNS-related issues encountered with WSL. If problems persist, consult the [official WSL documentation](https://learn.microsoft.com/en-us/windows/wsl/) or seek assistance from the community forums.

---

## Issue 3: Configuring communication between Windows and WSL
When using Windows Subsystem for Linux (WSL), it is common to encounter issues with communication between Windows and WSL services. This section provides solutions to help configure communication between Windows and WSL.

By default, the [`areg.init`](./../../framework/areg/resources/areg.init) configuration file uses the `localhost` IP address to run the `mcrouter` and `logcollector` services on the Windows platform. Applications running within WSL cannot connect to these services due to this configuration. To resolve this, you need to modify the [`areg.init`](./../../framework/areg/resources/areg.init) file settings to enable proper communication.

> [!IMPORTANT]
>
> - **Windows-to-WSL Connections**: If a Windows-based client needs to connect to a router running in WSL, the default `localhost` settings should work without additional changes. See [Solution 2](#solution-2-updating-only-necessary-ip-addresses)
>
> - **Networking Mode in WSL**:
> - The default WSL networking mode is **NAT (Network Address Translation)**. With this mode, connections from WSL to Windows require changes to the `areg.init` configuration file.
> - Switching WSL to **Mirror Networking Mode** may allow the `localhost` setting to work seamlessly between Windows and WSL. However, this has not been fully tested.
>
> For more details, refer to the official documentation on **[Mirrored Mode Networking](https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking)**. Networking modes can be adjusted either through the `.wslconfig` file or via the WSL Settings application.

### Solution 1: Editing all IP address settings (Recommended)

When WSL applications cannot connect to services running on Windows due to the use of default `localhost` address, you can reconfigure the [`areg.init`](./../../framework/areg/resources/areg.init) settings to enable communication. In the following example, let's consider the case where `mcrouter` is running on Windows and `logcollector` is running within WSL. Other services and/or applications that communicate with `mcrouter` or `logcollector` can be run on either Windows or WSL.
**Steps:**
1. **Identify IP Adresses**
- Run `ipconfig` on Windows to find the IP address for the Windows host.
- Run `ifconfig` in the WSL terminal to find the IP address for WSL.
2. **Update WSL Configuration**
Edit the `areg.init` configuration file for applications running on WSL to specify the IP addresses of the `mcrouter` and `logcollector` services. Update the lines:
```
router::*::address::tcpip = <windows-ip-address>
logger::*::address::tcpip = <wsl-ip-address>
```
Replace `<windows-ip-address>` and `<wsl-ip-address>` with the IP addresses found in **Step 1**.
3. **Update Windows Configuration**
Edit the `areg.init` configuration file for applications running on Windows to specify the IP address of the `mcrouter` and `logcollector` services. Update the lines:
```
router::*::address::tcpip = <windows-ip-address>
logger::*::address::tcpip = <wsl-ip-address>
```
4. **Restart Services**
After updating the configuration files, restart the relevant services (`mcrouter`, `logcollector`, etc.) to apply the changes.
### Solution 2: Updating only necessary IP addresses
Applications running on Windows have access to the `localhost` IP Address within WSL, but applications within WSL do not have access to the `localhost` IP address of Windows. Therefore, it is only strictly necessary to update the configuration files to reflect the IP address of services running on Windows. For example, let's again consider the case where `mcrouter` is running on Windows and `logcollector` is running on WSL.

**Steps:**

1. **Identify IP Adresses**
- Run `ipconfig` on Windows to find the IP address for the Windows host.

2. **Update WSL Configuration**
Edit the `areg.init` configuration file for applications running on WSL to specify the IP addresses of the `mcrouter` and `logcollector` services. Update the lines:
```
router::*::address::tcpip = <windows-ip-address>
```
Replace `<windows-ip-address>` with the IP address found in **Step 1**. Leave the line `logger::*::address::tcpip = localhost` unchanged.

3. **Update Windows Configuration**
Edit the `areg.init` configuration file for applications running on Windows to specify the IP address of the `mcrouter` and `logcollector` services. Update the lines:
```
router::*::address::tcpip = <windows-ip-address>
```
Again, leave the line `logger::*::address::tcpip = localhost` unchanged.

4. **Restart Services**
After updating the configuration files, restart the relevant services (`mcrouter`, `logcollector`, etc.) to apply the changes.

>[!IMPORTANT]
>You cannot mix Solution 1 and Solution 2. The IP address of a service and/or application running on WSL must either be specified as `<wsl-ip-address>` or left unchanged in both configuration files. Leaving `localhost` in one configuration file but specifying `<wsl-ip-address>` in the other will prevent proper communication. See [this](https://github.com/aregtech/areg-sdk/pull/480#issuecomment-2568508064) description.

For further details on configuring network communication between Windows and WSL, refer to the official documentation: [Accessing Network Applications with WSL](https://learn.microsoft.com/en-us/windows/wsl/networking).

0 comments on commit 57938b6

Please sign in to comment.