microsoft / microsoft/WSL

NatNetwork NatGatewayIpAddress do not work - Element not found

Open
#11,148 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bydesign feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.19045.3930]

### WSL Version

2.0.14.0

### Are you using WSL 1 or WSL 2?

- [X] WSL 2
- [ ] WSL 1

### Kernel Version

5.15.133.1-1

### Distro Version

kali-rolling 2023.4

### Other Software

_No response_

### Repro Steps

admin command prompt:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all

restart if prompted

go here and install the download from step 4.1.:
https://aka.ms/wsl2kernel

restart if prompted

normal command prompt:
wsl --set-default-version 2

go here and click install to open MS store:
https://apps.microsoft.com/store/detail/windows-subsystem-for-linux/9P9TQF7MRM4R

if the store page shows Get, click it

normal command prompt:
wsl --update

go here and click install to open MS store:
https://apps.microsoft.com/store/detail/kali-linux/9PKR34TNCV07

if the store page shows Get, click it

run kali once

admin command prompt:
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Lxss /t REG_SZ /v NatGatewayIpAddress /d 192.168.235.1 /f
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Lxss /t REG_SZ /v NatNetwork /d 192.168.235.0/20 /f

restart

run kali

### Expected Behavior

Expect WSL to use the configured subnet.

### Actual Behavior

This output and the registry settings are changed:

wsl: Failed to create virtual network with address range: '192.168.235.0/20', created new network with range: '172.22.240.0/20', Element not found.
wsl: Failed to create network endpoint with address: '172.24.249.0', assigned new address: '172.22.245.206'

### Diagnostic Logs

[WslLogs-2024-02-10_13-10-52.zip](https://github.com/microsoft/WSL/files/14230400/WslLogs-2024-02-10_13-10-52.zip)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided WSL setup commands and the NatGatewayIpAddress and NatNetwork registry values, then inspect the linked WslLogs diagnostic archive. Done means WSL uses the configured subnet and gateway without falling back to a different network or reporting “Element not found”.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.