Skip to content

Add "allow" rule to Windows firewall for WSL2 network #4585

@throwable-one

Description

@throwable-one

I was trying to connect to Windows machine from Linux and found that it is blocked by default.

WSL virtual NIC connection belongs to "Public" profile and almost all connections are forbidden.

As workaround, I added following rule explicitly:

PS C:\WINDOWS\system32> $myIp = (Ubuntu1804 run "cat /etc/resolv.conf | grep nameserver | cut -d' ' -f2")
PS C:\WINDOWS\system32> $myIp
172.21.0.1
PS C:\WINDOWS\system32>  New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -LocalAddress $myIp -Action Allow

Workaround works. But it would be great to have this rule enabled by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions