Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firewall blocking WSL 2

My firewall (Norton) is blocking WSL 2 from using the internet. I cannot ping even google.

When I turn the firewall off, everything works, and when I turn it back on again, it no longer works.

What rules do I have to set on the firewall to allow WSL to go through? Will it work for all firewalls or just Norton?

like image 844
RetAFVLib Avatar asked Sep 07 '20 22:09

RetAFVLib


People also ask

How do I enable WSL2 in my firewall?

Enabling WSL2 Support in Firewall Settings Locate PowerShell in the Start menu, right-click on it and select “Run as Administrator”. Now you can select WSL2 targets in VisualGDB dialogs and they will work out-of-the-box, just like WSL1 targets.

Does WSL have a firewall?

The good news is that WSL 2 supports Linux firewall implementations like iptables that can control network traffic. For example, after installing iptables, you can use the following command to block connections to port 80 and 443.

Does WSL2 require admin rights?

Administrator privileges in Windows are required to run OpenSSH in WSL. To run an OpenSSH server, run your WSL distribution (ie Ubuntu) or Windows Terminal as an administrator.


Video Answer


2 Answers

Whitelist C:\Windows\System32\bash.exe and C:\Windows\System32\wsl.exe in every antivirus software or firewall you use.

If that doesn't work, try adding the distro_name.exe file of you installed distro. You'll find a the distro_name.exe file inside a subfolder with you distro name in C:\Program Files\WindowsApps\

like image 121
zwxi Avatar answered Sep 24 '22 04:09

zwxi


My SSH it was blocked by Norton 360 in a mysterious way. But in the link below I found two temporary solutions that solves the problem to me. https://askubuntu.com/questions/1229456/ssh-fails-with-connection-timed-out-in-vpn-and-hangs-here-expecting-ssh2-msg

Setting MTU to 1200 solved it for me (Ubuntu 20.04): sudo ip li set mtu 1200 dev {dev}

or

Setting the KEX algorithm manually solves the problem.

Add KexAlgorithms ecdh-sha2-nistp521 to the corresponding SSH config, or add -oKexAlgorithms=ecdh-sha2-nistp521 to the command line args for one time use.

Reference (2019): https://superuser.com/a/1462220/555702

like image 32
Danniel Rocha Avatar answered Sep 22 '22 04:09

Danniel Rocha