Windows Firewall: How to setup a Port Range
As most of you know, using the Windows Firewall GUI will not allow you to open a range of ports easily. This becomes a nightmare if you need to open up Passive FTP ports (port #’s 60,000 – 65,000). By issuing the following command we can easily open all 5,000 ports in a matter of seconds:
FOR /L %I IN (60000,1,65000) DO netsh firewall add portopening TCP %I "Passive FTP"%I
Ok, now let’s break the above command down to understand what’s going on.
FOR /L %I IN (Minimum_Port,increment,Maximum_Port) DO netsh firewall add portopening PROTOCOL %I "Name Of Rule"%I
Here are the values:
Minimum_Port = The lowest port # in the range that you would like to open.
Maximum_Port = The Highest port # in the range that you would like to open.
Increment = This should almost always be 1, unless you need to open every other port….which does not make sense
PROTOCOL = Either TCP or UDP
Name Of Rule = Name the rule whatever you’d like, in my first example, it’s simply “Passive FTP” That’s it. Have fun opening port ranges!
No comments yet.