Home > Articles > Microsoft > MCTS

  • Print
  • + Share This
This chapter is from the book

Windows Firewall

Windows Firewall is a packet filter and stateful host-based firewall that allows or blocks network traffic according to the configuration. A packet filter protects the computer by using an access control list (ACL), which specifies which packets are allowed through the firewall based on IP address and protocol (specifically the port number). A stateful firewall monitors the state of active connections and uses the information gained to determine which network packets are allowed through the firewall. Typically, if the user starts communicating with an outside computer, it remembers the conversation and allows the appropriate packets back in. If an outside computer tries to start communicating with a computer protected by a stateful firewall, those packets are dropped automatically unless access was granted by the ACL.

Compared to Windows Firewall introduced with Windows XP SP2, the Windows Firewall used with Windows Server 2008 has some major improvements, including the following:

  • Windows Firewall supports IPv6 connection filtering.
  • By using outbound packet filtering, you can help protect the computer againt spyware and viruses that attempt to contact outside computers.
  • With the advanced packet filter, rules can also be specified for source and destination IP addresses and port ranges.
  • Rules can be configured for services by the service name chosen from a list, without needing to specify the full path filename.
  • IPSec is fully integrated with Windows Firewall, allowing connections to be allowed or denied based on security certificates, Kerberos authentication, and so on. Encryption can also be required for any kind of connection.
  • A new management console snap-in named Windows Firewall with Advanced Security provides access to many advanced options and enables remote administration.
  • You can use separate firewall profiles for when computers are domain-joined or connected to a private or public network.

Basic Configuration

Windows Firewall is on by default. When Windows Firewall is on, most programs are blocked from communicating through the firewall. If you want to unblock a program, you can add it to the Exceptions list (on the Exceptions tab). For example, you might not be able to send photos in an instant message until you add the instant messaging program to the Exceptions list. To add a program to the Exceptions list, click the Add program button and select it from the available list or browse for it by clicking the Browse button.

To turn on or off Windows Firewall, follow these steps:

  1. Open Windows Firewall by clicking the Start button, clicking Control Panel, clicking Security, and then clicking Windows Firewall.
  2. Click Turn Windows Firewall On or Off (see Figure 5.3). If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

    Figure 5.3

    Figure 5.3 Windows Firewall options in the Control Panel.

  3. Click On (recommended) or Off (not recommended) and then click OK.

If you want the firewall to block everything, including the programs selected on the Exceptions tab, select the Block All Incoming Connections check box. Block All Incoming Connections blocks all unsolicited attempts to connect to your computer. Use this setting when you need maximum protection for your computer, such as when you connect to a public network in a hotel or airport, or when a computer worm is spreading over the Internet. With this setting, you are not notified when Windows Firewall blocks programs, and programs on the Exceptions list are ignored.

The Windows Firewall Settings interface has three tabs:

  • General: Enables you to turn Windows Firewall on and off, as well as to block all incoming connections, no matter how you have configured the exceptions.
  • Exceptions: Enables you to configure programs and ports for which you want to allow communication into and out from your Windows Vista computer. Only create an exception that is specifically required, and remove exceptions that you no longer need. Never create an exception for a program when you are unsure of the functionality of that program.
  • Advanced: Enables you to select the network interfaces that you want Windows Firewall to protect.

To configure programs as exceptions,

  1. Open Windows Firewall by clicking Start > Control Panel > Security > Windows Firewall.
  2. Click Allow a program through Windows Firewall. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
  3. In the Windows Firewall dialog box, select the Exceptions tab and then click Add Program.
  4. In the Add A Program dialog box, select the program in the Programs list or click Browse to use the Browse dialog box to find the program.
  5. By default, any computer, including those on the Internet, can access this program remotely. To restrict access further, click Change Scope.
  6. Click OK three times to close all open dialog boxes.

To open a port in Windows Firewall,

  1. Open Windows Firewall by clicking the Start button, clicking Control Panel, clicking Security, and then clicking Windows Firewall.
  2. Click Allow a program through Windows Firewall. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
  3. Click Add port.
  4. In the Name box, type a name that will help you remember what the port is used for.
  5. In the Port number box, type the port number.
  6. Click TCP or UDP, depending on the protocol.
  7. By default, any computer, including those on the Internet, can access this program remotely. To change scope for the port, click Change scope, and then click the option that you want to use. (“Scope” refers to the set of computers that can use this port opening.)
  8. Click OK two times to close all open dialog boxes.

Windows Firewall with Advanced Security

Similar to the Windows Firewall with Advanced Security introduced in Windows Vista, the Windows Firewall with Advanced Security in Windows Server 2008 is a Microsoft Management Console (MMC) snap-in that allows you to set up and view detailed inbound and outbound rules and integrate with Internet Protocol security (IPSec).

The Windows Firewall with Advanced Security management console enables you to configure:

  • Inbound rules: Windows Firewall will block all incoming traffic unless solicited or allowed by a rule.
  • Outbound rules: Windows Firewall will allow all outbound traffic unless blocked by a rule.
  • Connection security rules: Windows Firewall uses a connection security rule to force two peer computers to authenticate before they can establish a connection and to secure information transmitted between the two computers. Connection security rules use IPsec to enforce security requirements. Connection security rules will be explained more in the next chapter.
  • Monitoring: Windows Firewall uses the monitoring interface to display information about current firewall rules, connection security rules, and security associations.

Windows Firewall is on by default. When Windows Firewall is on, most programs are blocked from communicating through the firewall. If you want to unblock a program, you can add it to the Exceptions list (on the Exceptions tab). For example, you might not be able to send photos in an instant message until you add the instant messaging program to the Exceptions list. To add a program to the Exceptions list, see Allow a program to communicate through Windows Firewall.

To turn on or off Windows Firewall:

  1. Open Windows Firewall with Advanced Security located in Administrative Tools.
  2. Click the Windows Firewall Properties.
  3. Under Firewall state, Select either On (recommended) or Off (not recommended) and click the OK button. See Figure 5.4.
    Figure 5.4

    Figure 5.4 Windows Firewall properties.

Creating Inbound and Outbound Rules

You create inbound rules to control access to your computer from the network. Inbound rules can prevent

  • Unwanted software being copied to your computer
  • Unknown or unsolicited access to data on your computer
  • Unwanted configuration of your computer from remote locations

To configure advanced properties for a rule using the Windows Firewall with Advanced Security, follow these steps:

  1. Right-click the name of the inbound rule and click Properties.
  2. From the properties dialog box for an inbound rule, configure settings on the following tabs:

    • General: The rule’s name, the program to which the rule applies, and the rule’s action (allow all connections, allow only secure connections, or block).
    • Programs and Services: The programs or services to which the rule applies.
    • Users and Computers: If the rule’s action is to allow only secure connections, the computer accounts that are authorized to make protected connections.
    • Protocols and Ports: The rule’s IP protocol, source and destination TCP or UDP ports, and ICMP or ICMPv6 settings.
    • Scope: The rule’s source and destination addresses.
    • Advanced: The profiles or types of interfaces to which the rule applies.

You can also use the Windows Firewall with Advanced Security to create outbound rules to control access to network resources from your computer. Outbound rules can prevent:

  • Utilities on your computer accessing network resources without your knowledge.
  • Utilities on your computer downloading software without your knowledge.
  • Users of your computer downloading software without your knowledge.

Determining a Firewall Profile

A firewall profile is a way of grouping settings, such as firewall rules and connection security rules that are applied to the computer, depending on where the computer is connected. On computers running this version of Windows, there are three profiles for Windows Firewall with Advanced Security. Only one profile is applied at a time.

The available profiles are

  • Domain: Applied when a computer is connected to a network in which the computer’s domain account resides.
  • Private: Applied when a computer is connected to a network in which the computer’s domain account does not reside, such as a home network. The private settings should be more restrictive than the domain profile settings.
  • Public: Applied when a computer is connected to a domain through a public network, such as those available in airports and coffee shops. The public profile settings should be the most restrictive because the computer is connected to a public network where the security cannot be as tightly controlled as within an IT environment.

Using netsh Command to Configure the Windows Firewall

To view the current firewall configuration, including ports that have been opened, use the following command:

netsh firewall show state

To open ports at the firewall for DNS (port 53), use the following command:

netsh firewall add portopening ALL 53 DNS-server

To view the firewall configuration, use the following command:

netsh firewall show config

To enter the netsh advfirewall context, at the command prompt, type

netsh

When you enter the netsh context, the command prompt displays the >netsh prompt. At the >netsh prompt, enter the advfirewall context type:

advfirewall

After you are in the advfirewall context, you can type commands in that context.

Commands include the following:

  • Export: Exports the current firewall policy to a file.
  • Help: Displays a list of available commands.
  • Import: Imports a policy from the specified file.
  • Reset: Restores Windows Firewall with Advanced Security to the default policy.
  • Set: Supports the following commands:

    • set file: Copies the console output to a file.
    • set machine: Sets the current machine on which to operate.
    • show: Shows the properties for a particular profile. Examples include show allprofiles, show domainprofile, show privateprofile and show publicprofile.

In addition to the commands available for the advfirewall context, advfirewall also supports several subcontexts. To enter a subcontext, type the name of the subcontext at the netsh advfirewall> prompt. The available subcontexts are

  • consec: Enables you to view and configure computer security connection rules
  • Firewall: Enables you to view and configure firewall rules
  • Monitor: Enables you to view and set monitoring configuration

Managing Windows Firewall with Advanced Security via Group Policy

To centralize the configuration of large numbers of computers in an organization network that uses the Active Directory directory service, you can deploy settings for Windows Firewall with Advanced Security through Group Policy. Group Policy provides access to the full feature set of Windows Firewall with Advanced Security, including profile settings, rules, and computer connection security rules.

  • + Share This
  • 🔖 Save To Your Account