Need to adjust the rule

Peter_1985 2,526 Reputation points
2020-11-04T04:53:21.757+00:00

Hi,
How to adjust the following
netsh advfirewall firewall add rule name="FTP1" dir=in action=allow protocol=TCP localport=20

to add new range to firewall rule below?
37199-1g.png

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,170 questions
Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,758 questions
Windows Server Infrastructure
Windows Server Infrastructure
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Infrastructure: A Microsoft solution area focused on providing organizations with a cloud solution that supports their real-world needs and meets evolving regulatory requirements.
515 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

Accepted answer
  1. Candy Luo 12,656 Reputation points Microsoft Vendor
    2020-11-04T06:43:13.17+00:00

    Hi ,

    Please use the following command:

    netsh advfirewall firewall add rule name="FTP1" dir=in action=allow protocol=TCP localport=20 remoteip=192.168.1.1-192.168.1.100,157.60.0.1,172.16.0.0/16  
    

    As the picture below:

    37330-image.png

    Best Regards,

    Candy

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Candy Luo 12,656 Reputation points Microsoft Vendor
    2020-11-04T07:22:12.51+00:00

    Hi ,

    The netsh advfirewall firewall add rule command is used to adds a new inbound or outbound firewall rule that filters traffic by allowing or blocking network packets that match the specified criteria.

    You can see the syntax below:

    37390-image.png

    There is no parameter about Custom rule type.

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Candy Luo 12,656 Reputation points Microsoft Vendor
    2020-11-05T02:15:08.177+00:00

    Hi Jackson,

    Please use the following command:

    netsh advfirewall firewall set rule name="FTP1" new remoteIP=192.168.1.1-192.168.1.100,157.60.0.1,172.16.0.0/16  
    

    As the picture below:

    37602-image.png

    The syntax for the command can be viewed by issuing a netsh advfirewall firewall set rule /? command.

    Please try to accept the useful reply as answer as it will encourage the person who help you. Appreciate your understanding. :)

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  3. Peter_1985 2,526 Reputation points
    2020-11-04T06:50:28.027+00:00

    Hi,
    How about the rule that is created as "Custom" below?
    37319-1h.png

    0 comments No comments

  4. Peter_1985 2,526 Reputation points
    2020-11-05T01:55:32.12+00:00

    Thanks.
    Is there one example to modify one existing rule by adding more Remote IP (or range) to the rule?

    0 comments No comments