Created
November 4, 2025 17:33
-
-
Save junqueira/9c7c8a860be13cdc7c3b92a9ae66f3e6 to your computer and use it in GitHub Desktop.
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 characters
| # 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment