port forwarding
將 port 80 導向 59600
// 新增
> netsh interface portproxy add v4tov4 listenport=80 listenaddress=* connectport=59600 connectaddress=127.0.0.1
// 顯示
> netsh interface portproxy show all
接聽 ipv4: 連線到 ipv4:
位址 連接埠 位址 連接埠
--------------- ---------- --------------- ----------
* 80 127.0.0.1 59600
// 刪除
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=*
使用 wslconfig 設定全域選項
適用于 Windows 組建 19041 和更新版本
將 .wslconfig 放到 [使用者] 資料夾的根目錄中,以設定全域 WSL ex:C:\Users<yourUserName>.wslconfig
The Microsoft built kernel provided inbox
An absolute Windows path to a custom Linux kernel.
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.
The same number of processors on Windows
How many processors to assign to the WSL 2 VM.
Boolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port.
Additional kernel command line arguments.
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.
%USERPROFILE%\AppData\Local\Temp\swap.vhdx
An absolute Windows path to the swap virtual hard disk.
Entries with the path value must be Windows paths with escaped backslashes, e.g: C:\Temp\myCustomKernel
Entries with the size value must be a size followed by a unit, for example 8GB or 512MB.
移動 docker image 所佔用空間
預設位置:%LOCALAPPDATA%/Docker/wsl
默認情況下,Docker Desktop for Window 會創建如下兩個發行版(distro):
data/ext4.vhdx 是被 docker-desktop-data 使用 distro/ext4.vhdx 是被 docker-desktop 使用
錯誤 809:無法建立計算機與 VPN 服務器之間的網路連接,因為遠程服務器無回應。這可能是因為未將計算機與遠程服務器之間的某種網路設備 (如防火牆、NAT、路由器等) 配置為允許 VPN 連接。請與管理員或服務提供商聯系以確定哪種設備可能產生此問題。
註: 僅當你使用 IPsec/L2TP 模式連接到 VPN 時,才需要進行的註冊表更改。對於 IKEv2 和 IPsec/XAuth 模式,無需進行此更改。
要解決此錯誤,在首次連接之前需要修改一次註冊表,以解決 VPN 服務器 和/或 客戶端與 NAT(比如路由器)的相容問題。請下載並導入下麵的 .reg 文件,或者打開 系統管理員 並運行以下命令。完成後必須重啟。
另外,某些個別的 Windows 系統禁用了 IPsec 加密,也會導致連接失敗。要重新啟用它,可以運行以下命令並重啟。
ForFiles /p "C:\path\to\folder" /s /d -30 /c "cmd /c del /q @file"
(gci "C:\path\to\folder" -r | ? {$.PSIsContainer -eq $True}) | ?{$.GetFileSystemInfos().Count -eq 0} | remove-item
netstat -ano | findstr 0.0:80
netsh interface ipv4 show excludedportrange protocol=tcp
清除 Windows TCP Port 保留區段
net stop winnat net start winnat