microsoft / WSL

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

No connectivity inside WSL (`ping 8.8.8.8`) #12057

Open amadanmath opened 2 months ago

amadanmath commented 2 months ago

Windows Version

Microsoft Windows [Version 10.0.22631.3880]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.153.1-2

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

ping 8.8.8.8

Expected Behavior

Something similar to

ping 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=8ms TTL=58
Reply from 8.8.8.8: bytes=32 time=8ms TTL=58
Reply from 8.8.8.8: bytes=32 time=8ms TTL=58
Reply from 8.8.8.8: bytes=32 time=9ms TTL=58

Ping statistics for 8.8.8.8:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 8ms, Maximum = 9ms, Average = 8ms

Actual Behavior

ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
323 packets transmitted, 0 received, 100% packet loss, time 334854ms

NOTES:

TCP/IP in WSL worked when I first installed it. It broke later; I am not sure why. It may have been because Norton 360 For Gamers activated; I have uninstalled it since. It may have been because I installed Docker inside WSL Ubuntu. I have since made a clean reinstall of WSL, with no packages installed (except net-tools,. which I managed to install from dpkg downloaded from Windows), and it is broken. I have tried installing and uninstalling Hyper-V (from Turn Windows Features On or Off). I have disabled Fast Restart. I have seen decompressing all files suggested, so I tried that as well. I have also disabled swap in .wslconfig. None of these resolved the problem.

I saw some other issues on WSL connectivity, where the suggested remedy is setting nameserver. This is unrelated, the numeric IPs don't work.

Here is some more output I have collected:

$ 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:64:a8:58 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.143/20 brd 192.168.15.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::215:5dff:fe64:a858/64 scope link
       valid_lft forever preferred_lft forever

$ ip route
default via 192.168.0.1 dev eth0 proto kernel
192.168.0.0/20 dev eth0 proto kernel scope link src 192.168.10.143

$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.143  netmask 255.255.240.0  broadcast 192.168.15.255
        inet6 fe80::215:5dff:fe64:a858  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:64:a8:58  txqueuelen 1000  (Ethernet)
        RX packets 535  bytes 168328 (168.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1432  bytes 112460 (112.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 160  bytes 15220 (15.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 160  bytes 15220 (15.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

and on the host Windows cmd:

> ipconfig
Windows IP Configuration

Ethernet adapter Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi 4:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   IPv6 Address. . . . . . . . . . . : 240f:73:b5f:1:2569:2e1f:6141:ff58
   Temporary IPv6 Address. . . . . . : 240f:73:b5f:1:1906:5723:a53e:e345
   Link-local IPv6 Address . . . . . : fe80::fe3c:1543:e892:c0ac%2
   IPv4 Address. . . . . . . . . . . : 192.168.0.5
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::fab7:97ff:feab:18f4%2
                                       192.168.0.1

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::c862:1efc:e4a1:cccd%24
   IPv4 Address. . . . . . . . . . . : 192.168.96.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter vEthernet (WSL (Hyper-V firewall)):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::b08f:772f:e20f:d207%41
   IPv4 Address. . . . . . . . . . . : 192.168.0.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Diagnostic Logs

WslNetworkingLogs-2024-09-20_16-34-16.zip WslLogs-2024-09-20_16-35-48.zip

github-actions[bot] commented 2 months ago

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.

Diagnostic information
Multiple log files found, using: https://github.com/user-attachments/files/17071750/WslNetworkingLogs-2024-09-20_16-34-16.zip
.wslconfig found
Detected appx version: 2.2.4.0
optional-components.txt not found

amadanmath commented 2 months ago

Most of the linked issues have no answers; those that do, do not work for me.

amadanmath commented 2 months ago

Interestingly, if I run a server inside WSL, it can be accessed from outside:

$ # WSL
$ nc -l 8000

and

> REM cmd.exe
> curl http://localhost:8000

I can also do the reverse, though only by using 192.168.0.1 (address of vEthernet (WSL (Hyper-V firewall))) instead of localhost. But I cannot get a response from any other server.

t4261 commented 2 months ago

My flask inside WSL suddenly stopped working after I updated windows. I can ping out form WSL just fine, but If I try to connect to the flaks server via the browser, I get connection refused.

t4261 commented 2 months ago

My flask inside WSL suddenly stopped working after I updated windows. I can ping out form WSL just fine, but If I try to connect to the flaks server via the browser, I get connection refused.

I uninstalled windows update: "2024-09 Cumulative Update for Windows 11 Version 23H2 for x64-based Systems (KB5043076)"

and that fixed it. I can access the loopback interface through wsl again. However, now my start menu does not work..