Skip to content

Instantly share code, notes, and snippets.

@feamcor
Last active May 30, 2024 22:55
Show Gist options
  • Save feamcor/46687e86513c106c438bfa2715249609 to your computer and use it in GitHub Desktop.
Save feamcor/46687e86513c106c438bfa2715249609 to your computer and use it in GitHub Desktop.
Personal .wslconfig.
[wsl2]
# Reference: https://docs.microsoft.com/en-us/windows/wsl/wsl-config
# Reference: https://learn.microsoft.com/en-us/windows/wsl/enterprise
# kernel string The Microsoft built kernel provided inbox.
# An absolute Windows path to a custom Linux kernel.
#kernel=
# memory size 50% of total memory on Windows or 8GB, whichever is less;
# on builds before 20175: 80% of your total memory on Windows.
# How much memory to assign to the WSL 2 VM.
memory=20GB
# processors number The same number of processors on Windows.
# How many processors to assign to the WSL 2 VM.
processors=8
# localhostForwarding boolean true
# Boolean specifying if ports bound to wildcard or localhost
# in the WSL 2 VM should be connectable from the host via localhost:port.
localhostForwarding=false
# kernelCommandLine string Blank
# Additional kernel command line arguments.
#kernelCommandLine=
# Run WSL in "Safe Mode" which disables many features
# and is intended to be used to recover distributions that are in bad states.
# Only available for Windows 11 and WSL version 0.66.2+.
safeMode=false
# swap size 25% of memory size on Windows rounded up to the nearest GB
# How much swap space to add to the WSL 2 VM, 0 for no swap file.
swap=0
# swapFile string %USERPROFILE%\AppData\Local\Temp\swap.vhdx
# An absolute Windows path to the swap virtual hard disk.
#swapFile=
# Default true setting enables Windows to reclaim unused memory allocated to WSL 2 VM.
pageReporting=true
# guiApplications boolean true
# Boolean to turn on or off support for GUI applications (WSLg) in WSL.
guiApplications=true
# debugConsole boolean false
# Boolean to turn on an output console Window that shows the contents of
# dmesg upon start of a WSL 2 distro instance.
debugConsole=false
# nestedVirtualization boolean true
# Boolean to turn on or off nested virtualization for WSL2.
nestedVirtualization=false
# vmIdleTimeout number 60000
# The number of milliseconds that a VM is idle, before it is shut down.
vmIdleTimeout=60000
# Only applicable to networkingMode = NAT.
# Boolean to inform WSL to configure the DNS Server in Linux to the NAT on the host.
# Setting to false will mirror DNS servers from Windows to Linux.
dnsProxy=true
# If the value is mirrored then this turns on mirrored networking mode.
# Default or unrecognized strings result in NAT networking.
# This new networking mode improves compatibility with complex networking environments,
# especially VPNs and more, as well as adding support for new networking features unavailable
# in the default NAT mode like IPv6.
networkingMode=NAT
# Setting this to true allows the Windows Firewall rules,
# as well as rules specific to Hyper-V traffic, to filter WSL network traffic.
firewall=false
# Changes how DNS requests are proxied from WSL to Windows.
# This setting improves compatibility in different networking environments,
# and makes use of virtualization features to obtain DNS information rather than a networking packet.
# It's recommended to turn this on if experiencing any connectivity issues, and can be especially helpful when using VPNs, advanced firewall settings, and more.
dnsTunneling=false
# Enforces WSL to use Windows’ HTTP proxy information.
# We recommend turning this setting on when using a proxy on Windows,
# as it will make that proxy automatically apply to your WSL distributions.
autoProxy=false
# Automatically releases cached memory after detecting idle CPU usage.
# Set to gradual for slow release, and dropcache for instant release of cached memory.
#autoMemoryReclaim=gradual
# When set to true, any newly created VHD will be set to sparse automatically.
#sparseVhd=false
# Only applicable when wsl2.dnsTunneling is set to true.
# When this option is set to false, DNS requests tunneled from Linux
# will bypass cached names within Windows to always put the requests on the wire.
#useWindowsDnsCache=false
# Only applicable when wsl2.dnsTunneling is set to true.
# When set to true, Windows will extract the question from the DNS request
# and attempt to resolve it, ignoring the unknown records.
#bestEffortDnsParsing=false
# Only applicable when wsl2.autoProxy is set to true.
# Configures how long (in milliseconds) WSL will wait for retrieving
# HTTP proxy information when starting a WSL container.
# If proxy settings are resolved after this time,
# the WSL instance must be restarted to use the retrieved proxy settings.
#initialAutoProxyTimeout=1000
# Only applicable when wsl2.networkingMode is set to mirrored.
# Specifies which ports Linux applications can bind to,
# even if that port is used in Windows.
# This enables applications to listen on a port for traffic purely within Linux,
# so those applications are not blocked even when that port is used for other purposes on Windows.
# For example, WSL will allow binding to port 53 in Linux for Docker Desktop,
# as it is listening only to requests from within the Linux container.
# Should be formatted in a comma separated list, e.g: 3000,9000,9090
#ignoredPorts=
# Only applicable when wsl2.networkingMode is set to mirrored.
# When set to True, will allow the Container to connect to the Host,
# or the Host to connect to the Container, by an IP address that's assigned to the Host.
# The 127.0.0.1 loopback address can always be used,
# this option allows for all additionally assigned local IP addresses to be used as well.
# Only IPv4 addresses assigned to the host are supported.
#hostAddressLoopback=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment