Giter VIP home page Giter VIP logo

Comments (2)

sakai135 avatar sakai135 commented on July 22, 2024 1

I have to caution you that if editing resolv.conf fixes your connectivity issues, your VPN does not really block network connectivity from WSL 2, and sticking to just setting your DNS server in resolv.conf is probably a better way to go.

That said, try running wsl-vpnkit in the foreground, then try testing your connectivity in a separate terminal.

# PowerShell

wsl --shutdown
kill -Name wsl-gvproxy

wsl.exe -d wsl-vpnkit wsl-vpnkit

# keep this open
# your WSL 2 distro shell

ip route | grep default
# should return only one entry something like "default via 192.168.67.1 dev eth1 metric 207"

nslookup google.com 1.1.1.1
nslookup google.com 192.168.67.1
ping -c 1 1 1.1.1.1

The default configuration should work unless you have specific requirements. There should be no need to edit resolv.conf in your WSL 2 distro, although you can if you want to use a separate DNS server.

from wsl-vpnkit.

sportshead avatar sportshead commented on July 22, 2024

Thanks for the reply!

Re your point about resolv.conf fixing connectivity issues - my connectivity issues have been a combination of just WSL being WSL and also the VPN. So far the VPN has worked without any resolv.conf changes until today.

I tried running wsl-vpnkit in the foreground and this time it works properly, both on the logs and in my linux distro. Not sure what caused it to magically start working, as I had previously tried to restart wsl-vpnkit. Here are the logs in case you wish to debug further:

> wsl.exe -d wsl-vpnkit wsl-vpnkit
starting wsl-vpnkit
cleaning up iptables...
iptables cleanup done
restoring WSL 2 ip route...
ip: RTNETLINK answers: File exists
restored WSL 2 ip route
wsl-gvproxy.exe exists at /mnt/c/Users/[username]/wsl-vpnkit/wsl-gvproxy.exe
starting gvproxy at /mnt/c/Users/[username]/wsl-vpnkit/wsl-gvproxy.exe...
started gvproxy
waiting for dhcp...
INFO[0000] waiting for packets...
udhcpc: started, v1.34.1
udhcpc: broadcasting discover
time="2022-03-03T15:33:05+08:00" level=info msg="new connection from remote to 8692"
udhcpc: broadcasting select for 192.168.67.3, server 192.168.67.1
udhcpc: lease of 192.168.67.3 obtained from 192.168.67.1, lease time 3600
default via 192.168.67.1 dev eth1  metric 206
dhcp completed
removing WSL 2 ip route...
removed WSL 2 ip route
adding rules to iptables...
iptables done
check: ✔️ ping success to IPv4 WSL 2 gateway / Windows host (172.31.240.1)
check: ✔️ ping success to IPv4 Windows host (192.168.67.2)
check: ✔️ ping success to IPv4 gateway (192.168.67.1)
check: ✔️ nslookup success for example.com A using 192.168.67.1
check: ✔️ nslookup success for example.com A using 192.168.67.1
check: ✔️ nslookup success for example.com A using 172.31.240.1
check: ✔️ nslookup success for example.com A using 1.1.1.1
check: ✔️ ping success to IPv4 external host (example.com)
check: ✔️ nslookup success for example.com AAAA using 192.168.67.1
check: ✔️ nslookup success for example.com AAAA using 192.168.67.1
check: ✔️ nslookup success for example.com AAAA using 172.31.240.1
check: ✔️ nslookup success for example.com AAAA using 1.1.1.1
ping: bad address 'example.com'
check: ➖ ping fail to IPv6 external host (example.com)
check: ✔️ wget success for https://example.com
$ ip route | grep default
default via 192.168.67.1 dev eth1 metric 206
$ nslookup google.com 1.1.1.1
Server:         1.1.1.1
Address:        1.1.1.1#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.25.14
Name:   google.com
Address: 2404:6800:4005:802::200e
$ ping -c 1 1.1.1.1
ping: socket: Operation not permitted
$ sudo ping -c 1.1.1.1
ping: invalid argument: '1.1.1.1'
$ nslookup google.com 192.168.67.1
Server:         192.168.67.1
Address:        192.168.67.1#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.25.14

from wsl-vpnkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.