Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Connect VPN

  2. In admin powershell:
    2.1 Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 1000
    2.2 Get-NetIPInterface | where {$_.InterfaceAlias -eq 'Wi-Fi' -or $_.InterfaceAlias -eq 'Ethernet 2' -or $_.InterfaceAlias -eq 'vEthernet (WSL)'} | Set-NetIPInterface -Forwarding Enabled -Verbose
    2.3 Verify by running Get-NetIPInterface | select ifIndex,InterfaceAlias,AddressFamily,ConnectionState,Forwarding,InterfaceMetric | Sort-Object -Property IfIndex | Format-Table check that forwarding is enabeled on wsl/wifi/anyconnect (Ethernet 2)

  3. In Linux shell:
    3.1 sudo bash -c "printf '[network]\ngenerateResolvConf = false' " > /etc/wsl.conf
    3.2 sudo rm /etc/resolv.conf
    3.3 Add in ~/.bashrc:

    1. alias vpn_off="sudo bash -c "printf 'nameserver 8.8.8.8' > /etc/resolv.conf""

    2. alias vpn_on="sudo bash -c "printf 'nameserver 172.16.254.82\nnameserver 172.16.254.247' > /etc/resolv.conf""

...

Dessa inställningar är lite klipp och klister från olika forum samt trial and error. Det kanske finns något smidigare sätt att få det att fungera?

Länkar:

https://www.jetbrains.com/help/idea/how-to-use-wsl-development-environment-in-product.html#debugging_system_settings

https://youtrack.jetbrains.com/issue/IDEA-265522/WSL2:-Cannot-assign-requested-address:-bind-when-etc-resolv.conf