!cat /etc/wsl.conf
[boot]
systemd=true
[network]
# hostname = DemoHost
generateHosts = true
generateResolvConf = true
# [user]
# default = DemoUser
Benedict Thekkel
Turn Windows features on or off
Turn on: - Virtual Machine Platform - Windows Hypervisor Platform - Windows Subsystem for Linux
If there is error with wsl
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/triage/install-latest-wsl.ps1" -OutFile install-latest-wsl.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\install-latest-wsl.ps1
.wslconfig to configure global settings across all installed distributions running on WSL 2.
# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=30GB
swap=32GB
# Sets the VM to use two virtual processors
processors=12
networkingMode = mirrored
# dnsProxy = false
firewall = false
[experimental]
autoMemoryReclaim = dropcache
wsl.conf to configure local settings per-distribution for each Linux distribution running on WSL 1 or WSL 2.
Location: /etc/wsl.conf
The wsl.conf file supports four sections:
automount
,network
,interop
, anduser
.
rule: allow all traffic from port 8888 to pass through
netsh interface portproxy add v4tov4 listenport=8888 listenaddress=0.0.0.0 connectport=8888 connectaddress=172.22.253.143
delete rule:
netsh interface portproxy delete v4tov4 listenport=8888 listenaddress=0.0.0.0
view rules:
netsh interface portproxy show all
sudo apt install firefox
In powershell as administrator