Created
November 4, 2025 17:33
-
-
Save junqueira/9c7c8a860be13cdc7c3b92a9ae66f3e6 to your computer and use it in GitHub Desktop.
Revisions
-
junqueira created this gist
Nov 4, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ # wsl-vpn # erro-wsl nslookup localhost sudo vim /etc/wsl.conf [network] generateResolvConf = true sudo vim /etc/resolv.conf #nameserver 172.29.208.1 #nameserver 127.0i.0.53 #options edns0 trust-ad nameserver 8.8.8.8 sudo vim /bin/vpn-dns.sh #!/bin/bash echo "Getting current DNS servers, this takes a couple of seconds" /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command ' $ErrorActionPreference="SilentlyContinue" Get-NetAdapter -InterfaceDescription "Check Point*" | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses Get-NetAdapter | ?{-not ($_.InterfaceDescription "Check Point*") } | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses Get-NetAdapter | ?{-not ($_.InterfaceDescription -like "Check Point*") } | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses ' | \ awk 'BEGIN { print "# Generated by vpn fix func on", strftime("%c"); print } { print "nameserver", $1 }' | \ tr -d '\r ' > /etc/resolv.conf #clear # execute sudo chmod +x /bin/vpn-dns.sh <!-- echo (whoami) ALL=ALL NOPASSWD: /bin/vpn-dns.sh | sudo tee /etc/sudoers.d/010-(whoami)-vpn-dns --> <!-- echo (whoami) ALL=(ALL:ALL) NOPASSWD: /bin/vpn-dns.sh | sudo tee /etc/sudoers.d/010-(whoami)-vpn-dns --> echo "`whoami` ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/`whoami` && sudo chmod 0440 /etc/sudoers.d/`whoami` <!-- echo "`whoami` ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/010-(whoami)-vpn-dns --> # test-dns: vpn-bb (wsl) Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Check Point*"} | Set-NetIPInterface -InterfaceMetric 6000 Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Check Point*"} | Get-NetIPInterface Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Check Point*"} | Set-NetIPInterface -InterfaceMetric 1 # cat /etc/networks link-local 169.254.0.0 # wsl cat /etc/networks # symbolic names for networks, see networks(5) for more information