Windows server enable icmp

Встроенный брандмауэр Windows в целях безопасности по умолчанию блокирует входящий ICMP трафик как в десктопных Windows 10/11, так и в Windows Server. Это означает, что вы не сможете удаленно проверить доступность компьютера с помощью стандартной команды
ping
, т.к. она будет отвечать о превышении интервала ожидания запроса (
Request timed out
) для ICMP Echo-Reply. Если вы хотите сделать возможной проверку доступности хостов Windows по протоколу ICMP из системы мониторинга или вручную из командной строки, можно разрешить ответы на ICMP эхо-запросы.

Чтобы разрешить отправку ответов на запросы по протоколу ICMP, нужно включить предустановленные правила в брандмауэре Windows.

  1. Откройте оснастку управления Windows Defender Firewall with Advanced Security, выполнив команду
    wf.msc
  2. Перейдите в раздел Inbound Rules
  3. Найдите правило Core Network Diagnostics – ICMP Echo Request (ICMPv4-In) и включите его.
  4. В моем случае есть два правила с этим именем. Одно для частного и общедоступного сетевого профиля Windows, и второе для доменного. Я включил их оба. Можно также включить правило, разрешающее ICMP ответы для IPv6 протокола (если используется).
    Правило Windows Firewall разрешить ответ на ping

Есть также другое правило File and Printer Sharing (Echo Request – ICMPv4-In), которое также разрешает компьютеру отвечать на эхо-запросы
ping
.

Попробуйте пропиговать ваш компьютер и убедитесь, что теперь он отвечает на ICMP запросы.

Можно включить правила Windows Firewall, разрешающие ответы на эхо-запросы ICMP с помощью такой команды PowerShell:

Set-NetFirewallRule -Name CoreNet-Diag-ICMP4-EchoRequest-In -enabled True

Если нужно ограничить список IP подсетей или хостов, которым разрешено отправлять ответы на ICMP запросы, выполните команду:

Set-NetFirewallRule -Name CoreNet-Diag-ICMP4-EchoRequest-In -enabled True -RemoteAddress 192.168.12.0,192.168.31.94

Откройте свойства правила в Windows Firewall и проверьте, что теперь правило разрешающие ICMP ответы будет работать только для указанных IP/подсетей.

Ограничить список IP в правиле ICMPv4 echo request

Если в файрволе отсутствует (удалено) правило для входящих ICMP запросов, можно создать его из командной строки:

netsh advfirewall firewall add rule name="Allow_ICMPv4_Echo" protocol=icmpv4:8,any dir=in action=allow

Другой пример PowerShell команды, которое создаст правило файервола, разрешающего ping для всех хостов в локальной сети:

New-NetFirewallRule -DisplayName "Allow_ICMPv4_Echo" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress localsubnet -Action Allow

Если нужно заблокировать ответы на ICMP эхо-запрос независимо от того, какие правила включены, создайте запрещающее правило, которое будет иметь более высокий приоритет:

New-NetFirewallRule -DisplayName "Block_ICMPv4_Echo" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress localsubnet -Action Block

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

  1. Откройте редактор доменных GPO (
    gpmc.msc
    ), создайте или отредактируйте имеющуюся GPO и назначьте ее на целевую OU или корень домена.
  2. Перейдите в раздел Computer Configuration -> Windows Settings -> Security Settings -> Windows Firewall with Advanced Security -> Inbound rules
  3. Создайте новое правило, выберите Predefined rule типа Core Networking Diagnostics
    Групповая политика с правилами для Windows Firewall

  4. Укажите какие правила ICMP Echo request нужно включить.
    GPO: разрешить ICMP ping в Windows

  5. На следующем шаге вы берите Allow the connection.

В Windows Server  2016, 2019 и 2022 ICMP или Ping отключены по умолчанию, делает систему более безопасной, но иногда это приносит с собой некие сложности в мониторинге. 

Поскольку команда ping говорит/показывает, что удаленный компьютер подключен к сети, то это полезная команда для системных администраторов. 

Если Вам для каких-то своих целей или же для мониторинга необходимо включить ICMP пакеты, или же ping, то можно воспользоваться ниже приведенной инструкцией.

Его можно включить вручную без использования групповых политик.

Если ICMP пакеты на вашем компьютере не включены, вы получите сообщение об истечении времени ожидания.

Как включить Ping в брандмауэре Windows

Чтобы включить проверку связи в брандмауэре, выполните следующие действия:

Откройте брандмауэр, нажав Win+R и напишите команду firewall.cpl.

В открывшемся окне нажмите Advanced Settings  на правой панели.

Выберите Inbound Rules на левой панели и на правой панели New Rule.

Выберите File and Printer Sharing в разделе PredefinedRules. И нажмите Next

Выберите следующие два правила:

  • Общий доступ к файлам и принтерам (Echo Request – ICMPv6-In )
  • Общий доступ к файлам и принтерам (Echo Request – ICMPv4-In )

И нажмите Next.

Выберите пункт Allow the connectionНажмите Finish .

Как включить ICMP (Ping) с командной строки или PowerShell

Для этого откройте командную строку, нажав Win+R и напишите команду cmd.

Разрешить пинг IPv4 с командной строки:

netsh advfirewall firewall add rule name="ICMP Allow Ping V4" protocol="icmpv4:8,any" dir=in action=allow

Разрешить ping IPv4 с помощью PowerShell:

New-NetFirewallRule -DisplayName "ICMP Allow Ping V4" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress <localsubnet> -Action Allow

Если после тестирования и настроек необходимо отключить ICMP пакеты, то так же можем воспользоваться командной строкой для этого.

Заблокировать ping IPv4 с командной строки:

netsh advfirewall firewall add rule name="ICMP Allow Ping V4" protocol="icmpv4:8,any" dir=in action=block

Заблокировать ping IPv4 с помощью PowerShell:

New-NetFirewallRule -DisplayName "ICMP Allow Ping V4" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -RemoteAddress <localsubnet> -Action Block

Также предлагаем рассмотреть другие полезные статьи:

  • Как подключиться к серверу по FTP, SFTP и SCP
  • Как установить и настроить FTP-сервер IIS на Windows Server 2019
  • Как подключиться к Docker контейнеру по sFTP

По умолчанию, в Windows Server 2019 брандмауэр настроен на блокировку входящего трафика ICMP. Сюда входят эхо-запросы, которые используются командой ping, и это может затруднить устранение неполадок в сети. Некоторые системы мониторинга используют команду ping для отслеживания доступности серверов.

В этом руководстве рассмотрим, как включить правило, чтобы сервер стал отвечать на ping используя графический интерфейс Windows Server 2019, а также включим разрешающее правило через PowerShell и netsh.

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


Разрешить проверку связи через брандмауэр Windows

Сначала нам нужно открыть брандмауэр Windows, это можно сделать несколькими способами. Один из методов — просто нажать клавишу Windows, чтобы открыть меню «Start«, а затем начать вводить слово Firewall. Как показано ниже, брандмауэр Windows с расширенной безопасностью должен отображаться, выберите этот пункт.

Меню Start Windows Server 2019 - открыть брандмауэр Windows

Еще один быстрый способ: в PowerShell можно просто ввести «firewall» и нажать Enter. Откроется базовый интерфейс брандмауэра, а затем нажать кнопку «Advanced settings» в левой части. Откроется тот же интерфейс, что и через меню «Start«.

Следующий способ открыть Firewall — ввести в CMD такой текст: «firewall.cpl«

В Брандмауэре в расширенном режиме перейдите в Inboud Rules (Правила для входящих подключений).

Правила Inboud Rules

В перечне правил в Inboud Rules, найдите «File and Printer Sharing (Echo Request — ICMPv4-In)» и активируйте его.

File and Printer Sharing (Echo Request - ICMPv4-In)

Еще один вариант. Активируем разрешающее правило командлетом Powershell

Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -enabled True

Полную справку со всеми параметрами можно получить, набрав команду в PowerShell

help New-NetFirewallRule

Вариант создания правила через netsh

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow

Примечание: Включение правила позволит получать ответы только на IPv4 запросы, если нужно получать ответы по IPv6, нужно разблокировать правило такое же правило, только с Echo Request — ICMPv6-In, перечисленное ниже. К тому же имеется несколько профилей: доменный, публичный, частный. Ненужные профили можно отключить в правиле, во вкладке Advanced.

После разблокировки правила сервер должен начать отвечать на запросы ping. С хоста виртуализации или другого пк в локальной сети протестируем ping’ом Windows Server 2019 по адресу 192.168.1.11 перед включением правила, а затем снова после его включения. Ниже видно, что время ожидания первых запросов истекло, так как входящие запросы ICMP были отключены по умолчанию в Windows Server 2019. После включения правила ICMP запросы ping успешно выполняются, что подтверждает ожидаемую работу.

Пример проверки связи:

Скачать видео.


Резюме

Стандартное правило брандмауэра — блокировать ICMP запросы, в итоге сервер не отвечает на ping. Включив это правило брандмауэра, мы включили команду ping в Windows Server 2019, которая поможет нам устранить неполадки в сети.

This guide will show you how to enable/disable ICMP ping responses referred to as Echo Request in Windows Server 2022 (should work with any recent version–2008 R2, 2012 R2, 2016, 2019, 2022). Enabling ping will help you to monitor and troubleshoot network issues on your network. Prior to making any changes it would be a good idea to make sure you’re not violating any department policies, although I have never gotten my hand slapped by enabling ICMP echo requests, however it has been for…get this…having client drive redirection enabled on my remote desktop session to a non-critical Windows box. Jesus H. Christ, sorry but that still irks me.

Since the Server Core variant of Windows doesn’t have a GUI, here is the command you can run in order to allow responses to ICMP echo requests:

Enable IPv4 Ping (Allow responses to ingress/inbound ICMP echo requests):

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow

Enable IPv6 Ping (Allow responses to ingress/inbound ICMP echo requests):

netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol="icmpv6:8,any" dir=in action=allow

Disable IPv4 Ping (Deny responses to ingress/inbound ICMP echo requests):

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=block

Disable IPv6 Ping (Deny responses to ingress/inbound ICMP echo requests):

netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol=icmpv6:8,any dir=in action=block

Allow ICMP Echo Requests in Windows Server – GUI

  1. Go to control panel and open Windows Firewall. There are plenty of ways to reach control panel on a Windows server.
  2. Click on Advanced Settings.

    Firewall advanced settings

    Additionally, you can search for Firewall in Windows search to reach the advanced Firewall settings as below.

    Search For Windows Firewall

  3. In the earlier Operating Systems, we need to create a firewall rule to allow ICMP echo packets. Luckily the rule is already there and we just need to enable it.To enable the inbound rule that allowing ICMP packets, select Inbound Rules. Locate the File and Printer Sharing (Echo Request –ICMPv4-In), right-click on it and select Enable Rule.

Enable Ping on Windows Server

That will allow inbound ICMP ping requests and respond to them without completely disabling Windows firewall service. If you rock IPv6 on your LAN, there’s a separate rule we need to enable called File and Printer Sharing (Echo Request –ICMPv6-In).

Screenshot shows a Windows server started responding to ping request one the above rule was enabled

In a similar scenario, if a server is responding to ping/ICMP requests, but you need to stop it for tight security, you can simply disable the same rule.

Visit the Windows firewall advances settings and disable File and Printer Sharing (Echo Request –ICMPv4-In) rule.

By default, the built-in Windows Defender Firewall blocks all inbound ICMP traffic. As a result, if you try to ping the Windows host from a different device, the computer will not respond to the ICMP echo request (with the Request timed out description). In this article, we’ll look at how to enable or disable host network connectivity checks (ICMP echo requests) using the ping command on Windows 10/11 and Windows Server 2022/2019/2016.

icmp echo requests

You can use the graphical MMC snap-in, the command line, and the PowerShell console to manage the rules of the Windows Firewall. Let’s look at all three ways of enabling and disabling ICMP rules in the firewall.

How to Allow Ping in Windows Firewall

Search for Firewall in the quick search bar and open the Windows Defender Firewall with Advanced Security snap-in (or press Win+R and run the wf.msc command).

windows firewall allow ping

Select Inbound Rules in the left pane and find the File and Printer Sharing (Echo Request – ICMPv4-In) rule. As you can see, the rules for both ICMPv4 and ICMPv6 are available here for both the Domain and the Private network profiles. All of these rules are disabled by default.

You can turn on a firewall rule by right-clicking on it and selecting Enable Rule.

enable ping on windows firewall

You can remotely check the availability of this computer using the ping command. Now Windows Firewall is not blocking ICMP requests and you can see that the remote host is accessible over the network.

allow icmp windows firewall

By default, this rule allows ICMP echo requests from any source on the local network. If you want to restrict the list of computers that are allowed to send ICMP requests, or allow ICMP ping for external IP addresses, you can edit the existing rules.

  1. Open the properties of the firewall rule and go to the ‘Scopes’ tab;
  2. As you can see, the rule allows ICMP replies for all hosts on the Local subnet;
  3. You can edit the list of accepted IP addresses in Remote IP Address;
  4. This is where you can add specific IP addresses, ranges of IP addresses, or subnets.
    windows firewall enable ping

You can enable and disable the Windows Defender firewall rule from the command line.. Open the elevated cmd prompt or PowerShell console. To allow ICMPv4 ping for all network profiles, run the command:

netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=yes

You should see the following message:

Updated 2 rule(s).

Ok.

firewall allow ping

You must also enable the ICMP rule for the IPv6 protocol if it is used in your network communications:

netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv6-In)" new enable=yes

Separate cmdlets for managing Windows Firewall rules are available in the built-in NetSecurity PowerShell module. To allow ICMP ping for all profiles, run the following commands:

Enable-NetFirewallRule -displayName "File and Printer Sharing (Echo Request - ICMPv4-In)"

Enable-NetFirewallRule -displayName "File and Printer Sharing (Echo Request - ICMPv6-In)"

Disable ICMP Ping in Windows Firewall

You can disable ICMP echo request rules from the Windows Defender Firewall graphical console. Select all the rules in the list (by holding down the CTLR key), right click and select Disable Rule.

enable ping windows firewall

It is also possible to disable the ICMP ping rules from the command prompt:

netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=no

netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv6-In)" new enable=no

Or with PowerShell:

Disable-NetFirewallRule -displayName "File and Printer Sharing (Echo Request - ICMPv4-In)"

Disable-NetFirewallRule -displayName "File and Printer Sharing (Echo Request - ICMPv6-In)"

Cyril Kardashevsky

I enjoy technology and developing websites. Since 2012 I’m running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.

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

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Windows 10 сколько жрет озу
  • Hd 5650 driver windows 10
  • Где найти автозагрузку программ в windows 7
  • Fedora virtio driver windows
  • Как запаролить папку или файл в windows