3

I use GlobalProtect VPN 5.2.12-16 and Windows Subsystem for Linux (WSL) 2004.2022.1.0 on Microsoft Windows 10 Enterprise 21H1 19043.1766. WSL doesn't have access to Internet when the GlobalProtect VPN is on. How can I fix that?

1 Answer 1

2

https://github.com/microsoft/WSL/issues/5068 mentions that this is a bug in WSL2 and point to the following workaround https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#bash-loses-network-connectivity-once-connected-to-a-vpn:

If after connecting to a VPN on Windows, bash loses network connectivity, try this workaround from within bash. This workaround will allow you to manually override the DNS resolution through /etc/resolv.conf.

  1. Take a note of the DNS server of the VPN from doing ipconfig.exe /all

  2. Make a copy of the existing resolv.conf sudo cp /etc/resolv.conf /etc/resolv.conf.new

  3. Unlink the current resolv.conf sudo unlink /etc/resolv.conf

  4. sudo mv /etc/resolv.conf.new /etc/resolv.conf

  5. Edit /etc/wsl.conf and add this content to the file. (More info on this set up can be found in Advanced settings configuration)

    [network]
    generateResolvConf=false
    
  6. Open /etc/resolv.conf and
    a. Delete the first line from the file which has a comment describing automatic generation
    b. Add the DNS entry from (1) above as the very first entry in the list of DNS servers.
    c. Close the file.

Once you have disconnected the VPN, you will have to revert the changes to /etc/resolv.conf. To do this, do:

  1. cd /etc
  2. sudo mv resolv.conf resolv.conf.new
  3. sudo ln -s ../run/resolvconf/resolv.conf resolv.conf
1
  • I did just that but it's the same. Also there is no /etc/run/resolvconf/resolv.conf file on WSL. Can the documentation be obsolete? And the unlink step doesn't seem require as the current resolv.conf is not a symbolic link Commented Jul 19, 2022 at 9:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .