Discord Server Twitter Donation Youtube Google+
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use command-line firewall on windows
#1
I recommend that you use the netsh advfirewall to control firewall behavior on windows. 

Run Command Prompt as Admin.

First thing is to see what is happening with the firewall. So type this Command: netsh advfirewall show allprofiles

By default, you should see three separate listings here: Domain profile settings, private profile settings and public profile settings.

State means if the firewall is turned on or off. The Firewall Policy tells you what inbound and outbound policies are being applied to each profile.

To disable the firewall for a specific profile, you would use the following command:

netsh advfirewall set privateprofile state off


Commands: 

Enable a Port:
netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80


Delete enabled programs or ports:
Program: netsh advfirewall firewall delete rule name=rule name program="C:\MyApp\MyApp.exe"

Port: netsh advfirewall firewall delete rule name=rule name protocol=udp localport=500


Set logging: Run the following commands >

netsh advfirewall set currentprofile logging filename %systemroot%\system32\LogFiles\Firewall\pfirewall.log

netsh advfirewall set currentprofile logging maxfilesize 4096
netsh advfirewall set currentprofile logging droppedconnections enable

netsh advfirewall set currentprofile logging allowedconnections enable



Enable Windows firewall:
Netsh advfirewall set currentprofile state on
netsh advfirewall set currentprofile firewallpolicy blockinboundalways,allowoutbound
Reply




Users browsing this thread: 2 Guest(s)