13

I simply want to connect from my WSL2 Ubuntu installation to my host windows on port 8529.

What I tried:

This question has been ask quite a view times, but none of the usual answers worked for me.

Richard Burkhardt
  • 225
  • 1
  • 2
  • 12

3 Answers3

17

You can disable the firewall for the vEthernet (WSL) interface only. This way you will allow connections from WSL, while still having the firewall protect your computer from external threats.

  • Go to Firewall Settings and click on Advanced Settings
  • Click Windows Defender Firewall Properties
  • Select Public Profile tab
  • Click Customize Protected network connections enter image description here
  • Unclick vEthernet (WSL)
jira
  • 286
1

Well, in my case I use CentOS 7 WSL App. I didn't have success manage on Norton 360. So in In Rules (I don't how is on English SO) I've added do CentOS 7 app. And worked for me.

CentOS 7:
CentOS 7

And I have success to ping to google.com

Destroy666
  • 12,350
1

Because Windows randomly turns on the firewall without your acknowledge, enforce a cron job to disable it might be the only compromised solution. Partially from @sudoqux

# run as Admin and in windows powershell
$option = New-ScheduledJobOption -RunElevated -RequireNetwork
$atLogin = New-JobTrigger -AtLogOn -User *
$atInterval = New-JobTrigger -Once -RepeatIndefinitely -RepetitionInterval "00:10:00" -At "0am"
Register-ScheduledJob -Name "F wsl firewall" -ScheduledJobOption $option -Trigger $atLogin, $atInterval -ScriptBlock {
    Set-NetFirewallProfile -Profile Public -DisabledInterfaceAliases "vEthernet (WSL)";
}

(I know basically nothing about windows powershell, so please let me know if I'm wrong.)

Also don't forget to enable inbound rules on the "Windows" host side.

(Anyway, I don't see any meaningful reasons to reject all of the outgoing connections on WSL to host, considering the host already had its inbound rules.)