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

[WSL 2] No network connectivity after upgrade to 18945 #4342

Closed
cerebrate opened this issue Jul 27, 2019 · 19 comments
Closed

[WSL 2] No network connectivity after upgrade to 18945 #4342

cerebrate opened this issue Jul 27, 2019 · 19 comments
Labels
fixedininsiderbuilds network wsl2 Issue/feature applies to WSL 2

Comments

@cerebrate
Copy link

  • Your Windows build number: 10.0.18945.1001

  • What you're doing and what's happening:

After upgrading to 18945, I cannot connect to any network locations from inside WSL. While eth0 appears to get an IP address, it is not routable. For example, with this network configuration seen inside WSL:

avatar@athena:~$ ip a
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
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 72:f4:f0:99:f5:ce brd ff:ff:ff:ff:ff:ff
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether b2:55:25:91:06:1f brd ff:ff:ff:ff:ff:ff
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:15:5d:97:65:1c brd ff:ff:ff:ff:ff:ff
    inet 172.28.121.226/16 brd 172.28.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::215:5dff:fe97:651c/64 scope link
       valid_lft forever preferred_lft forever
5: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
avatar@athena:~$ ip r
default via 172.28.112.1 dev eth0
172.28.0.0/16 dev eth0 proto kernel scope link src 172.28.121.226

the only address that can be pinged is the local interface, 172.28.121.226. Pinging the default gateway (172.28.112.1), the Windows host (172.16.1.2), a local LAN address (172.16.0.128), or the Internet (8.8.8.8) all fail, thus:

avatar@athena:~$ ping 172.28.112.1
PING 172.28.112.1 (172.28.112.1) 56(84) bytes of data.
From 172.28.121.226 icmp_seq=1 Destination Host Unreachable
From 172.28.121.226 icmp_seq=2 Destination Host Unreachable
From 172.28.121.226 icmp_seq=3 Destination Host Unreachable
^C
--- 172.28.112.1 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 166ms
pipe 4
  • What's wrong / what should be happening instead:

All of the above addresses should be reachable.

  • Further data:
  1. The virtual network addresses for WSL are also unreachable from the Windows host; i.e., from a command prompt, it is impossible to ping either 172.28.121.226 or 172.28.112.1.

  2. The "vEthernet (WSL)" adapter on the Windows host seems to have gone missing; no such adapter is showing up in ipconfig.

PS:1899 {ATHENA:avatar} C:\Users\avatar.ARKANE-SYSTEMS#get-vmswitch WSL | fl *


DefaultQueueVmmqQueuePairs                       : 0
DefaultQueueVmmqQueuePairsRequested              : 16
Name                                             : WSL
Id                                               : 5497cb45-d77e-4001-a761-ae05b7dc802e
Notes                                            :
Extensions                                       : {Microsoft Windows Filtering Platform, Windows Defender Application
                                                   Guard Filter Driver, Microsoft Azure VFP Switch Extension,
                                                   Microsoft NDIS Capture}
BandwidthReservationMode                         : Absolute
PacketDirectEnabled                              : False
EmbeddedTeamingEnabled                           : False
IovEnabled                                       : False
SwitchType                                       : Private
AllowManagementOS                                : False
NetAdapterInterfaceDescription                   :
NetAdapterInterfaceDescriptions                  :
NetAdapterInterfaceGuid                          :
IovSupport                                       : False
IovSupportReasons                                :
AvailableIPSecSA                                 : 0
NumberIPSecSAAllocated                           : 0
AvailableVMQueues                                : 0
NumberVmqAllocated                               : 0
IovQueuePairCount                                : 0
IovQueuePairsInUse                               : 0
IovVirtualFunctionCount                          : 0
IovVirtualFunctionsInUse                         : 0
PacketDirectInUse                                : False
DefaultQueueVrssEnabledRequested                 : True
DefaultQueueVrssEnabled                          : False
DefaultQueueVmmqEnabledRequested                 : True
DefaultQueueVmmqEnabled                          : False
DefaultQueueVrssMaxQueuePairsRequested           : 16
DefaultQueueVrssMaxQueuePairs                    : 0
DefaultQueueVrssMinQueuePairsRequested           : 1
DefaultQueueVrssMinQueuePairs                    : 0
DefaultQueueVrssQueueSchedulingModeRequested     : StaticVrss
DefaultQueueVrssQueueSchedulingMode              : Dynamic
DefaultQueueVrssExcludePrimaryProcessorRequested : False
DefaultQueueVrssExcludePrimaryProcessor          : False
SoftwareRscEnabled                               : False
BandwidthPercentage                              : 0
DefaultFlowMinimumBandwidthAbsolute              : 0
DefaultFlowMinimumBandwidthWeight                : 0
CimSession                                       : CimSession: .
ComputerName                                     : ATHENA
IsDeleted                                        : False

Taken together, I think this indicates that something's gone adrift in the virtual switch configuration that WSL uses? Is there any way to recreate that?

@cerebrate
Copy link
Author

(The new localhost feature works great, though!

...I feel this is somehow ironic.)

@fayep
Copy link

fayep commented Jul 27, 2019

I just observed this and resolved it: I saw that linux eth0 interface was on 192.168.116.25 and wsl host interface was 192.168.112.1. By running

ifconfig eth0 192.168.112.25 netmask 255.255.255.0
route add default gw 192.168.112.1

networking was restored to my WSL.

@cerebrate
Copy link
Author

Must be a slightly different variation - I don't seem to have a wsl host interface any more. :(

Glad you got it working, though.

@johlju
Copy link

johlju commented Jul 27, 2019

I could ping the default gateway, but not outside the host. I worked around it by just uninstalling the distros, then uninstalled the feature WSL. The reinstalled after a reboot and reinstalled the distros. After reboot I got internet connectivity in the distros.

@cerebrate
Copy link
Author

I resolved mine similarly, now, by uninstalling the virtual machine platform and WSL, rebooting, then reinstalling them. (I left the distro in place; it was still there after the reinstall of both of them.) That seemed to fix whatever was up with the config of the WSL virtual switch (it showed as internal again afterwards, and the interface was once again present), and restored networking.

@arthurgeron
Copy link

arthurgeron commented Jul 31, 2019

I lose internet connectivity after doing some npm installs and docker
@fayep fix works if I restart wsl

@pauloscardine
Copy link

pauloscardine commented Jul 31, 2019

Looks like sometimes the WSL virtual interface is using a narrower network on the linux side so the default gateway ends up invalid (IINM windows does not complain about default gateway being outside the main interface network but linux does):

$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.170.29  netmask 255.255.255.0  broadcast 192.168.170.255
        inet6 fe80::215:5dff:fe70:91d2  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:70:91:d2  txqueuelen 1000  (Ethernet)
        RX packets 1892  bytes 285656 (285.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 21  bytes 1586 (1.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

On the windows side, the WSL interface was:

PS C:\Users\paulos> ipconfig
...
Ethernet adapter vEthernet (WSL):

  Connection-specific DNS Suffix  . :
  Link-local-IPv6 Address . . . . . : fe80::a07a:25bd:e562:a887%61
  IPv4 Address. . . . . . . . . . . : 192.168.160.1
  Subnet Mask . . . . . . . . . . . : 255.255.240.0
  Default Gateway . . . . . . . . . :
...

I think the problem is that the default gateway on the linux side should be 192.168.160.1 but since it is outside the 192.168.170.0/24 network the WSL instance ends up without a default gateway.

If I change the netmask to 255.255.240.0 and add the windows IP as default gateway on the linux side too, voila! problem fixed:

$ sudo ifconfig eth0 192.168.170.29 netmask 255.255.240.0
$ sudo route add default gw 192.168.160.1

This is just a temporary workaround though, when the DHCP lease expires the netmask will be reset, same if you restart WSL. Lets wait for a fix, I bet 255.255.255.0 is hardcoded somewhere... :-)

@pauloscardine
Copy link

pauloscardine commented Jul 31, 2019

I think this is a dupe of #3438

@arthurgeron
Copy link

arthurgeron commented Jul 31, 2019

I got internet working after setting gateway and subnetmask to the same as the WSL adapter on windows, then randomly it'd stop again..
After changing the /etc/resolv.conf from the previous nameserver to

nameserver 1.1.1.1
nameserver 1.0.0.1

and doing:

netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns

it worked again... very strange, got those commands from the feature @pauloscardine mentioned

@benhillis
Copy link
Member

Build 18970 has some fixes in this area, if you are continuing to see issues after this build please open a new issue.

@evilArsh
Copy link

evilArsh commented Oct 27, 2019

it occured in 19008.1
image

image
image

but when i switch wsl2 back to wsl,everything is gonna be ok

@jmvictor5656
Copy link

I stopped my antivirus Fireball and Network started working

@JacerOmri
Copy link

I just observed this and resolved it: I saw that linux eth0 interface was on 192.168.116.25 and wsl host interface was 192.168.112.1. By running

ifconfig eth0 192.168.112.25 netmask 255.255.255.0
route add default gw 192.168.112.1

networking was restored to my WSL.

i was able to fix the problem by changing the resolve.conf file and some netsh commands. But this seemed way better and more accurate (and it worked for me)

@andymule
Copy link

andymule commented Mar 14, 2020

I also see this issue currently (happened after taking the most recent security update on Windows). In my case, and in the original poster's case, the vEthernet (WSL) adapter is missing on the Windows side. There is nothing to reference and no amount of WSL routing will fix it.

This happened to me a few months ago also, and the only way I could get the vEthernet (WSL) adapter to reappear was uninstall, disable, restart, reinstall WSL as suggested in previous posts. Otherwise, there's nothing helpful in this thread and this is still an outstanding bug.

If you can see your vEthernet (WSL) adapter in windows' ipconfig, then here is your thread:
#4275

@andymule
Copy link

Another Windows Update, another missing vEthernet (WSL) Adapter..... six weeks later

@dgellow
Copy link

dgellow commented Sep 15, 2020

I'm facing the same issue as @andymule at the moment. I'm on OS build 20211.1000, which is the latest one from the dev channel.

  • ipconfig lists the WSL adapter as disconnected

image

  • the control panel "Network Connections" doesn't list it at all

image

  • Hyper-V manager doesn't list any machine at all (I understand it should list one for WSL2? Not sure about that), and doesn't even have actions such as "new VM", which is really weird

image

(may be a duplicate of #4810)

@savchenko
Copy link

Same, no WSL adapter after an upgrade to 10.0.19041.450.

Two "Wireless LAN adapters" have appeared in the ipconfig output though, none is connected, but one has the same MAC as the physical WiFi iface.

C:\>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : host
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Physical Address. . . . . . . . . : 00-15-5D-62-E5-FE
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::d98:d664:4102:1bb6%35(Preferred)
   Autoconfiguration IPv4 Address. . : 169.254.27.182(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 511101119
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-00-00-00-00-00-00-00-00-1D-7D
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter external:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
   Physical Address. . . . . . . . . : 74-00-00-00-00-7D
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.2.200(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.2.1
   DNS Servers . . . . . . . . . . . : 192.168.2.1
   NetBIOS over Tcpip. . . . . . . . : Disabled

Wireless LAN adapter Local Area Connection* 1:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #3
   Physical Address. . . . . . . . . : 3C-00-00-00-00-09
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Local Area Connection* 13:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #4
   Physical Address. . . . . . . . . : 3E-00-00-00-00-08
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter WiFi:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Centrino(R) Ultimate-N 6300 AGN
   Physical Address. . . . . . . . . : 3C-00-00-00-00-08
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.2.100(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : 28 September 2020 15:13:39
   Lease Expires . . . . . . . . . . : 28 September 2020 15:38:39
   Default Gateway . . . . . . . . . : 192.168.2.1
   DHCP Server . . . . . . . . . . . : 192.168.2.1
   DNS Servers . . . . . . . . . . . : 192.168.2.1
   NetBIOS over Tcpip. . . . . . . . : Disabled

C:\>

@emandret
Copy link

Microsoft has an outstanding reputation of closing non-resolved issue.

Looks like the WSL distro IP address and netmask are hardcoded somewhere, and they won't change when you modify the settings in the Windows host adapter.

In adapter settings, enable DHCP:

adapter-properties

Shutdown WSL and restart the vEthernet adapter from an elevated Powershell:

wsl --shutdown
Restart-NetAdapter "vEthernet (WSL)"

On the Windows host, my WSL adapter has been assigned this non-routable APIPA address that I cannot seem to change:

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::c06:a264:7023:63ca%60
   Autoconfiguration IPv4 Address. . : 169.254.99.202
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . :

Open WSL and run the following command:

ip addr show dev eth0

Here is my output:

4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:15:5d:8f:b3:c5 brd ff:ff:ff:ff:ff:ff
    inet 172.18.80.229/20 brd 172.18.95.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::215:5dff:fe8f:b3c5/64 scope link
       valid_lft forever preferred_lft forever

For some reasons, the range 172.18.80.0/20 is hardcoded somewhere and WSL randomly chooses an IP from that range at startup.

Also, no Internet access from/to your WSL distro, since the NAT adapter is actually built-in into the WSL vEthernet adapter and configuration is hidden.

@pilcherd
Copy link

pilcherd commented Apr 5, 2022

Was running WSL1 with no issues. Updated to WSL 2 using set version command broke things... DNS was working with 1, broken with 2. Suggestion to set a manual DNS rather than using the host worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixedininsiderbuilds network wsl2 Issue/feature applies to WSL 2
Projects
None yet
Development

No branches or pull requests