microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.55k stars 823 forks source link

default DNS server has some problems with Github Copilot extension in VSCode in WSL when using fixed internet #11729

Open copdips opened 5 months ago

copdips commented 5 months ago

Windows Version

Microsoft Windows [Version 10.0.22631.3737]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.153.1-2

Distro Version

Ubuntu 20.04

Other Software

VSCode Github Copilot extension

Repro Steps

Github Copilot extension in VSCode cannot connect

This is my DNS conf:

> cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 10.255.255.254
search home

changing it to resolved my issue

> cat /etc/resolv.conf 
nameserver 1.1.1.1
nameserver 10.255.255.254
search home
> ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 10.255.255.254/32 brd 10.255.255.254 scope global lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:15:5d:4c:04:f5 brd ff:ff:ff:ff:ff:ff
    inet 172.27.15.111/20 brd 172.27.15.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::215:5dff:fe4c:4f5/64 scope link
       valid_lft forever preferred_lft forever

nslookup:

> nslookup
> www.github.com
Server:         1.1.1.1
Address:        1.1.1.1#53

Non-authoritative answer:
www.github.com  canonical name = github.com.
Name:   github.com
Address: 140.82.121.3
> server 10.255.255.254
Default server: 10.255.255.254
Address: 10.255.255.254#53
> www.github.com
Server:         10.255.255.254
Address:        10.255.255.254#53

Non-authoritative answer:
www.github.com  canonical name = github.com.
Name:   github.com
Address: 140.82.121.3
> 

And the DNS on the host Window OS:

PS C:\Users\xiang> Get-NetIPConfiguration

InterfaceAlias       : Wi-Fi
InterfaceIndex       : 4
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name      : contoso
IPv6Address          : xxxxxxx
IPv4Address          : 192.168.111.47
IPv6DefaultGateway   : fe80::d6f8:29ff:fe80:78c0
IPv4DefaultGateway   : 192.168.111.1
DNSServer            : 2a01:cb08:e25:1700:d6f8:29ff:fe80:78c0
                       fe80::d6f8:29ff:fe80:78c0
                       192.168.111.1

InterfaceAlias       : Ethernet 2
InterfaceIndex       : 5
InterfaceDescription : Realtek USB GbE Family Controller microsoft/vscode#2
NetAdapter.Status    : Disconnected

InterfaceAlias       : Connexion réseau Bluetooth
InterfaceIndex       : 8
InterfaceDescription : Bluetooth Device (Personal Area Network)
NetAdapter.Status    : Disconnected

InterfaceAlias       : Connexion au réseau local 2
InterfaceIndex       : 23
InterfaceDescription : OpenVPN Data Channel Offload
NetAdapter.Status    : Disconnected

InterfaceAlias       : Astrill VPN
InterfaceIndex       : 25
InterfaceDescription : Wintun Userspace Tunnel
NetAdapter.Status    : Disconnected

I raised this issue because I come from here. It seems that the default name server 10.255.255.254 has some problems with github copilot domains.

When I connect my same laptop to mobile internet, the issue is resolved. The problem only occurs when my laptop is connected to a fixed network and using WSL. Additionally, VSCode on Windows (outside of WSL) on the same laptop does not have any issues with github copilot.

And the problem occurs since 1 or 2 months ago.

Expected Behavior

Github Copilot can connect

Actual Behavior

Github Copilot cannot connect

Diagnostic Logs

No response

github-actions[bot] commented 5 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1) in an **administrative powershell prompt**: ``` Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 Set-ExecutionPolicy Bypass -Scope Process -Force .\collect-wsl-logs.ps1 ``` The scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Open similar issues:

Closed similar issues:

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

github-actions[bot] commented 5 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1) in an **administrative powershell prompt**: ``` Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 Set-ExecutionPolicy Bypass -Scope Process -Force .\collect-wsl-logs.ps1 ``` The scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Closed similar issues:

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

github-actions[bot] commented 5 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1) in an **administrative powershell prompt**: ``` Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 Set-ExecutionPolicy Bypass -Scope Process -Force .\collect-wsl-logs.ps1 ``` The scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Open similar issues:

Closed similar issues:

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

copdips commented 5 months ago

please find hereunder the dns logs:

WslLogs-2024-06-27_00-41-21.zip

github-actions[bot] commented 5 months ago
Diagnostic information ``` .wslconfig found Detected appx version: 2.2.4.0 ```
NehalDamania commented 5 months ago

Facing the same issue. For me, even after adding the nameserver 1.1.1.1, github copilot and few other extension in vs code like gitlens launchpad still does not work. Works perfectly fine on Mobile internet connection or on Windows directly without WSL

CatalinFetoiu commented 4 months ago

thanks for reporting the issue

Please follow the networking diagnostic script to collect logs. https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

It should create a folder like [WslNetworkingLogs-date_ver.zip]