crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.26k stars 238 forks source link

[BUG] CRC breaks dns resolving inside WSL2 #2065

Closed kadel closed 3 years ago

kadel commented 3 years ago

General information

CRC version

# Put `crc version` output here
CodeReady Containers version: 1.22.0+6faff76f
OpenShift version: 4.6.15 (embedded in executable)

Host Operating System

# Put the output of `cat /etc/os-release` in case of Linux
# put the output of `sw_vers` in case of Mac
# Put the output of `systeminfo` in case of Windows

 systeminfo.exe

Host Name:                 HAL
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19042 N/A Build 19042
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          Tomas
Registered Organization:
Product ID:                00330-80000-00000-AA003
Original Install Date:     06.11.2020, 21:46:53
System Boot Time:          23.02.2021, 13:26:41
System Manufacturer:       MSI
System Model:              MS-7995
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~2712 Mhz
BIOS Version:              American Megatrends Inc. 1.00, 09.12.2015
Windows Directory:         C:\Windows
System Directory:          C:\Windows\system32
Boot Device:               \Device\HarddiskVolume5
System Locale:             en-us;English (United States)
Input Locale:              cs;Czech
Time Zone:                 (UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
Total Physical Memory:     32 715 MB
Available Physical Memory: 11 699 MB
Virtual Memory: Max Size:  38 297 MB
Virtual Memory: Available: 7 919 MB
Virtual Memory: In Use:    30 378 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    WORKGROUP
Logon Server:              \\HAL
Hotfix(s):                 10 Hotfix(s) Installed.
                           [01]: KB4601050
                           [02]: KB4562830
                           [03]: KB4570334
                           [04]: KB4577266
                           [05]: KB4577586
                           [06]: KB4580325
                           [07]: KB4586864
                           [08]: KB4593175
                           [09]: KB4598481
                           [10]: KB4601319
Network Card(s):           7 NIC(s) Installed.
                           [01]: Realtek PCIe GbE Family Controller
                                 Connection Name: Ethernet
                                 DHCP Enabled:    Yes
                                 DHCP Server:     N/A
                                 IP address(es)
                           [02]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (nat)
                                 DHCP Enabled:    No
                                 IP address(es)
                                 [01]: 172.30.128.1
                                 [02]: fe80::3d4e:bb49:7c74:6d2
                           [03]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (Default Switch)
                                 DHCP Enabled:    No
                                 IP address(es)
                                 [01]: 172.31.80.1
                                 [02]: fe80::f4c7:c38b:cbba:e510
                           [04]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (WSL)
                                 DHCP Enabled:    No
                                 IP address(es)
                                 [01]: 172.30.224.1
                                 [02]: fe80::6da4:c7b4:c97a:df2b
                           [05]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (external)
                                 DHCP Enabled:    Yes
                                 DHCP Server:     192.168.1.1
                                 IP address(es)
                                 [01]: 192.168.1.182
                                 [02]: fe80::34fc:90c5:882e:e7c3
                           [06]: Wintun Userspace Tunnel
                                 Connection Name: OpenVPN Wintun
                                 Status:          Media disconnected
                           [07]: TAP-Windows Adapter V9
                                 Connection Name: OpenVPN TAP-Windows6
                                 DHCP Enabled:    Yes
                                 DHCP Server:     10.40.207.254
                                 IP address(es)
                                 [01]: 10.40.194.113
                                 [02]: fe80::f0fe:9d3a:c678:fcdb
Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.

Steps to reproduce

  1. crc setup
  2. crc start
  3. inside WSL2 (Windows Linux Subsystem) try to connect to something that you haven't connected before. DNS resolution times out. It is not happening always, but there is a big chance of it. The most visible it is on apt update it fails every time
sudo apt update
Err:1 https://adoptopenjdk.jfrog.io/adoptopenjdk/deb focal InRelease
  Temporary failure resolving 'adoptopenjdk.jfrog.io'
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 https://apt.kubernetes.io kubernetes-xenial InRelease
  Temporary failure resolving 'apt.kubernetes.io'
Err:4 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:5 https://cli.github.com/packages focal InRelease
  Temporary failure resolving 'cli.github.com'
Err:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Hit:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
8 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch https://cli.github.com/packages/dists/focal/InRelease  Temporary failure resolving 'cli.github.com'
W: Failed to fetch https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/dists/focal/InRelease  Temporary failure resolving 'adoptopenjdk.jfrog.io'
W: Failed to fetch https://apt.kubernetes.io/dists/kubernetes-xenial/InRelease  Temporary failure resolving 'apt.kubernetes.io'
W: Some index files failed to download. They have been ignored, or old ones used instead.
dig microsoft.com

; <<>> DiG 9.16.1-Ubuntu <<>> microsoft.com
;; global options: +cmd
;; connection timed out; no servers could be reached
  1. running crc stop,crc delete,crc cleanup fixes the issue back to normal.
guillaumerose commented 3 years ago

Thanks for the feedback. Can you try with this network mode ? https://github.com/code-ready/crc/wiki/VPN-support--with-an--userland-network-stack It should not break WSL2 name resolution.

kadel commented 3 years ago

Thank you @guillaumerose , it fixed the name resolution issue, but it breaks routes :/
From wiki, I understand that this is a know limitation, but for my case, this makes it unusable :/

guillaumerose commented 3 years ago

You can add routes directly in your hosts file manually. It will be automated "soon".

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

guillaumerose commented 3 years ago

Host files entries are now automated in 1.26.0. Give it a try!