How to configure firewall on Windows 2008 Server Core Computer using netsh.exe tool
The Windows 2008 Server Firewall is a host-based, bidirectional Firewall. The previous Windows Firewall filtered only inbound traffic but the new Firewall ships with Windows 2008 can control both inbound and outbound traffic.
Firewall on a Windows 2008 Server Core can be configured either with the netsh command at the command prompt or using the Windows Firewall with Advanced Security MMC snap-in from a remote Windows Server 2008 server.
How to enable remote management of Firewall on a Windows 2008 Server Core computer
To configure the Windows 2008 Server Core Firewall using MMC spap-in from a remote computer, you should enable remote management. To enable remote management of the firewall, execute the following command.
C:\>netsh advfirewall set current settings remotemanagement enable
How to disable Firewall on a Windows 2008 Server Core computer
To disable firewall on a Windows 2008 Server Core computer, use the netsh command as shown below.
C:\>netsh firewall set opmode mode=disable
How to enable Firewall on a Windows 2008 Server Core computer
To enable firewall on a Windows 2008 Server Core computer, use the netsh command as shown below.
C:\>netsh firewall set opmode mode=enable
How to view profile-specific properties on a Windows 2008 Server Core Firewall
To view Firewall profile-specific properties use netsh command as shown below. This command output show the general properties of domain, public and private profiles such as its state (whether it is enabled or disabled), the general firewall policy and other details.
C:\>netsh advfirewall show allprofiles
How to enable inbound connection on a TCP port on a Windows 2008 Server Core Firewall
To enable inbound connection on a TCP port, use the netsh command as shown below. The name of the rule is "WebPort", direction is inbound, protocol is TCP, port number is 80 and the firewall action is whether to allow.
If you want to block the connection, use "block" instead of allow.
C:\>netsh advfirewall firewall add rule name="WebPort" dir=in protocol=TCP localport=80 action=allow
How to allow network connections for a network application on a Windows 2008 Server Core Firewall
To allow network connections for a network application on a Windows 2008 Server Core Firewall, use the netsh command as shown below. The name of the rule is "MessengerApp", direction is inbound, program is the location of the executable, and the action is to allow.
If you want to block the connection, use "block" instead of allow.
C:\> netsh advfirewall firewall add rule name="MessengerApp" dir=in program="c:\programfiles\messenger\msmsgs.exe” action=allow