WSL

  • WSL手動設置DNS不被重置為默認

    WSL2修改/etc/resolv.conf可以自己設置dns,但重啟WSL以後,手動設置的DNS就會被重置為默認的,細心看了一下默認的文件以後發現了問題的關鍵。WSL自動在啟動時自動根據系統的虛擬交換機WSL生成/etc/resolv.conf文件。如下為默認的/etc/resolv.conf文件的內容

    # This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
    # [network]
    # generateResolvConf = false
    nameserver 172.27.96.1