Отключение брандмауэра windows 2003

Windows firewall can be enabled/disabled from command line using netsh command.

Windows 10 / Windows 8/ Windows 7 / Server 2008 /Vista:

Let’s see the syntax of netsh advfirewall to configure firewall on these Windows versions.  Firewall settings are different for each of the 3 networks(Domain, private, public). So based on which network firewall you want to enable/disable, the command would vary.

You can turn on firewall for the current network profile(does not matter if it’s domain/private/public network) using the below command.

netsh advfirewall set currentprofile state on

Turn off firewall for the current profile:

netsh advfirewall set  currentprofile state off

These commands should be run from an elevated administrator command prompt. Otherwise you would get the below error.

C:\>netsh advfirewall set  currentprofile state on
The requested operation requires elevation (Run as administrator).

To enable/disable firewall for a specific network profile, you can use the below commands.

Domain network

Turn on Domain network firewall:

netsh advfirewall set domainprofile state on

Turn off domain network firewall:

netsh advfirewall set domainprofile state off

Private network

Turn on private network firewall:

netsh advfirewall set privateprofile state on

Turn off private network firewall:

netsh advfirewall set privateprofile state off

Public network

Turn on public network firewall:

netsh advfirewall set publicprofile state on

Turn off public network firewall:

netsh advfirewall set publicprofile state off

Configure for all networks

Turn on firewall for all networks

netsh advfirewall set allprofiles state on

Turn off firewall for all networks

netsh advfirewall set  allprofiles state off

Older Windows versions – XP / Server 2003:

Below is the command to turn on firewall.

netsh firewall set opmode mode=ENABLE

The command to turn off firewall is:

netsh firewall set opmode mode=DISABLE

Administrator privileges are required to configure firewall so above command can be run only from admin accounts.

netsh firewall is deprecated in new versions.

In Windows 10/ 8 / 7 / Vista/ Server 2008, ‘netsh firewall‘ command prints message like below.

c:\>netsh firewall set opmode mode=ENABLE
IMPORTANT: "netsh firewall" is deprecated;
use "netsh advfirewall firewall" instead. Though the command still works,
 it's preferable to use the new set of commands provided with netsh command.

Related Posts:
How to turn off firewall in Windows 7

Enable the Firewall and DO NOT Allow Port/Program Exceptions:

C:\Documents and Settings\metasploit\netsh firewall set opmode enable disable

Ok.

C:\Documents and Settings\metasploit\netsh firewall show opmode

Domain profile configuration:

-------------------------------------------------------------------

Operational mode                  = Enable

Exception mode                    = Enable

Standard profile configuration (current):

-------------------------------------------------------------------

Operational mode                  = Enable

Exception mode                    = Disable

Local Area Connection firewall configuration:

-------------------------------------------------------------------

Operational mode                  = Enable

Enable Firewall and Allow Port/Program Exceptions:

C:\Documents and Settings\metasploit>netsh firewall set opmode enable enable

Ok.

C:\Documents and Settings\metasploit>netsh firewall show opmode

Domain profile configuration:

-------------------------------------------------------------------

Operational mode                  = Enable

Exception mode                    = Enable

Standard profile configuration (current):

-------------------------------------------------------------------

Operational mode                  = Enable

Exception mode                    = Enable

Local Area Connection firewall configuration:

-------------------------------------------------------------------

Operational mode                  = Enable

Disable the Firewall:

C:\Documents and Settings\metasploit>netsh firewall set opmode disable

Ok.

C:\Documents and Settings\metasploit>netsh firewall show opmode

Domain profile configuration:

-------------------------------------------------------------------

Operational mode                  = Enable

Exception mode                    = Enable

Standard profile configuration (current):

-------------------------------------------------------------------

Operational mode                  = Disable

Exception mode                    = Enable

Local Area Connection firewall configuration:

-------------------------------------------------------------------

Operational mode                  = Enable

Add/Modify program-based exception using command line

C:\Documents and Settings\metasploit>netsh firewall add allowedprogram

The syntax supplied for this command is not valid. Check help for the correct syntax.

add allowedprogram

[ program = ] path

[ name = ] name

[ [ mode = ] ENABLE|DISABLE

[ scope = ] ALL|SUBNET|CUSTOM

[ addresses = ] addresses

[ profile = ] CURRENT|DOMAIN|STANDARD|ALL ]

Adds firewall allowed program configuration.

Parameters:

program - Program path and file name.

name - Program name.

mode - Program mode (optional).

ENABLE  - Allow through firewall (default).

DISABLE - Do not allow through firewall.

scope - Program scope (optional).

ALL    - Allow all traffic through firewall (default).

SUBNET - Allow only local network (subnet) traffic through firewall.

CUSTOM - Allow only specified traffic through firewall.

addresses - Custom scope addresses (optional).

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

Remarks: 'scope' must be 'CUSTOM' to specify 'addresses'.

Examples:

add allowedprogram C:\MyApp\MyApp.exe MyApp ENABLE

add allowedprogram C:\MyApp\MyApp.exe MyApp DISABLE

add allowedprogram C:\MyApp\MyApp.exe MyApp ENABLE CUSTOM

157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet

add allowedprogram program = C:\MyApp\MyApp.exe name = MyApp mode = ENABLE

add allowedprogram program = C:\MyApp\MyApp.exe name = MyApp mode = DISABLE

add allowedprogram program = C:\MyApp\MyApp.exe name = MyApp mode = ENABLE

scope = CUSTOM addresses =

157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet

Delete existing program-based exception using command line

netsh firewall delete allowedprogram

C:\Documents and Settings\metasploit>netsh firewall delete allowedprogram

The syntax supplied for this command is not valid. Check help for the correct syntax.

delete allowedprogram

[ program = ] path

[ [ profile = ] CURRENT|DOMAIN|STANDARD|ALL ]

Deletes firewall allowed program configuration.

Parameters:

program - Program path and file name.

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

Examples:

delete allowedprogram C:\MyApp\MyApp.exe

delete allowedprogram program = C:\MyApp\MyApp.exe

Add/Modify port-based exception using command line

netsh firewall add portopening

Used to create a port-based exception.

netsh firewall set portopening

Used to modify the settings of an existing port-based exception.Syntax and parameters of commands add and setare identical.

C:\Documents and Settings\metasploit>netsh firewall add portopening

The syntax supplied for this command is not valid. Check help for the correct syntax.

add portopening

[ protocol = ] TCP|UDP|ALL

[ port = ] 1-65535

[ name = ] name

[ [ mode = ] ENABLE|DISABLE

[ scope = ] ALL|SUBNET|CUSTOM

[ addresses = ] addresses

[ profile = ] CURRENT|DOMAIN|STANDARD|ALL

[ interface = ] name ]

Adds firewall port configuration.

Parameters:

protocol - Port protocol.

TCP - Transmission Control Protocol (TCP).

UDP - User Datagram Protocol (UDP).

ALL - All protocols.

port - Port number.

name - Port name.

mode - Port mode (optional).

ENABLE  - Allow through firewall (default).

DISABLE - Do not allow through firewall.

scope - Port scope (optional).

ALL    - Allow all traffic through firewall (default).

SUBNET - Allow only local network (subnet) traffic through firewall.

CUSTOM - Allow only specified traffic through firewall.

addresses - Custom scope addresses (optional).

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

interface - Interface name (optional).

Remarks: 'profile' and 'interface' may not be specified together.

'scope' and 'interface' may not be specified together.

'scope' must be 'CUSTOM' to specify 'addresses'.

Examples:

add portopening TCP 80 MyWebPort

add portopening UDP 500 IKE ENABLE ALL

add portopening ALL 53 DNS ENABLE CUSTOM

157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet

add portopening protocol = TCP port = 80 name = MyWebPort

add portopening protocol = UDP port = 500 name = IKE mode = ENABLE scope =ALL

add portopening protocol = ALL port = 53 name = DNS mode = ENABLE

scope = CUSTOM addresses =

157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet

Delete existing port-based exception using command line

netsh firewall delete portopening

Used to delete an existing port-based exception.

C:\Documents and Settings\metasploit>netsh firewall delete portopening

The syntax supplied for this command is not valid. Check help for the correct sntax.

delete portopening

[ protocol = ] TCP|UDP|ALL

[ port = ] 1-65535

[ [ profile = ] CURRENT|DOMAIN|STANDARD|ALL

[ interface = ] name ]

Deletes firewall port configuration.

Parameters:

protocol - Port protocol.

TCP - Transmission Control Protocol (TCP).

UDP - User Datagram Protocol (UDP).

ALL - All protocols.

port - Port number.

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

interface - Interface name (optional).

Remarks: 'profile' and 'interface' may not be specified together.

Examples:

delete portopening TCP 80

delete portopening UDP 500

delete portopening protocol = TCP port = 80

delete portopening protocol = UDP port = 500

Windows Firewall Notifications

Applications can use Windows Firewall application programming interface (API) function calls to automatically add exceptions. When applications create exceptions using the Windows Firewall APIs, the user is not notified. If the application using the Windows Firewall APIs does not specify an exception name, the exception is not displayed in the exceptions list on the Exceptions tab of the Windows Firewall.

When an application that does not use the Windows Firewall API runs and attempts to listen on TCP or UDP ports, Windows Firewall prompts a local administrator with a Windows Security Alert dialog box.

Set option “Display a notification when Windows Firewall blocks a program” using command line

netsh firewall set notifications

C:\Documents and Settings\metasploit>netsh firewall set notifications

The syntax supplied for this command is not valid. Check help for the correct syntax.

set notifications

[ mode = ] ENABLE|DISABLE

[ [ profile = ] CURRENT|DOMAIN|STANDARD|ALL ]

Sets firewall notification configuration.

Parameters:

mode - Notification mode.

ENABLE  - Allow pop-up notifications from firewall.

DISABLE - Do not allow pop-up notifications from firewall.

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

Examples:

set notifications ENABLE

set notifications DISABLE

set notifications mode = ENABLE

set notifications mode = DISABLE

Enable or disable Windows Firewall pre-defined services using command line

netsh firewall set service

Used to enable or disable the pre-defined file and printer sharing, remote administration, remote desktop, and UPnP exceptions.

C:\Documents and Settings\metasploit>netsh firewall set service

The syntax supplied for this command is not valid. Check help for the correct syntax.

set service

[ type = ] FILEANDPRINT|REMOTEADMIN|REMOTEDESKTOP|UPNP|ALL

[ [ mode = ] ENABLE|DISABLE

[ scope = ] ALL|SUBNET|CUSTOM

[ addresses = ] addresses

[ profile = ] CURRENT|DOMAIN|STANDARD|ALL ]

Sets firewall service configuration.

Parameters:

type - Service type.

FILEANDPRINT  - File and printer sharing.

REMOTEADMIN   - Remote administration.

REMOTEDESKTOP - Remote assistance and remote desktop.

UPNP          - UPnP framework.

ALL           - All types.

mode - Service mode (optional).

ENABLE  - Allow through firewall (default).

DISABLE - Do not allow through firewall.

scope - Service scope (optional).

ALL    - Allow all traffic through firewall (default).

SUBNET - Allow only local network (subnet) traffic through firewall.

CUSTOM - Allow only specified traffic through firewall.

addresses - Custom scope addresses (optional).

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

Remarks: 'scope' ignored if 'mode' is DISABLE.

'scope' must be 'CUSTOM' to specify 'addresses'.

Examples:

set service FILEANDPRINT

set service REMOTEADMIN ENABLE SUBNET

set service REMOTEDESKTOP ENABLE CUSTOM

157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet

set service type = FILEANDPRINT

set service type = REMOTEADMIN mode = ENABLE scope = SUBNET

set service type = REMOTEDESKTOP mode = ENABLE scope = CUSTOM addresses =

157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet

Set Windows Firewall Security Logging using command line

netsh firewall set logging

Used to specify logging options.

C:\Documents and Settings\metasploit>netsh firewall set logging

The syntax supplied for this command is not valid. Check help for the correct syntax.

set logging

[ [ filelocation = ] path

[ maxfilesize = ] 1-32767

[ droppedpackets = ] ENABLE|DISABLE

[ connections = ] ENABLE|DISABLE ]

Sets firewall logging configuration.

Parameters:

filelocation - Log path and file name (optional).

maxfilesize - Maximum log file size in kilobytes (optional).

droppedpackets - Dropped packet log mode (optional).

ENABLE  - Log in firewall.

DISABLE - Do not log in firewall.

connections - Successful connection log mode (optional).

ENABLE  - Log in firewall.

DISABLE - Do not log in firewall.

Remarks: At least one parameter must be specified.

Examples:

set logging %windir%\pfirewall.log 4096

set logging %windir%\pfirewall.log 4096 ENABLE

set logging filelocation = %windir%\pfirewall.log maxfilesize = 4096

set logging filelocation = %windir%\pfirewall.log maxfilesize = 4096

droppedpackets = ENABLE

Set Windows Firewall ICMP Settings using command line

netsh firewall set icmpsetting

Used to specify excepted ICMP traffic.

C:\Documents and Settings\metasploit>netsh firewall set icmpsetting

The syntax supplied for this command is not valid. Check help for the correct syntax.

set icmpsetting

[ type = ] 2-5|8-9|11-13|17|ALL

[ [ mode = ] ENABLE|DISABLE

[ profile = ] CURRENT|DOMAIN|STANDARD|ALL

[ interface = ] name ]

Sets firewall ICMP configuration.

Parameters:

type - ICMP type.

2   - Allow outbound packet too big.

3   - Allow outbound destination unreachable.

4   - Allow outbound source quench.

5   - Allow redirect.

8   - Allow inbound echo request.

9   - Allow inbound router request.

11  - Allow outbound time exceeded.

12  - Allow outbound parameter problem.

13  - Allow inbound timestamp request.

17  - Allow inbound mask request.

ALL - All types.

mode - ICMP mode (optional).

ENABLE  - Allow through firewall (default).

DISABLE - Do not allow through firewall.

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

interface - Interface name (optional).

Remarks: 'profile' and 'interface' may not be specified together.

'type' 2 and 'interface' may not be specified together.

Examples:

set icmpsetting 8

set icmpsetting 8 ENABLE

set icmpsetting ALL DISABLE

set icmpsetting type = 8

set icmpsetting type = 8 mode = ENABLE

set icmpsetting type = ALL mode = DISABLE

Configure unicast response to a multicast or broadcast request behavior using command line

netsh firewall set multicastbroadcastresponse

Used to specify the unicast response to a multicast or broadcast request behavior.

C:\Documents and Settings\metasploit>netsh firewall set multicastbroadcastresponse

The syntax supplied for this command is not valid. Check help for the correct syntax.

set multicastbroadcastresponse

[ mode = ] ENABLE|DISABLE

[ [ profile = ] CURRENT|DOMAIN|STANDARD|ALL ]

Sets firewall multicast/broadcast response configuration.

Parameters:

mode - Multicast/broadcast response mode.

ENABLE  - Allow responses to multicast/broadcast traffic through the

firewall.

DISABLE - Do not allow responses to multicast/broadcast traffic

through the firewall.

profile - Configuration profile (optional).

CURRENT  - Current profile (default).

DOMAIN   - Domain profile.

STANDARD - Standard profile.

ALL      - All profiles.

Examples:

set multicastbroadcastresponse ENABLE

set multicastbroadcastresponse DISABLE

set multicastbroadcastresponse mode = ENABLE

set multicastbroadcastresponse mode = DISABLE

Restore all Windows Firewall settings to default state using command line

netsh firewall reset

Used to reset the configuration of Windows Firewall to default settings. There are no command line options for the reset command.

C:\Documents and Settings\metasploit>netsh firewall reset

Ok.

Used to reset the configuration of Windows Firewall to default settings. There are no command line options for the reset command.

Display Windows Firewall settings using command line

netsh firewall show commands

The following show commands are used to display the current configuration:

  • show allowedprogram – Displays the excepted programs.
  • show config – Displays the local configuration information.
  • show currentprofile – Displays the current profile.
  • show icmpsetting – Displays the ICMP settings.
  • show logging – Displays the logging settings.
  • show multicastbroadcastresponse – Displays multicast/broadcast response settings.
  • show notifications – Displays the current settings for notifications.
  • show opmode – Displays the operational mode.
  • show portopening – Displays the excepted ports.
  • show service – Displays the services.
  • show state – Displays the current state information.

SOURCE:

http://technet.microsoft.com/library/bb877979

http://technet.microsoft.com/en-us/library/bb877964.aspx

http://www.microsoft.com/en-us/download/details.aspx?id=7405

http://www.microsoft.com/en-us/download/details.aspx?id=23800

Strony: 1 2 3

Enterprise Networking Planet content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

As a Windows server administrator it is particularly important to secure your servers by any and all means at your disposal. We all know that Microsoft products are especially vulnerable to malware, due in part to their overwhelming prevalence in desktop computing. Hopefully most administrators are not going to be browsing the Web on their Windows file server, so chances are that malware is not going to get a hold of a server via user action on the desktop. The attack is going to come from the network, and the built-in Windows firewall can help.

Beginning with Windows Server 2003 SP1, the built-in firewall comes pre-installed. It is free, easy to setup, and can be configured using group policy. Lowering your attack surface by locking down remote desktop (RDP) is a prime example and a good place to start. Restricting the RDP port (3389) so that it is only available to subnets or IPs used by administrators takes only seconds.

The built-in Windows firewall is a quick, easy, and cheap way to protect your servers and reduce your attack surface. Add in the ability to control settings via group policy and it’s really a no-brainer.

To begin using the Windows firewall, open the control panel and double-click on the Windows Firewall icon. If you’re prompted with a message asking to start the necessary service, click yes. From this interface you can enable/disable the firewall as well as add exceptions. The Windows firewall allows the administrator to unlock individual ports or executables. When an executable is unlocked it will be able to listen on any port that it opens. When adding a new exception, be sure to click on the “Change scope…” button to set the appropriate trusted IP space. For any command line fanatics out there you can also use netsh:

netsh -c firewall

The most difficult piece of enabling the firewall on a server is figuring out what needs to be unlocked. The Windows firewall comes with some built-in exceptions that can be enabled, but if you go much beyond file services you will have to determine which ports or executables need to be unlocked. The easiest way to do this is by using the netstat command. Run the following from a command prompt:

netstat -a -b -n

This will return a list of all ports that are active or listening on your system. The -a switch ensures that all of the listening ports are displayed and -b shows the executables that opened each port. This can be very useful when trying to track down which executable(s) needs to be unlocked for a particular application. By default netstat will hide the actual port number from you if it “knows” what it is. The -n switch forces netstat to show the actual port number.

Group Policy Management
One of the key advantages of the Windows firewall is its ability to be configured through group policy. For large environments this feature is essential to administrator sanity.

Before doing any sort of group policy configuration you will want to make sure the Group Policy Management console is installed on your workstation. If you don’t see Group Policy Management in Control Panel -> Administrative Tools then you can download it here (search for “group policy management”).

Using the Group Policy Management interface, browse to the Active Directory organizational unit (OU) containing your servers. Right click on the OU and create or link an existing GPO. Open the GPO and navigate to the following folder:

Computer Configuration/Administrative Templates/Network/Network Connections/Windows Firewall

From here there are two sub-folders, Domain Profile and Standard Profile. It is extremely important to make sure that your firewall policy settings match in both of these folders. Under most circumstances the Domain Profile will be used, but if someone logs onto the server with a local user account then the server will switch to its Standard Profile settings. If the Standard Profile settings are not configured then the firewall will essentially turn itself off!

Browse through the list of available settings and configure the GPO for your server environment. There are a few things to keep in mind. First, once you choose a setting through group policy you will not be able to change the same setting on an individual server. For example, by unlocking RDP for a specific subnet via group policy you will not be able to add additional trusted subnets on a server-by-server basis. Second, don’t create a separate GPO for each server; try to group them together as much as possible. Creating a base firewall GPO that has exceptions for backup, anti-virus, etc. is optimal. Add server specific exceptions on the server itself, this way when you change anti-virus vendors (and someday you will) only one GPO has to be modified.

Adding exceptions for executables through group policy can be tricky. Use the “Windows Firewall: Define program exceptions” setting to unlock specific executables. Here are a few examples:

%programfiles%SymantecLiveUpdateLuComServer.EXE:192.168.1.1/24:enabled:GPO Policy for LuComServer.exe

%programfiles%Symantec AntiVirusRtvscan.exe:192.168.1.1/24:enabled:GPO Policy for Rtvscan.exe

%systemdrive%A286B00A-C3DE-414F-A96A-2BD238948D88MsMgmtAuxiliary.exe: 192.168.1.100:Enabled:MOM 2005 MsMgmtAuxiliary

The top two exceptions will allow Symantec Anti-Virus to communicate with its parent server, and the bottom exception allows the Microsoft Operations Manager (MOM) agent to function correctly. In fact, it even allows the MOM agent to be installed remotely. It is a good idea to store your list of program exceptions in a separate text file of some sort. This will save you a few keystrokes later on because they cannot be extracted from the GPO.

The built-in Windows firewall is a quick, easy, and cheap way to protect your servers and reduce your attack surface. Add in the ability to control settings via group policy and it’s really a no-brainer. With a few clicks you will be on your way to a more secure server environment.

Что придет на смену ICF?

После атаки «червей» Blaster в 2003 г. Microsoft отложила выпуск Windows XP Service Pack 2 (SP2), чтобы дополнить пакет обновлений новыми средствами защиты. Одна из мер, которая будет реализована в SP2, — автоматическая активизация брандмауэра Windows Firewall (в прошлом известного как Internet Connection Firewall, ICF) для всех сетевых адаптеров.

В результате реализации этой функции XP работает иначе, чем ожидают пользователи, будь то члены корпоративного домена или домашней рабочей группы. Под словами «работает иначе» я имею в виду, что пользователям не удается выполнить ранее доступные операции. И без того перегруженные заботами администраторы встретят эту новость печальным вздохом и, возможно, просто отключат Windows Firewall — что было и моим первым желанием. Однако, поразмыслив, я решил оставить Windows Firewall активным. Тем не менее я считаю, что его ограничения следует несколько ослабить, так как принимаемые по умолчанию параметры Windows Firewall блокируют все функции дистанционного управления и удаленные вспомогательные инструменты.

Независимо от того, будет ли Windows Firewall блокирован или будут изменены его параметры, администратору необходимо реализовать свое решение на десятках, сотнях или тысячах машин с наименьшими затратами. В данной статье речь пойдет о том, как активизировать и отключить Windows Firewall и настроить доменный и мобильный профили брандмауэра.

Как работает Windows Firewall

Начнем с пояснения, в чем именно заключаются функции Windows Firewall. Он анализирует и может блокировать входящий трафик, но не влияет на исходящий. По умолчанию Windows Firewall блокирует весь входящий трафик, за исключением тех случаев, когда данные пересылаются в ответ на предшествующий исходящий запрос.

Например, если открыть Microsoft Internet Explorer (IE) на машине XP и ввести адрес

www.cnn.com,

IE запросит на сайте CNN домашнюю страницу. Windows Firewall не блокирует исходящий трафик, но запоминает источник трафика. Спустя несколько мгновений Web-сервер CNN начнет пересылать в IE запрошенные данные. Windows Firewall обнаруживает входящий трафик, определяет, что он исходит из www.cnn.com — сайта, на который был послан запрос, — и разрешает передачу данных. В сущности, Windows Firewall допускает обмен данными с Internet и корпоративной сетью в случаях, когда взаимодействие инициировано защищенной системой.

Предположим, что внешняя машина — возможно, зараженная «червем» Blaster — пытается установить связь с компьютером XP. Внешняя система пытается послать пакет на порт 135 компьютера, чтобы заразить его «червем». Windows Firewall не воспринимает это обращение как ответ на запрос со стороны компьютера XP и поэтому блокирует пакет. По сути, Windows Firewall говорит сети: «Отвечай только на мои запросы».

Что произойдет, если активизировать Windows Firewall на системе внутри корпоративной сети, подключенной к домену? Сначала может показаться, что блокирование всех соединений, кроме инициированных клиентом, помешает нормальному участию рабочей станции в домене — таким было мое первое, поспешное заключение. Однако после некоторых размышлений я понял, что все соединения в домене инициируются клиентом: клиент отправляет запрос для регистрации, клиент запрашивает обновления Group Policy, клиент запрашивает перемещаемые профили (roaming profile) и т. д. Чтобы проверить эту теорию, в сентябре 2003 г. я активизировал Windows Firewall на нескольких рабочих станциях XP в своем домене на базе Active Directory (AD). С тех пор я не потерял никаких доменных функций. Однако, как упоминалось выше, мой инструментарий дистанционного администрирования работал, только если Windows Firewall был отключен или его режим изменялся.

В других сетях могут возникнуть проблемы, которых не было у меня. Так, мне известен пример, когда после активизации брандмауэра из предварительной версии SP2 была потеряна возможность просматривать сетевое окружение и отображать разделяемые диски. Каждому сегменту сети необходим мастер-браузер (browse master) — компьютер, который составляет список серверов в сегменте сети. Любой сервер может играть роль мастер-браузера, и во многих сетях каждая рабочая станция выступает в роли сервера. В сегменте, не имеющем настоящего сервера, такого как файл-сервер или принт-сервер, роль мастер-браузера выполняет какая-нибудь рабочая станция. Но в сегменте, «населенном» только рабочими станциями с активными персональными брандмауэрами, ни одна машина не сможет взять на себя роль мастер-браузера, и просмотр сетевого окружения будет невозможен. То же самое произойдет в сегменте, содержащем только системы XP с пакетом SP2, если не изменить параметры брандмауэра хотя бы на одной машине в сегменте, чтобы открыть порт и позволить этой машине функционировать в качестве файл- и принт-сервера.

Рассмотрим основные процедуры управления Windows Firewall: его включение и отключение. Отключить или активизировать Windows Firewall в среде SP2 можно тремя способами: через графический интерфейс, из командной строки и с помощью групповой политики.

Использование графического интерфейса

Интерфейс XP немного изменился по сравнению с интерфейсом, существовавшим до появления SP2, по крайней мере в отношении Windows Firewall. В зависимости от настройки можно щелкнуть на кнопке Start, Панель управления, и на экране появится категория с именем Network Connections или Network and Internet Connections. Если категория называется Network Connections, то в левой панели может находиться раздел Network Tasks, содержащий ссылку Configure Internet Connection Firewall. Если это так, следует щелкнуть на данной ссылке. Если же указана ссылка Local Area Connection (к проводному адаптеру Ethernet) или ссылка Wireless Network Connection, то нужно щелкнуть на ссылке правой кнопкой мыши, выбрать пункт Properties, щелкнуть на вкладке Advanced и, наконец, на кнопке Settings. Если в панели управления вместо категории Network Connections присутствует категория Network and Internet Connections, то следует щелкнуть на этой категории, а затем в разделе Pick a task в левой панели щелкнуть на кнопке Configure your firewall.

Независимо от выбранного способа, на экране появится страница Connection Firewall Properties. В окончательной редакции SP2 она может называться Windows Firewall Properties. На странице имеются вкладки с именами General, Exceptions, Network Connections, Log Settings и ICMP. На вкладке General расположены три кнопки: On (recommended), On with no exceptions и Off. Нужно щелкнуть на кнопке Off, затем нажать OK. Далее следует закрыть панель управления, и брандмауэр Windows Firewall будет отключен.

Командная строка

Windows Firewall можно отключить с помощью командной строки. Или может потребоваться изменить режим Windows Firewall на многих машинах, а применить групповую политику по какой-то причине невозможно (например, потому, что на предприятии пока не используется AD). И без того мощная команда Netsh дополнена в SP2 новыми параметрами для управления Windows Firewall. Брандмауэр можно отключить совсем, введя в командной строке

netsh firewall ipv4 set opmode


mode=disable

Эта команда отключает брандмауэр на всех сетевых адаптерах компьютера или на любом из них.

Но администратору не всегда приходится отключать Windows Firewall на всех сетевых адаптерах. Например, иногда удобно активизировать брандмауэр для беспроводного адаптера и отключить для платы Ethernet. В этом случае можно воспользоваться командой Netsh Set Opmode с параметром interface=name. Если беспроводная плата имеет имя wireless network connection, а плата Ethernet — имя local area connection, то с помощью следующих команд можно включить Windows Firewall на беспроводной плате и блокировать на плате Ethernet:

netsh firewall ipv4


set opmode mode=enable


interface=»wireless network


connection»


netsh firewall ipv4 set opmode


mode=disable interface=»local


area connection»

Опытные пользователи Netsh заметят, что, в отличие от других параметров Netsh, в параметре interface=name требуется ввести полное имя интерфейса. Если бы параметр interface=name действовал, как другие параметры Netsh, то interface=w было бы достаточно, чтобы отличить беспроводной сетевой интерфейс от интерфейса проводной локальной сети. Но, по крайней мере, в бета-версии SP2, с которой я работал при подготовке данной статьи, необходимо вводить полное имя интерфейса.

Использование групповой политики

Помимо графического интерфейса и командной строки, отключить Windows Firewall в XP SP2 можно из редактора Group Policy Editor (GPE) с помощью локальной или доменной политики. Брандмауэр всегда можно было отключить из объекта Group Policy Object (GPO), но этот метод очень ограниченный — отключение брандмауэра было фактически единственной функцией. В SP2 появилась новая категория (папка) объектов GPO для управления Windows Firewall.


Экран 1. Использование GPE для доступа Windows Firewall

В GPE следует перейти к Computer Configuration, Administrative Templates, Network, Network Connections, Internet Connection Firewall (экран 1). В папке Internet Connection Firewall находятся еще две подпапки: Domain Profile и Mobile Profile. Наличие у Windows Firewall двух профилей — важная особенность; отвлечемся от основной темы статьи, чтобы подробнее рассмотреть ее.

Два профиля Windows Firewall

Многие пользователи не хотят активизировать Windows Firewall на системах внутри сети, но готовы применить его, если компьютер находится вне сети. Поэтому брандмауэр спроектирован как достаточно интеллектуальное устройство, чтобы определить, зарегистрирована ли машина в домене. Если она зарегистрирована, то Windows Firewall следует инструкциям в папке Domain Profile. Но если машина не зарегистрирована в домене (следует обратить внимание, что Windows Firewall определяет принадлежность к домену компьютера, а не пользователя), то Windows Firewall обращается за инструкциями в папку Mobile Profile.

Как уже отмечалось, Group Policy в SP2 представляет эти два набора параметров политик в виде папок или «категорий», в терминах Group Policy. Каждая папка содержит одни и те же девять параметров политики, один из которых называется Operational Mode. С помощью параметра Operational Mode брандмауэр Windows Firewall можно отключить. Чтобы это сделать, следует изменить значение параметра на Disabled и применить политику.

Operational Mode может находиться в двух состояниях: Enabled и Shielded. В состоянии Enabled брандмауэр активизирован, и любой порт может быть открыт. Если нужно включить Windows Firewall, когда компьютер к домену не присоединен, следует присвоить параметру Operational Mode в папке Domain Profile значение Disabled, а параметру Operational Mode в папке Mobile Profile — значение Enabled.

В состоянии Shielded брандмауэр включен и игнорирует запросы на открытие входных портов. Идея такого подхода состоит в том, чтобы активизировать режим Shielded в случае атаки «червя», блокируя все непрошеные входящие данные и не позволяя вирусу заразить системы.

Замечание относительно GPE. Чтобы построить GPO на базе домена для управления Windows Firewall, необходимо сделать некоторые приготовления. Все параметры политики Windows Firewall — новые, поэтому экземпляры GPE (gpedit.msc) на контроллерах домена (DC) на базе Windows Server 2003 и Windows 2000 почти наверняка не будут показывать параметры политики Windows Firewall. «Почти наверняка», так как система Windows 2003 с пакетом Windows 2003 SP1, который планируется выпустить в 2004 г. должна распознавать эти параметры. Данный пакет обновлений внесет в брандмауэр Windows 2003 такие же изменения, как XP SP2 — в брандмауэр XP.

Для того чтобы создать GPO на базе домена с новыми параметрами Windows Firewall, следует загрузить административные инструменты Windows 2003 на компьютере XP с установленным пакетом SP2. Затем нужно открыть оснастку Active Directory Users and Computers консоли Microsoft Management Console (MMC) (для политики сайта следует открыть оснастку MMC Active Directory Sites and Services) на компьютере XP. Затем можно создать или отредактировать GPO, содержащий новые параметры политики.

Настройка мобильного и доменного профилей из командной строки

Политики Windows Firewall на базе домена очень полезны, но пользователям, не работающим с AD, лучше обратиться к командным файлам. Благодаря мобильным и доменным профилям ценность Windows Firewall возрастает, но можно ли управлять ими из командной строки? Да, с помощью командной строки можно даже организовать мобильный и доменный профили.

Чтобы управлять Windows Firewall в конкретном профиле, достаточно дополнить команду Netsh Set Opmode параметром profile= с ключевым словом current, all, corporate или other. Ключ current указывает системе на необходимость изменить активный профиль. Ключ all вносит данное изменение в оба профиля. Менее очевидно назначение ключа corporate, который изменяет доменный профиль, и ключа other, служащего для изменения мобильного профиля. Иногда мне кажется, что в Microsoft над Windows Firewall работает множество программистов, которые мало общаются между собой.

Предположим, что требуется отключить Windows Firewall из командной строки, когда система подключена к домену, а в остальных случаях активизировать брандмауэр. Сделать это можно с помощью следующих команд:

netsh firewall ipv4 set opmode


mode=disable profile=corporate


netsh firewall ipv4 set opmode


mode=enable profile=other

Вооружившись базовыми знаниями, можно приступать к использованию Windows Firewall. Но мне бы хотелось подчеркнуть две вещи. Во-первых, я не рекомендую отключать брандмауэр в мобильном режиме. Во-вторых, даже внутри домена полезно активизировать брандмауэр.

В данной статье мы лишь поверхностно рассмотрели возможности Windows Firewall, в то время как они заслуживают более пристального изучения.


Марк Минаси — редактоp Windows NT Magazine MCSE и автор книги «Mastering Windows NT Server 4.0» (издательство Sybex). С ним можно связаться по адресу: mark@minasi.com

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Windows 10 ограничения по процессорам
  • Как установить терминальный сервер windows server 2016
  • Netbeui for windows xp
  • Перестал работать rdp wrapper после обновления windows 10
  • Программа для скачивания видео с youtube для windows