Skip to content

.wslconfig – Reference

cpx May 26, 2026 1 min read System Tools

Location: %UserProfile%\\.wslconfig (e.g. C:\\Users\\<You>\\.wslconfig)

Scope: Global — applies to all WSL 2 distributions

Apply changes: wsl --shutdown then relaunch


[wsl2] — VM Settings

KeyTypeDefaultDescription
kernelpathMS inbox kernelCustom Linux kernel
kernelModulespathCustom kernel modules VHD
memorysize50% host RAMVM memory limit
processorsintall logical CPUsVM vCPU count
swapsize25% RAM (rounded up GB)Swap size; 0 = disabled
swapFilepath%Temp%\\swap.vhdxSwap VHD location
defaultVhdSizesize1 TBMax distro filesystem VHD size
localhostForwardingbooltrueExpose WSL ports on Windows localhost
kernelCommandLinestringExtra kernel boot args
guiApplicationsbooltrueWSLg (GUI app support)
safeModeboolfalseRecovery mode — disables features
debugConsole ¹boolfalseShow dmesg on distro start
nestedVirtualization ¹booltrueAllow nested VMs inside WSL
vmIdleTimeout ¹int60000ms idle before VM auto-shutdown
maxCrashDumpCountint10Retained crash dumps
networkingMode ¹²stringNATnat · mirrored · virtioproxy · none · ~~bridged~~
firewall ¹²booltrueApply Windows/Hyper-V firewall to WSL
dnsProxybooltruePoint Linux DNS at host NAT (NAT mode only)
dnsTunneling ¹²booltrueTunnel DNS requests through Windows
autoProxy ¹booltrueInherit Windows HTTP proxy settings

[experimental] — Preview Features

KeyTypeDefaultDescription
autoMemoryReclaimstringdropCachedisabled · gradual · dropCache
sparseVhdboolfalseCreate new VHDs as sparse
bestEffortDnsParsing ¹²boolfalseResolve DNS ignoring unknown records (dnsTunneling req.)
dnsTunnelingIpAddress ¹²string10.255.255.254Nameserver IP in resolv.conf (dnsTunneling req.)
initialAutoProxyTimeout ¹string1000ms to wait for proxy info at startup (autoProxy req.)
ignoredPorts ¹²stringComma-sep ports Linux can bind even if used on Windows (mirrored only)
hostAddressLoopback ¹²boolfalseContainer ↔ host via host IPs, not just 127.0.0.1 (mirrored only)

Value Format Rules

TypeFormatExamples
pathWindows path, escaped backslashesC:\\\\Temp\\\\myKernel
sizeNumber + unit (B default if omitted)8GB · 512MB · 1099511627776
booltrue / false
stringPlain textvsyscall=emulate

Footnotes

  • ¹ Windows 11 only
  • ² Requires Windows 11 22H2+

Starter Template

[wsl2]
memory=8GB
processors=4
swap=4GB
localhostForwarding=true
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true
nestedVirtualization=true
# kernel=C:\\\\path\\\\to\\\\bzImage
# kernelCommandLine=vsyscall=emulate
# defaultVhdSize=256GB
[experimental]
autoMemoryReclaim=dropCache 
sparseVhd=true 
# bestEffortDnsParsing=false 
# ignoredPorts=3000,9000 
# hostAddressLoopback=false

Source: Microsoft Learn — Advanced settings configuration in WSL (last updated 2025-08-06)

0 0 votes
Article Rating
guest

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x