Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS lookup not working in WSL2 even after setting wsl.conf and resolv.conf #10978

Closed
1 of 2 tasks
shilhas opened this issue Jan 4, 2024 · 9 comments
Closed
1 of 2 tasks

Comments

@shilhas
Copy link

shilhas commented Jan 4, 2024

Windows Version

Microsoft Windows [Version 10.0.19045.3803]

WSL Version

2.0.14.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

  1. start WSL with command wsl
  2. run ping google.com

note settings:
cat /etc/wsl.conf
[network]
generateResolvConf = false
cat /etc/resolv.conf
nameserver gateway-ip-address
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
nameserver 1.0.0.1
I have also tried with individual ip address of DNS and gateway ip listed above.

ping response each of the above IP address is successful one e.g. shown below

ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.  \
64 bytes from 8.8.8.8: icmp_seq=1 ttl=113 time=16.9 ms  \
64 bytes from 8.8.8.8: icmp_seq=2 ttl=113 time=16.7 ms  \
64 bytes from 8.8.8.8: icmp_seq=3 ttl=113 time=16.5 ms  \
--- 8.8.8.8 ping statistics ---  \
3 packets transmitted, 3 received, 0% packet loss, time 2003ms  \
rtt min/avg/max/mdev = 16.475/16.707/16.947/0.192 ms

on host machine

ipconfig /all | findstr "Gateway"
   Default Gateway . . . . . . . . . :
   Default Gateway . . . . . . . . . : **gateway-ip-address**
   Default Gateway . . . . . . . . . :
   Default Gateway . . . . . . . . . : 

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Physical Address. . . . . . . . . : yy-yy-yy-yy-yy-yy
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::e72c:962a:1d1b:b5cd%72(Preferred)
   IPv4 Address. . . . . . . . . . . : x.x.x.x(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 1207965021
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2B-48-3C-0D-94-E6-F7-83-3C-31
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Note:

  1. Host machine uses bitlocker to encrypt the disc.
  2. VPN is currently disabled
  3. firewall is managed by our organization
  4. zscalar is switched off
  5. disabled swap by setting [wsl2] \n swap=0 in %userprofile%\.wslconfig

Expected Behavior

ping google.com

result in

Pinging google.com [142.251.36.14] with 32 bytes of data:
Reply from 142.251.36.14: bytes=32 time=16ms TTL=117
Reply from 142.251.36.14: bytes=32 time=16ms TTL=117

Actual Behavior

ping google.com

result in
ping: google.com: Temporary failure in name resolution

I have many of the solution suggested in stackoverflow and github nothing worked so far.

Diagnostic Logs

No response

Copy link

github-actions bot commented Jan 4, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@shilhas
Copy link
Author

shilhas commented Jan 5, 2024

I have tried all recommendation in the tickets mentioned above but nothing worked
I tried to check what's happening using Wireshark on ethernet adapter for WSL
ipconfig info for adapter

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Physical Address. . . . . . . . . : 00-15-5D-45-D3-A5
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::7d71:a5aa:374c:4905%81(Preferred) 
   IPv4 Address. . . . . . . . . . . : 172.29.96.1(Preferred) 
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . : 
   DHCPv6 IAID . . . . . . . . . . . : 1358959965
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2B-48-3C-0D-94-E6-F7-83-3C-31
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ping Request Response

Pinging IP addresses :

waiting for 1.1.1.1 ...

PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.

--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 3.083/3.755/4.369/0.526 ms

waiting for google.com ...

ping: google.com: Temporary failure in name resolution

Wireshark Output
Wireshark_Capture_WSL

I don't see any DNS request on port 53

@elsaco
Copy link

elsaco commented Jan 6, 2024

@shilhas who's your resolver? Are you using systemd-resolved? If yes, use resolvectl and inspect your DNS setup.

Sample output with nameserver 1.1.1.1 in /etc/resolve.conf:

elsaco@texas:~# resolvectl status
Global
         Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: foreign
Current DNS Server: 1.1.1.1
       DNS Servers: 1.1.1.1

Link 2 (eth0)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

and a query example:

elsaco@texas:~# resolvectl query google.com
google.com: 172.253.117.100                    -- link: eth0
            172.253.117.139                    -- link: eth0
            172.253.117.113                    -- link: eth0
            172.253.117.101                    -- link: eth0
            172.253.117.102                    -- link: eth0
            172.253.117.138                    -- link: eth0
            2607:f8b0:400e:c0c::8b             -- link: eth0
            2607:f8b0:400e:c0c::8a             -- link: eth0
            2607:f8b0:400e:c0c::64             -- link: eth0
            2607:f8b0:400e:c0c::66             -- link: eth0

-- Information acquired via protocol DNS in 18.3ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
-- Data from: network

wsl_ping_google

@shilhas
Copy link
Author

shilhas commented Jan 8, 2024

@elsaco It does not look like I have systemd-resolved

resolvectl status
Could not find command-not-found database. Run 'sudo apt update' to populate it.
resolvectl: command not found
$ systemd --user
Trying to run as user instance, but the system has not been booted with systemd.

@shilhas
Copy link
Author

shilhas commented Jan 8, 2024

I have enable systemd on WSL by editing wsl.conf file

$ systemd --version
systemd 254 (254.5-1)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified

resolvectl status still does not provide meaningful output

$ resolvectl status
Could not find command-not-found database. Run 'sudo apt update' to populate it.
resolvectl: command not found

@elsaco
Copy link

elsaco commented Jan 8, 2024

On Ubuntu-22.04 systemctl is part of systemd and the latest version available is 249.11-0ubuntu3.11:

elsaco@texas:~$ dpkg -S /bin/systemctl
systemd: /bin/systemctl

systemd version:

systemd 249 (249.11-0ubuntu3.11)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID
+CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY -P11KIT
-QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified

@shilhas
Copy link
Author

shilhas commented Jan 9, 2024

image
could this be a issue, that I only see ipv6 for DNS server?

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 16, 2024

/dupe #8365

Copy link
Contributor

Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread.

Thanks for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants