All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Windows firewall configuration

Last updated:2021-08-03 18:56:33

Configure firewall rules

Allow pings (ICMP echo replies).

netsh firewall set icmpsetting type=ALL mode=enable

Allow DHCP requests (ports 67 and 68).

netsh advfirewall firewall set portopening udp 67 enable 
netsh advfirewall firewall set portopening udp 68 enable

Or

netsh firewall set portopening udp 67 enable 
netsh firewall set portopening udp 68 enable

Allow the remote desktop protocol (RDP) (port 3389).

netsh firewall set portopening TCP 3389 ENABLE

Allow the IIS service (port 80).

netsh firewall set portopening TCP 80 ENABLE

Allow the HTTPS service (port 443).

netsh firewall set portopening TCP 443 ENABLE

Port 445 is prohibited by ISPs and is unavailable.

Windows firewall

A firewall assists and ensures information security by permitting or blocking data packets based on specific rules. A firewall can be a dedicated hardware device or software running on ordinary hardware. The Windows firewall is software provided by the Windows operating system.

CMD commands

? // Display the command list. 
add // Add the firewall configuration.   
delete // Delete the firewall configuration.   
dump // Display a configuration script.   
help // Display the command list.  
reset // Restore the firewall configuration to default settings. 
set // Set the firewall configuration. 
show // Display the firewall configuration.  
add allowedprogram // Add the program configuration permitted by the firewall.
add portopening // Add the firewall port configuration.   
delete allowedprogram // Delete the program configuration permitted by the firewall.
delete portopening // Delete the firewall port configuration.
set allowedprogram // Set the program configuration permitted by the firewall.
set icmpsetting // Set the firewall ICMP configuration.
set logging // Set the firewall record configuration.
set multicastbroadcastresponse // Set the firewall multicast/broadcast response configuration.
set notifications // Set the firewall notification configuration.
set opmode // Set the firewall operating configuration.
set portopening // Set the firewall port configuration.
set service // Set the firewall service configuration.
show allowedprogram // Display the program configuration permitted by the firewall.
show config // Display the firewall configuration. 
show currentprofile // Display the current firewall configuration file.
show icmpsetting // Display the firewall ICMP configuration.
show logging // Display the firewall record configuration.
show multicastbroadcastresponse // Display the firewall multicast/broadcast response configuration.
show notifications // Display the firewall notificationconfiguration.
show opmode // Display the firewall operating configuration.
show portopening // Display the firewall port configuration.
show service // Display the firewall service configuration.
show state // Display the current firewall status.

Example

netsh firewall show allowedprogram //Display programs permitted by the firewall.
netsh firewall set portopening TCP 445 ENABLE //Open port 445. 
netsh firewall set portopening TCP 3389 ENABLE //Open port 3389.
netsh firewall delete allowedprogram C:\A.exe //Delete the configuration for permitting program A.exe.
netsh firewall set allowedprogram C:\A.exe A ENABLE //Allow program A.exe on disk C.
netsh firewall add allowedprogram C:\A.exe A ENABLE //Allow program A.exe on disk C. 
netsh firewall set icmpsetting type=ALL mode=enable //Enable the ICMP protocol.
netsh firewall set icmpsetting type=2 mode=enable //Allow Jumbo outgoing packets.
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback