WSL’s September 2023 pre-release updates bring a number of interesting features including network management, firewalls, and VHD reduction.
- Microsoft has introduced new initiatives in the latest version of Windows Subsystem for Linux (WSL), such as autoMemoryReclaim, which reduces memory usage in the WSL VM when the CPU is idle.
- sparseVhd is another new feature that allows users to reduce the size of the hard disk of Linux distros in WSL.
- The web interface in WSL enables networks to be viewed from Windows to be viewed in Linux, improving compatibility and adding new features, but it is currently available to Windows Insiders running Windows 11 version 22H2.
The Windows Subsystem for Linux (WSL) is a support tool available in Windows 10 and Windows 11 that allows developers to run a GNU/Linux environment directly within the operating system without the need for virtual machines (VMs) or dual-boot configurations. The installer became available through the Microsoft Store about a year ago, making it easy for interested users to install it quickly. Now, Microsoft has released a new version of WSL that has not yet been released with many interesting, experimental features.
The first test item is called autoMemoryReclaim; enables the WSL VM to reduce its memory and release the reserved memory when it detects the WSL VM’s CPU idling. It admits two points: slow and falling. The first benefit slowly frees memory after 5 minutes of CPU idling, for 30 minutes. Meanwhile, the latter immediately frees all memory saved after the same 5 minutes. That said, Microsoft has noted that the default configuration causes the docker daemon to crash if you’re running it as a service in WSL, so use Docker Desktop instead.
Next, we have sparseVhd, which allows users to organize their hard disk (VHD) so that it shrinks in size over time. It accepts the boolean values true and false, and can also be used in existing Linux distros.
Another interesting possibility is the new networkingMode option called mirrored. It is offered in addition to default NAT, and is new in that it enables networks used on Windows to be visible to Linux running in WSL. This improves compatibility and adds new features such as support for IPv6 and multicast, better connection to VPNs, connection to WSL using a Local Area Network (LAN), and connecting to Windows servers directly through Linux using the local address 127.0.0.1. However, there are some known issues with this build, and it is currently available to Windows Insiders running Windows 11 version 22H2.
A similar object is a firebox that accepts the boolean values true and false. If already installed, your Windows Firewall rules will be inherited by the WSL VM, and you can also set new Hyper-V Firewall rules related to WSL traffic. This feature is also available for Windows Insiders on Windows 11 version 22H2.
Additionally, setting up dnsTunneling changes the way DNS requests are routed from WSL to Windows. This should enable WSL networks to connect to the Internet via VPN or firewalls and network settings. It also means you’ll get fewer “no network” errors within the WSL distro. This is currently locked behind the Insider track for Windows 11 version 22H2 as well.
Finally, we have the actual autoProxy configuration. As the name suggests, it empowers users to run Windows-based virtual machines inside the WSL VM so you don’t have to manually configure them and make mistakes. Although it’s not fenced behind the Insider channel, you still need to be running Windows 11 version 22H2 to take advantage of it.
Of course, this may be a lot to hear, which is why WSL Marketing Manager Craig Lowen has also published a helpful video explaining how to use the test technique and get it right, check it out below:
Also note that there are other, more minor changes, and you can find out more about them in the WSL 2.0.0 pre-release changelog in the GitHub repository here.