Some commands related to port

Check with netstat -an listening port

netsh firewall show state
netsh firewall show config

 

Set the port with netsh.exe program:

data collection

Collapse this table Expand this table
Command Description
show allowedprogram display allows programs.
show config Displays the detailed local configuration information.
show currentprofile display the current configuration file.
show icmpsetting Displays the ICMP settings.
show logging Displays the logging settings.
show opmode display mode of operation.
show portopening Displays the excepted ports.
show service display service.
show state Displays the current status information.
show notifications Displays the current notification settings.


Configuration

Collapse this table Expand this table
Command Description
add allowedprogram used to add excepted traffic by file name specified program.
set allowedprogram provided for modifying an existing program is permitted.
delete allowedprogram to delete an existing allowed program.
set icmpsetting specifies allowed ICMP traffic.
set logging is used to specify the global logging options for Windows Firewall, or for a specific connection (interface) specify logging options.
set opmode operating mode is used to specify the global Windows Firewall, or for a specific connection (interface) specifies the operation mode.
It means for adding add portopening excepted traffic by specifying a TCP or UDP port.
set portopening provided for modifying existing open TCP or UDP port.
delete portopening to delete an existing open TCP or UDP port.
set service is used to enable or drop RPC and DCOM traffic, file and printer sharing, and UPnP traffic.
set notifications for specifying whether to notify the user when a program attempts to open the port.
reset Resets firewall configuration to default settings. It provides the "Windows Firewall" interface "Restore Defaults" button the same function.

E.g:

netsh firewall add portopening TCP port number Port Name

netsh firewall delete portopening TCP port number

Name after netsh firewall set portopening TCP port number change

Guess you like

Origin www.cnblogs.com/hzjdpawn/p/11774206.html