Home > OS >  How to use a batch file, to prohibit the machine with an IP any communication
How to use a batch file, to prohibit the machine with an IP any communication

Time:09-29

How to use a batch file, to prohibit the machine with an IP any communication

CodePudding user response:

Batch setup firewall?

CodePudding user response:

Self-built a batch file, enter the following command to change the IP (9.9.9.9/32) to the target IP or IP segment, and then can be run by the administrator,
Netsh advfilewall set publicprofile state on
Netsh advfirewall firewall rule name="Block" dir=in the add action=Block remoteip="9.9.9.9/32"
Netsh advfirewall firewall add rule name="Block" dir=out action=Block remoteip="9.9.9.9/32"

Explanation:
The first command is to start the firewall
The machine with the IP address of the second command ban 9.9.9.9 inbound link
The machine with the IP address of the third command ban 9.9.9.9 outbound connection

CodePudding user response:

Case on the "Block" is the name of a custom firewall rules can be defined by oneself,
  • Related