简体   繁体   中英

Add WSL to Windows Firewall

After launching my Node.js App which also requires BrowserSync everything is working fine and I can access the App via localhost:3000 and the given IPv4 address on the same machine running the app. But I cannot access it from my mobile or any other device on the same network without turning off the Windows default Firewall. It works great with Ubuntu on VirtualBox and just plain Windows without any issues and with an active Firewall. So it would be really nice if you know how to add an exception for WSL to the Windows Firewall Config so I don't have to turn it off completely every time :)

And by the way, I'm using Windows build 15063

Got firewall rule enabled correctly for Node?

http://imgur.com/a/Ln0N1

It is little bit tricky but easy enough. Just need to use Windows PowerShell as administrator instead of distro interface directly. Otherwise it won't work.

  • Right-click on Start menu.
  • Open PowerShell as administrator.
  • Type wsl .
  • Provide your credentials.
( Note: Now you are on the distro interface. For managing ' Windows Firewall ' with ' Ubuntu Firewall (ufw) ' commands type the following commands.)
\n:~#sudo service ufw start //for starting ufw \n:~#sudo systemctl enable ufw //for enabling ufw at system start up. \n&or  \n:~#sudo ufw enable //for enabling ufw at system start up. \n
Note: You need to start the ufw service first in order to work ufw commands for managing ' Windows Firewall '. And enable it at system start up with systemctl command.
The rest management commands are all same as main distro.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM