WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Can't reach 127.0.0.1 outside WSL2 Build 22623.1180

Open jmar5439 opened this issue 3 years ago • 29 comments

Version

Windows 11 Insider Preview Build 22623.1180

WSL Version

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.83.1-microsoft-standard-WSL2

Distro Version

Ubuntu 18.04

Other Software

No response

Repro Steps

Open console of wsl try to start angular project in wsl like: npm start

try to reach http://127.0.0.1:4200

error connection, impossible to reach

ERR_CONNECTION_REFUSED

Expected Behavior

Load the page from server

Actual Behavior

impossible to reach

Diagnostic Logs

No response

jmar5439 avatar Jan 20 '23 15:01 jmar5439

Same here

andreluizweb avatar Jan 20 '23 21:01 andreluizweb

I can reach 127.0.0.1, but I keep losing localhost. Just started today, build 22623.1180

joemaller avatar Jan 21 '23 00:01 joemaller

Same here, but intermittent. Sometimes works, sometimes doesn't. Using Ubuntu 20.04 running PHP development server on port 8080.

SeriousKen avatar Jan 21 '23 09:01 SeriousKen

same here. Using npm start to run a react-app at ubuntu 22 - WSL 2 (5.15.83.1) - Win 11, localhost:3000 does not work. For me, the issue is the same one as been described here: https://github.com/microsoft/WSL/issues/4885

I tried to run python -m http.server, then localhost:8000 can be accessed at windows.

yejiyang avatar Jan 21 '23 12:01 yejiyang

Same here

tisy avatar Jan 21 '23 14:01 tisy

Also intermittent for me. The connection will either be immediately refused upon attempting to load the npm start-run page, or it will start to fail after a few minutes of using it. I've never gotten it to work for more than a few minutes.

$ wsl.exe --version
WSL version: 1.1.0.0
Kernel version: 5.15.83.1
WSLg version: 1.0.48
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1192

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

fishfacemcgee avatar Jan 21 '23 15:01 fishfacemcgee

Also intermittent for me.

Versão do WSL: 1.1.0.0 Versão do kernel: 5.15.83.1 Versão do WSLg: 1.0.48 Versão do MSRDC: 1.2.3770 Versão do Direct3D: 1.608.2-61064218 Versão do DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows versão: 10.0.25281.1000

Downgrade to 1.0.3.0, and ok

Versão do WSL: 1.0.3.0 Versão do kernel: 5.15.79.1 Versão do WSLg: 1.0.47 Versão do MSRDC: 1.2.3575 Versão do Direct3D: 1.606.4 Versão do DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows versão: 10.0.25281.1000

ghost avatar Jan 21 '23 18:01 ghost

For those who experience the issue, what is the output of Get-NetTCPConnection -LocalAddress 127.0.0.1? I can't repro on 10.0.22623.1180 running on a DevKit 2023. It's an aarch64 OS but it shouldn't make any difference.

WSL2 version used for testing:

WSL version: 1.1.0.0
Kernel version: 5.15.83.1
WSLg version: 1.0.48
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22623.1180

With two WSL instances running the requests to localhost are executed every time:

Debian instance:

toor@volterra:~/test$ node app.js
Server running at http://127.0.0.1:4200/
{ host: 'localhost:4200', 'user-agent': 'curl/7.83.1', accept: '*/*' }
{ host: '127.0.0.1:4200', 'user-agent': 'curl/7.83.1', accept: '*/*' }
{ host: '127.0.0.1:4200', 'user-agent': 'curl/7.83.1', accept: '*/*' }
{ host: '127.0.0.1:4200', 'user-agent': 'curl/7.83.1', accept: '*/*' }
{ host: 'localhost:4200', 'user-agent': 'curl/7.83.1', accept: '*/*' }

Ubuntu instance:

toor@volterra:~/test$ node app.js
Server running at http://127.0.0.1:4210/
{ host: '127.0.0.1:4210', 'user-agent': 'curl/7.83.1', accept: '*/*' }
{ host: 'localhost:4210', 'user-agent': 'curl/7.83.1', accept: '*/*' }
{ host: 'localhost:4210', 'user-agent': 'curl/7.83.1', accept: '*/*' }
{ host: '127.0.0.1:4210', 'user-agent': 'curl/7.83.1', accept: '*/*' }

Both instances are running the Hello World node sample app, on ports 4200 and 4210. Some output on Windows side:

PS C:\Users\zcobol> Get-NetTCPConnection -LocalAddress 127.0.0.1 | Format-Table -AutoSize

LocalAddress LocalPort RemoteAddress RemotePort State       AppliedSetting OwningProcess
------------ --------- ------------- ---------- -----       -------------- -------------
127.0.0.1    50519     127.0.0.1     50518      Established Internet       9340
127.0.0.1    50518     127.0.0.1     50519      Established Internet       9340
127.0.0.1    50517     127.0.0.1     50516      Established Internet       6184
127.0.0.1    50516     127.0.0.1     50517      Established Internet       6184
127.0.0.1    4210      0.0.0.0       0          Listen                     11504
127.0.0.1    4200      0.0.0.0       0          Listen                     11504

zcobol avatar Jan 21 '23 21:01 zcobol

@zcobol

After running the local npm http-server but without attempting to load the page

> Get-NetTCPConnection -LocalAddress 127.0.0.1 | Format-Table -AutoSize

LocalAddress LocalPort RemoteAddress RemotePort State       AppliedSetting OwningProcess
------------ --------- ------------- ---------- -----       -------------- -------------
127.0.0.1    65001     127.0.0.1     62684      Established Internet       44796
127.0.0.1    65001     0.0.0.0       0          Listen                     44796
127.0.0.1    63764     127.0.0.1     27060      Established Internet       31132
127.0.0.1    62782     127.0.0.1     56326      Established Internet       32092
127.0.0.1    62759     127.0.0.1     50572      Established Internet       24140
127.0.0.1    62684     127.0.0.1     65001      Established Internet       44796
127.0.0.1    60946     127.0.0.1     9229       SynSent     Internet       31660
127.0.0.1    60783     127.0.0.1     1120       TimeWait                   0
127.0.0.1    59538     0.0.0.0       0          Listen                     36476
127.0.0.1    57096     127.0.0.1     57095      Established Internet       36160
127.0.0.1    57095     127.0.0.1     57096      Established Internet       36160
127.0.0.1    57067     127.0.0.1     57066      Established Internet       48672
127.0.0.1    57066     127.0.0.1     57067      Established Internet       48672
127.0.0.1    56617     127.0.0.1     50449      Established Internet       10952
127.0.0.1    56326     127.0.0.1     62782      Established Internet       36476
127.0.0.1    56326     0.0.0.0       0          Listen                     36476
127.0.0.1    56325     0.0.0.0       0          Listen                     36476
127.0.0.1    55697     127.0.0.1     9010       Established Internet       31576
127.0.0.1    55681     127.0.0.1     9100       Established Internet       34744
127.0.0.1    55679     127.0.0.1     9010       Established Internet       33980
127.0.0.1    55629     127.0.0.1     55577      Established Internet       27992
127.0.0.1    55628     127.0.0.1     55627      Established Internet       27992
127.0.0.1    55627     127.0.0.1     55628      Established Internet       27992
127.0.0.1    55622     127.0.0.1     55577      Established Internet       30912
127.0.0.1    55621     127.0.0.1     55620      Established Internet       30912
127.0.0.1    55620     127.0.0.1     55621      Established Internet       30912
127.0.0.1    55577     127.0.0.1     55629      Established Internet       24424
127.0.0.1    55577     127.0.0.1     55622      Established Internet       24424
127.0.0.1    55577     0.0.0.0       0          Listen                     24424
127.0.0.1    55572     127.0.0.1     55571      Established Internet       31852
127.0.0.1    55571     127.0.0.1     55572      Established Internet       31852
127.0.0.1    55568     127.0.0.1     55567      Established Internet       31852
127.0.0.1    55567     127.0.0.1     55568      Established Internet       31852
127.0.0.1    55566     127.0.0.1     9977       Established Internet       24424
127.0.0.1    51962     127.0.0.1     51961      Established Internet       14708
127.0.0.1    51961     127.0.0.1     51962      Established Internet       38292
127.0.0.1    51961     0.0.0.0       0          Listen                     38292
127.0.0.1    51839     127.0.0.1     49675      Established Internet       14708
127.0.0.1    50590     127.0.0.1     50572      Established Internet       24140
127.0.0.1    50585     127.0.0.1     50572      Established Internet       24140
127.0.0.1    50583     127.0.0.1     50572      Established Internet       24140
127.0.0.1    50582     127.0.0.1     50572      Established Internet       23292
127.0.0.1    50581     127.0.0.1     50572      Established Internet       23292
127.0.0.1    50580     0.0.0.0       0          Listen                     24140
127.0.0.1    50579     0.0.0.0       0          Listen                     24140
127.0.0.1    50578     0.0.0.0       0          Listen                     23292
127.0.0.1    50572     127.0.0.1     62759      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50590      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50585      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50583      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50582      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50581      Established Internet       23036
127.0.0.1    50572     0.0.0.0       0          Listen                     23036
127.0.0.1    50524     127.0.0.1     9013       Established Internet       984
127.0.0.1    50523     127.0.0.1     1042       Established Internet       984
127.0.0.1    50519     127.0.0.1     17532      Established Internet       6856
127.0.0.1    50515     127.0.0.1     9012       Established Internet       6856
127.0.0.1    50449     127.0.0.1     56617      Established Internet       16332
127.0.0.1    50449     0.0.0.0       0          Listen                     16332
127.0.0.1    50339     127.0.0.1     9013       Established Internet       16424
127.0.0.1    50338     127.0.0.1     1042       Established Internet       16424
127.0.0.1    50335     127.0.0.1     1042       Established Internet       6084
127.0.0.1    50328     127.0.0.1     1042       Established Internet       2488
127.0.0.1    49675     127.0.0.1     51839      Established Internet       7840
127.0.0.1    49675     0.0.0.0       0          Listen                     7840
127.0.0.1    49585     127.0.0.1     49584      Established Internet       29600
127.0.0.1    49584     127.0.0.1     49585      Established Internet       29600
127.0.0.1    49536     127.0.0.1     49535      Established Internet       3512
127.0.0.1    49535     127.0.0.1     49536      Established Internet       3512
127.0.0.1    45654     0.0.0.0       0          Listen                     34744
127.0.0.1    45623     0.0.0.0       0          Listen                     36476
127.0.0.1    27339     0.0.0.0       0          Listen                     4
127.0.0.1    27060     127.0.0.1     63764      Established Internet       26768
127.0.0.1    27060     0.0.0.0       0          Listen                     26768
127.0.0.1    27019     0.0.0.0       0          Listen                     2920
127.0.0.1    22885     0.0.0.0       0          Listen                     3512
127.0.0.1    22112     0.0.0.0       0          Listen                     8332
127.0.0.1    17945     0.0.0.0       0          Listen                     6856
127.0.0.1    17532     127.0.0.1     50519      Established Internet       7728
127.0.0.1    17532     0.0.0.0       0          Listen                     7728
127.0.0.1    16494     0.0.0.0       0          Listen                     36456
127.0.0.1    15393     0.0.0.0       0          Listen                     36456
127.0.0.1    15292     0.0.0.0       0          Listen                     36456
127.0.0.1    13340     0.0.0.0       0          Listen                     8308
127.0.0.1    13339     0.0.0.0       0          Listen                     8268
127.0.0.1    13032     0.0.0.0       0          Listen                     6856
127.0.0.1    13031     0.0.0.0       0          Listen                     6856
127.0.0.1    13030     0.0.0.0       0          Listen                     8332
127.0.0.1    13010     0.0.0.0       0          Listen                     7728
127.0.0.1    9977      127.0.0.1     55566      Established Internet       31852
127.0.0.1    9977      0.0.0.0       0          Listen                     31852
127.0.0.1    9180      0.0.0.0       0          Listen                     8388
127.0.0.1    9100      127.0.0.1     55681      Established Internet       8388
127.0.0.1    9100      0.0.0.0       0          Listen                     8388
127.0.0.1    9080      0.0.0.0       0          Listen                     34744
127.0.0.1    9013      127.0.0.1     50524      Established Internet       2488
127.0.0.1    9013      127.0.0.1     50339      Established Internet       2488
127.0.0.1    9012      127.0.0.1     50515      Established Internet       2488
127.0.0.1    9010      127.0.0.1     55697      Established Internet       34744
127.0.0.1    9010      127.0.0.1     55679      Established Internet       34744
127.0.0.1    9010      0.0.0.0       0          Listen                     34744
127.0.0.1    8080      127.0.0.1     59429      TimeWait                   0
127.0.0.1    8080      127.0.0.1     59388      TimeWait                   0
127.0.0.1    6463      0.0.0.0       0          Listen                     27544
127.0.0.1    6342      0.0.0.0       0          Listen                     38712
127.0.0.1    6341      0.0.0.0       0          Listen                     38712
127.0.0.1    5566      0.0.0.0       0          Listen                     29600
127.0.0.1    1337      0.0.0.0       0          Listen                     8268
127.0.0.1    1120      127.0.0.1     60087      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60942      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60897      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60879      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60858      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60807      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60783      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60740      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60733      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60726      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60725      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60717      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60661      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60627      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60613      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60579      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60563      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60553      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60513      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60478      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60446      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60424      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60398      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60351      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60314      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60254      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60227      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60211      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60149      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60115      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60089      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60079      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60078      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60075      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60014      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59992      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59971      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59930      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59900      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59890      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59858      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59826      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59801      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59780      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59731      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59641      TimeWait                   0
127.0.0.1    1120      0.0.0.0       0          Listen                     9600
127.0.0.1    1042      127.0.0.1     50523      Established Internet       7036
127.0.0.1    1042      127.0.0.1     50338      Established Internet       7036
127.0.0.1    1042      127.0.0.1     50335      Established Internet       7036
127.0.0.1    1042      127.0.0.1     50328      Established Internet       7036

After attempting to load the page and immediately having the request fail

> Get-NetTCPConnection -LocalAddress 127.0.0.1 | Format-Table -AutoSize

LocalAddress LocalPort RemoteAddress RemotePort State       AppliedSetting OwningProcess
------------ --------- ------------- ---------- -----       -------------- -------------
127.0.0.1    65001     127.0.0.1     62684      Established Internet       44796
127.0.0.1    65001     0.0.0.0       0          Listen                     44796
127.0.0.1    63764     127.0.0.1     27060      Established Internet       31132
127.0.0.1    62782     127.0.0.1     56326      Established Internet       32092
127.0.0.1    62759     127.0.0.1     50572      Established Internet       24140
127.0.0.1    62684     127.0.0.1     65001      Established Internet       44796
127.0.0.1    61127     127.0.0.1     9229       SynSent     Internet       31660
127.0.0.1    60783     127.0.0.1     1120       TimeWait                   0
127.0.0.1    59538     0.0.0.0       0          Listen                     36476
127.0.0.1    57096     127.0.0.1     57095      Established Internet       36160
127.0.0.1    57095     127.0.0.1     57096      Established Internet       36160
127.0.0.1    57067     127.0.0.1     57066      Established Internet       48672
127.0.0.1    57066     127.0.0.1     57067      Established Internet       48672
127.0.0.1    56617     127.0.0.1     50449      Established Internet       10952
127.0.0.1    56326     127.0.0.1     62782      Established Internet       36476
127.0.0.1    56326     0.0.0.0       0          Listen                     36476
127.0.0.1    56325     0.0.0.0       0          Listen                     36476
127.0.0.1    55697     127.0.0.1     9010       Established Internet       31576
127.0.0.1    55681     127.0.0.1     9100       Established Internet       34744
127.0.0.1    55679     127.0.0.1     9010       Established Internet       33980
127.0.0.1    55629     127.0.0.1     55577      Established Internet       27992
127.0.0.1    55628     127.0.0.1     55627      Established Internet       27992
127.0.0.1    55627     127.0.0.1     55628      Established Internet       27992
127.0.0.1    55622     127.0.0.1     55577      Established Internet       30912
127.0.0.1    55621     127.0.0.1     55620      Established Internet       30912
127.0.0.1    55620     127.0.0.1     55621      Established Internet       30912
127.0.0.1    55577     127.0.0.1     55629      Established Internet       24424
127.0.0.1    55577     127.0.0.1     55622      Established Internet       24424
127.0.0.1    55577     0.0.0.0       0          Listen                     24424
127.0.0.1    55572     127.0.0.1     55571      Established Internet       31852
127.0.0.1    55571     127.0.0.1     55572      Established Internet       31852
127.0.0.1    55568     127.0.0.1     55567      Established Internet       31852
127.0.0.1    55567     127.0.0.1     55568      Established Internet       31852
127.0.0.1    55566     127.0.0.1     9977       Established Internet       24424
127.0.0.1    51962     127.0.0.1     51961      Established Internet       14708
127.0.0.1    51961     127.0.0.1     51962      Established Internet       38292
127.0.0.1    51961     0.0.0.0       0          Listen                     38292
127.0.0.1    51839     127.0.0.1     49675      Established Internet       14708
127.0.0.1    50590     127.0.0.1     50572      Established Internet       24140
127.0.0.1    50585     127.0.0.1     50572      Established Internet       24140
127.0.0.1    50583     127.0.0.1     50572      Established Internet       24140
127.0.0.1    50582     127.0.0.1     50572      Established Internet       23292
127.0.0.1    50581     127.0.0.1     50572      Established Internet       23292
127.0.0.1    50580     0.0.0.0       0          Listen                     24140
127.0.0.1    50579     0.0.0.0       0          Listen                     24140
127.0.0.1    50578     0.0.0.0       0          Listen                     23292
127.0.0.1    50572     127.0.0.1     62759      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50590      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50585      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50583      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50582      Established Internet       23036
127.0.0.1    50572     127.0.0.1     50581      Established Internet       23036
127.0.0.1    50572     0.0.0.0       0          Listen                     23036
127.0.0.1    50524     127.0.0.1     9013       Established Internet       984
127.0.0.1    50523     127.0.0.1     1042       Established Internet       984
127.0.0.1    50519     127.0.0.1     17532      Established Internet       6856
127.0.0.1    50515     127.0.0.1     9012       Established Internet       6856
127.0.0.1    50449     127.0.0.1     56617      Established Internet       16332
127.0.0.1    50449     0.0.0.0       0          Listen                     16332
127.0.0.1    50339     127.0.0.1     9013       Established Internet       16424
127.0.0.1    50338     127.0.0.1     1042       Established Internet       16424
127.0.0.1    50335     127.0.0.1     1042       Established Internet       6084
127.0.0.1    50328     127.0.0.1     1042       Established Internet       2488
127.0.0.1    49675     127.0.0.1     51839      Established Internet       7840
127.0.0.1    49675     0.0.0.0       0          Listen                     7840
127.0.0.1    49585     127.0.0.1     49584      Established Internet       29600
127.0.0.1    49584     127.0.0.1     49585      Established Internet       29600
127.0.0.1    49536     127.0.0.1     49535      Established Internet       3512
127.0.0.1    49535     127.0.0.1     49536      Established Internet       3512
127.0.0.1    45654     0.0.0.0       0          Listen                     34744
127.0.0.1    45623     0.0.0.0       0          Listen                     36476
127.0.0.1    27339     0.0.0.0       0          Listen                     4
127.0.0.1    27060     127.0.0.1     63764      Established Internet       26768
127.0.0.1    27060     0.0.0.0       0          Listen                     26768
127.0.0.1    27019     0.0.0.0       0          Listen                     2920
127.0.0.1    22885     0.0.0.0       0          Listen                     3512
127.0.0.1    22112     0.0.0.0       0          Listen                     8332
127.0.0.1    17945     0.0.0.0       0          Listen                     6856
127.0.0.1    17532     127.0.0.1     50519      Established Internet       7728
127.0.0.1    17532     0.0.0.0       0          Listen                     7728
127.0.0.1    16494     0.0.0.0       0          Listen                     36456
127.0.0.1    15393     0.0.0.0       0          Listen                     36456
127.0.0.1    15292     0.0.0.0       0          Listen                     36456
127.0.0.1    13340     0.0.0.0       0          Listen                     8308
127.0.0.1    13339     0.0.0.0       0          Listen                     8268
127.0.0.1    13032     0.0.0.0       0          Listen                     6856
127.0.0.1    13031     0.0.0.0       0          Listen                     6856
127.0.0.1    13030     0.0.0.0       0          Listen                     8332
127.0.0.1    13010     0.0.0.0       0          Listen                     7728
127.0.0.1    9977      127.0.0.1     55566      Established Internet       31852
127.0.0.1    9977      0.0.0.0       0          Listen                     31852
127.0.0.1    9180      0.0.0.0       0          Listen                     8388
127.0.0.1    9100      127.0.0.1     55681      Established Internet       8388
127.0.0.1    9100      0.0.0.0       0          Listen                     8388
127.0.0.1    9080      0.0.0.0       0          Listen                     34744
127.0.0.1    9013      127.0.0.1     50524      Established Internet       2488
127.0.0.1    9013      127.0.0.1     50339      Established Internet       2488
127.0.0.1    9012      127.0.0.1     50515      Established Internet       2488
127.0.0.1    9010      127.0.0.1     55697      Established Internet       34744
127.0.0.1    9010      127.0.0.1     55679      Established Internet       34744
127.0.0.1    9010      0.0.0.0       0          Listen                     34744
127.0.0.1    6463      0.0.0.0       0          Listen                     27544
127.0.0.1    6342      0.0.0.0       0          Listen                     38712
127.0.0.1    6341      0.0.0.0       0          Listen                     38712
127.0.0.1    5566      0.0.0.0       0          Listen                     29600
127.0.0.1    1337      0.0.0.0       0          Listen                     8268
127.0.0.1    1120      127.0.0.1     61104      TimeWait                   0
127.0.0.1    1120      127.0.0.1     61083      TimeWait                   0
127.0.0.1    1120      127.0.0.1     61040      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60987      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60942      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60897      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60879      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60858      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60807      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60783      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60740      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60733      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60726      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60725      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60717      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60661      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60627      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60613      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60579      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60563      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60553      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60513      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60478      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60446      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60424      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60398      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60351      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60314      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60254      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60227      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60211      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60149      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60115      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60089      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60087      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60079      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60078      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60075      TimeWait                   0
127.0.0.1    1120      127.0.0.1     60014      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59992      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59971      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59930      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59900      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59890      TimeWait                   0
127.0.0.1    1120      127.0.0.1     59858      TimeWait                   0
127.0.0.1    1120      0.0.0.0       0          Listen                     9600
127.0.0.1    1042      127.0.0.1     50523      Established Internet       7036
127.0.0.1    1042      127.0.0.1     50338      Established Internet       7036
127.0.0.1    1042      127.0.0.1     50335      Established Internet       7036
127.0.0.1    1042      127.0.0.1     50328      Established Internet       7036

For context, the npm http-server is hosting it at 127.0.0.1:8080 and also hosts it on a 172.x.x.x address (also port 8080) which appears to work fine. It appears the problem is exclusive to 127.0.0.1 in this case.

fishfacemcgee avatar Jan 21 '23 21:01 fishfacemcgee

Same here, cannot reach 127.0.0.1 or localhost. I can ping it, but when accessing it from browser connection is refused. Happened after updating WSL2 from the Microsoft store. Have nginx, mysql setup in Ubuntu 20.04, cannot access either of them from Windows.

WSL version: 1.1.0.0
Kernel version: 5.15.83.1
WSLg version: 1.0.48
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1192

damchey avatar Jan 22 '23 05:01 damchey

This is a very strange issue. If I specifically bind an app to localhost:port it works accessing the app via 127.0.0.1 on Windows side.

Here is the hello world script used for testing:

const http = require('http');
const hostname = 'localhost';
const port = 3000;
const server = http.createServer((req, res) => {
 console.log(req.headers);
 res.statusCode = 200;
 res.end('<html><body><h1>Hello, World!</h1></body></html>');
})
// server.listen(port, hostname);
server.listen(port);

Run node index.js with port, hostname and port. It will fail when only port is being specified.


Release 1.1.0 has this change Make the localhost relay ignore conflicting binds. It could be this change causing the issue.

elsaco avatar Jan 22 '23 21:01 elsaco

Confirm this error. I'm try reinstall windows, and after update to 1.1.0.0 - wsl auto close port after 5-10 sec =(

FlexIDK avatar Jan 23 '23 08:01 FlexIDK

Downgraded to 1.0.3, this issue is not present there.

damchey avatar Jan 23 '23 08:01 damchey

Issue present here as well. I have to restart my Nginx server to make it work for a few minutes, then it looses the connection again. I will try to downgrade to 1.0.3. @damchey , can you let me know how you did that?

Levdbas avatar Jan 23 '23 12:01 Levdbas

Issue present here as well. I have to restart my Nginx server to make it work for a few minutes, then it looses the connection again. I will try to downgrade to 1.0.3. @damchey , can you let me know how you did that?

Try the following (with admin privileges):

# Install a specific version, e.g. a downgrade
# Download msixbundle bundle from GitHub, then execute the following command
# https://github.com/microsoft/WSL/releases/tag/1.0.3
powershell Add-AppxPackage -Path .\Microsoft.WSL_1.0.3.0_x64_ARM64.msixbundle -ForceUpdateFromAnyVersion -ForceApplicationShutdown

mickdewald avatar Jan 23 '23 12:01 mickdewald

This solution WSL/issues/9508 works for me. Excerpt:

$Package = Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemforLinux -AllUsers 
Remove-AppxPackage $Package -AllUsers
Add-AppxPackage .\Microsoft.WSL_1.0.3.0_x64_ARM64.msixbundle

I had an error like this on the last command:

Add-AppxPackage : Cannot find path 'C:\WINDOWS\system32\Microsoft.WSL_1.0.3.0_x64_ARM64.msixbundle' because it does
not exist.

But Remove-AppxPackage has already done the job - new 1.10 WSL was removed, and seems like system switched to in-box old version (but it's still WSL 2). Now everything works, and wslhost.exe continues to listen on ports. 👍🏻

fedotov2d avatar Jan 23 '23 12:01 fedotov2d

Issue present here as well. I have to restart my Nginx server to make it work for a few minutes, then it looses the connection again. I will try to downgrade to 1.0.3. @damchey , can you let me know how you did that?

Download manual: https://github.com/microsoft/WSL/releases/download/1.0.3/Microsoft.WSL_1.0.3.0_x64_ARM64.msixbundle And double-click to file

FlexIDK avatar Jan 23 '23 13:01 FlexIDK

Tried downgrading but still have issues. I can connect with the local wsl ip, but not with localhost. Any other approach / ideas?

ghost avatar Jan 23 '23 15:01 ghost

Tried downgrading but still have issues. I can connect with the local wsl ip, but not with localhost. Any other approach / ideas?

Did you restart wsl? wsl --shutdown Also a Windows reboot might help. Once I did that I did not have any problems at all.

mickdewald avatar Jan 23 '23 15:01 mickdewald

Tried wsl --shutdown, reboot, disable fast boot, disable all firewalls - still having issues connecting to both wsl docker images and node projects using localhost. Local ip works though...

ghost avatar Jan 23 '23 15:01 ghost