PING(8) iputils PING(8)
Тематические термины: Ping, Windows, Linux.
Мы рассмотрим использование команды ping для Windows и, немного, для Linux.
В статье мы расскажем, для чего нужны утилиты ping и tracert, как запустить эти утилиты, а также приведем примеры команды ping для диагностики сети.
Ping и tracert — это утилиты для проверки целостности соединений в сетях и определения маршрутов следования данных на основе TCP/IP. Без этих утилит не обойтись не только при администрировании серверов (или целой сети), но и в условиях «домашней» диагностики.
One of the things I do the most when troubleshooting deployments of services exposing data to the internet is pinging the IP and port where the service is supposed to be alive. In this tutorial, I will show you how to ping IP and port on Linux and Windows.
Often it’s enough to just ping an IP to validate that you got “life” on the server. However if you like me often got many services running on one server (often when using Docker), I need to ping the specific port number on the server. One of the Kubernetes clusters I manage is running more than 100 services and here I use it a lot.
In this article/reference post, I will show you how to ping IP and port on your Windows or Linux machine using different commands in the terminal (CLI).
A ping is a tool and command used to troubleshoot network and system-related problems. The ping command normally uses the ICMP protocol and make checks if the remote system is up or down without a TCP or UDP. The ping port is a term used to check a remote port which can be TCP or UDP if it is open and accessible. There are different tools that can be used to ping a TCP or UDP port. Telnet, nmap, putty, netcat,psping are some of them.
- The application can not connect database service.
- If the firewall has configured properly to allow or deny specific ports.
- Check if the remote SNMP service is running properly.
- Before attacking the remote port if the port is up and responding properly.
This is the only solution that works for VPNs with the client machine being Windows Vista or Windows 7, as other listed answers simply do not function. This answer was previously deleted and should not have been, as this is the only solution for a real-world common case. Since there is no appeal available for the delete, I am reposting it to save others the frustration I had with trying to use the other answers.
The example below finds which IPs on the VPN that have VNC/port 5900 open with the client running on Windows 7.
A short Python (v2.6.6) script to scan a given list of IPs and Ports:
Results looked like:
The four variables at the top would need to be changed to be appropriate to whatever timeout, network, hosts, and ports that are needed. 5.0 seconds on my VPN seemed to be enough to work properly consistently, less didn’t (always) give accurate results. On my local network, 0.5 was more than enough.
Параметры команды ping и их описание
В зависимости от используемой операционной системы опции команды будут иметь разные назначения. Поэтому, если мы хотим понять все возможности, стоит ознакомиться с опцией help.
Общий синтаксис
Независимо от системы, команду ping можно применять так:
Windows
Для просмотра в Windows также используйте команду ping /?
Linux
При минимальной инсталляциии данной системы или использовании docker, утилиты ping может не быть. В таком случае мы увидим ошибку:
bash: ping: command not found
Для ее установки можно воспользоваться менеджером установки пакетов. В зависимости от типа операционной системы, наши команды будут немного отличаться.
а) для систем на базе deb (Debian, Ubuntu, Mint):
apt install iputils-ping
б) для систем на базе RPM (Rocky Linux, CentOS, Red Hat, Fedora):
yum install iputils
Готово, теперь можно пользоваться командой ping.
Список ключей можно посмотреть так:
Как проверить доступен ли порт сервера? Или внешний веб-сервис? Приведены несколько способов для использования на Windows-системах.
В процессе разворачивания и эксплуатации информационных систем часто требуется проверка доступности порта того или иного ресурса. Это может быть сервер приложений 1С, к которому не удается подключиться пользователю. Или же это внешний веб-ресурс, к которому происходит обращение. Или что-то еще.
Для проверки доступности самого сервера обычно используется команда ping. Но, в силу того, что данная утилита работает с ICMP-пакетами, для конкретного порта проверить доступ таким образом невозможно. Кроме того, на ресурсе в целях безопасности может быть заблокирован ответ на ICMP-пакеты, соответственно, результат доступности нельзя считать однозначным, если ресурс “не пингуется”.
Как проверить доступен ли порт?
Первое, что приходит на ум – использовать “старый добрый” telnet.
Для примера проверять будем доступность менеджера кластера:
Получили в ответ “кракозябру” – значит доступ есть

Загвоздка в том, что в большинстве современных Windows-систем telnet-клиент не установлен по-умолчанию, и требуется доустанавливать этот компонент. Что не всегда возможно, т.к. компьютер может быть и не своим и/или нет соответствующих прав.

Способ без инсталляции программ.
Хотелось бы иметь какой-то инструмент, не требующий установки, портабельный, чтобы можно было его просто скопировать и пользоваться, а при необходимости, легко удалить после использования.
В качестве такого инструмента удобно использовать утилиту psping от Sysinternals.

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

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

В ответе нас интересует последняя строка – TcpTestSucceeded: True. В данном случае – доступ есть.
Также, в ответе может содержаться еще значение PingSucceeded – это “обычный” ping по ICMP.
У командлета есть очень удобный для запоминания и быстрого ввода альяс tnc, а также ключ позволяющий ограничить вывод только результатом.

Разумеется, запускать командлет необходимо в окне PowerShell, а не “командной строки”.
Хотя, из командной строки тоже можно, вызвав PowerShell:
Следует заметить, что командлет доступен в версиях PowerShell от 4.0 и выше, т.е. начиная с Windows Server 2012 R2 и Windows 8.1
Заключение
Заметка не предполагает исчерпывающего списка и анализа всех возможных способов. Приведены три варианта, которые можно было бы охарактеризовать как “традиционный”, “портабельный” и “встроенный”. Каждый из них имеет свою область применения, в зависимости от системы, на которой необходимо выполнить проверку.
Полагаю, опытные администраторы смогут добавить еще несколько способов. Каким способом пользуетесь Вы и почему?
Ping is probably the most used tool for checking the network connection to a remote system. Using ping is very easy. You just use the command ping together with the IP address or URL of the remote server.
But what is the default port for the ping command? The answer is none.
Ping is based on ICMP, not TCP or UDP and ICMP protocol doesn’t have port numbers.
So how do you ping a specific port number of the remote server?
You cannot do that with the ping command. However, there are other tools that allow you to ping specific TCP or UDP ports.
Let me show you a couple of such tools and how to use them for pinging a given port number.
Ping specific port with Nmap
Nmap is a network scanning tool. While you can do a lot with Nmap, I’ll show you how to use it for pinging a specific port.
But first, make sure that you have Nmap installed on your system. On Debian/Ubuntu based distributions, you can use the command below to install Nmap.
sudo apt install nmap
The output will be something like this:
As you can see in the output, the server is up and it responded that the port number 443 of type TCP is open.
If you want to scan more than one ports, you can do that as well. For example, you can provide a range of port numbers like this:
The output will provide information on each individual port:
You may also use the port name instead of the port number:
The output remains the same as the previous command.
If you want to specifically ping the TCP port, you can specify that as well:
For UDP port, you can use
Nmap is not the only tool. You can use some other tools as well.
Using telnet to ping a specific port on remote server
Telnet is a remote connection tool similar to SSH however SSH is more secure by design than Telnet.
Before using Telnet, you should make sure that it is installed. On Debian/Ubuntu, you can use this command to install Telnet:
sudo apt install telnet
Once you have Telnet, you can use it to connect to a specific port of a remote system.
If it’s successful, you should see an output like this:
Why there is no response from the port?
All the examples I showed so far had a successful response. But what if there is no response. What does it mean?
There could be a few possible reasons why I port may not respond.
- There are no services listening to the port so there is nothing that will respond.
- There is actually a network connection issue between you and the server in question.
I hope you liked this tutorial and learned how to ping a specific port number. If you have any questions or suggestions, please leave a comment below.

In this post, we will discuss how you can use various tools to send a ping request to check if a target port on a specific host is alive.
Ping is one of the most fundamental tools when it comes to network troubleshooting. It allows you to quickly test whether a given service/port is responding or not. Due the lightweight nature of ICMP packets, it allows ping to quickly fetch useful information about a given system without sending a series of packets that would otherwise overwhelm the host (in some cases).
Although pinging an entire host can be useful for checking if a given host is up, it does not offer much information about if a target port is up.
Method 1 – Use Telnet
You are probably familiar with telnet. Also known as Terminal or Network, Telnet is a command-line utility that allows you perform interactive network communication using the TELNET protocol.
An telnet tutorial is coming up soo. Stay tuned for that.
To ping a specific port using telnet, use the command syntax as:
The telnet command is available in both Windows and Unix systems. However, you may need to enable Telnet in Windows.
To learn how do that, check the link below:
On macOS, use brew to install Telnet:
brew install telnet
On Debian and Debian-Based distributions, install telnet:
sudo apt-get install telnet
The example below shows how to use telnet to check if Nginx Server is running.
telnet 67.205.166.236 80
If the service is running, telnet will connect and return an output as:
Method 2 – Using Nmap
Start by installing nmap:
sudo apt-get install nmap
brew install nmap
sudo yum install nmap
Once installed, check if a port is up by running the command:
sudo nmap -p 80 67.205.166.236
Nmap will return detailed information including the latency, port number, associated service and its state. An exmaple output is as shown:
Starting Nmap 7.93 ( https://nmap.org ) at 2022-10-02 10:49 EAT
Nmap scan report for 67.205.166.236
Host is up (0.28s latency).
PORT STATE SERVICE
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.65 seconds
Method 3 – Using Netcat
To ping a port using netcat, run the command:
We can see that the connection to the target address and port is successful. This indicates the port/service is up.
Method 3 – Using cURL
We obviously cannot forget to mention cURL in this list. The command syntax is as shown:
The command should “Connected” if the port/service is up.
Method 4 – Using Windows PowerShell
In Windows, you can use the Test-NetConnection cmdlet to test if a port is up and running. The command syntax is as shown:
Test-NetConnection 67.205.166.236 -p 80
The command should return details about the target host and the connection status.
ComputerName : 67.205.166.236
RemoteAddress : 67.205.166.236
RemotePort : 80
InterfaceAlias : Ethernet
SourceAddress : 192.168.1.101
TcpTestSucceeded : True
Method 5 – Using PsPing Utility
In Windows, you can also use the PsPing utility which is part of Windows SysInternals tools. Download the tool in the resource below:
You can then use the command synax below to ping a specific port:
The command should send ping request to the target address and port and return the output as shown:
The above port is up.
Conclusion
In this post, we explored various methods and tools you can use to ping a specific port in both Windows and Unix based systems.
Thanks for reading and catch you in the next one!!
If you enjoy our content, please consider buying us a coffee to support our work:
NAME top
The nmap is a security tool used to scan remote systems ports and services. The nmap can be also used to ping a specific port. Nmap can be installed for the Linux distributions like Ubuntu, Debian, Mint, Kali like below.
$ sudo apt install nmap
For Windows operating systems use the official nmap site Windows download section like below.
The syntax of the nmap command for the port ping is like below.
nmap -p PORT_RANGE TARGET
- PORT_RANGE is the remote port number or protocol name. The PORT_RANGE can be also a range of port numbers too.
- TARGET is a domain name or IP address. Also the target can be an IP range too which includes multiple sequencial IP addresses.
Let’s make an example with the nmap to ping remote port. We will provide the port number with the -p parameter which will be 80 and the remote system is google.com.
$ nmap -p 80 google.com
The nmap is the fastest tool to ping a specified remote port. The command will be executed in 2 seconds and detailed output about the remote port will be provided like below. The line “80/tcp open http” simply expresses that the remote port number 80 responds to pings.
Starting Nmap 7.80 ( https://nmap.org ) at 2020-11-11 18:27 PST
Nmap scan report for google.com (172.217.18.110)
Host is up (0.036s latency).
Other addresses for google.com (not scanned): 2a00:1450:4001:809::200e
rDNS record for 172.217.18.110: zrh04s05-in-f110.1e100.net
PORT STATE SERVICE
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.28 seconds

Ping Specified Port with nmap
Alternatively, we can specify the IP address of the remote system we want to ping port.
$ nmap -p 80 172.217.18.110
$ nmap -p 80-90 google.com
The output will be like below where the open ports will be listed with the STATE open.
Starting Nmap 7.80 ( https://nmap.org ) at 2020-11-11 18:32 PST
Nmap scan report for google.com (172.217.18.110)
Host is up (0.039s latency).
Other addresses for google.com (not scanned): 2a00:1450:4001:809::200e
rDNS record for 172.217.18.110: fra16s42-in-f14.1e100.net
PORT STATE SERVICE
80/tcp open http
81/tcp filtered hosts2-ns
82/tcp filtered xfer
83/tcp filtered mit-ml-dev
84/tcp filtered ctf
85/tcp filtered mit-ml-dev
86/tcp filtered mfcobol
87/tcp filtered priv-term-l
88/tcp filtered kerberos-sec
89/tcp filtered su-mit-tg
90/tcp filtered dnsix

Ping Multiple Specified Ports with nmap
ICMP PACKET DETAILS top
$ curl 192.168.136.136:80
If the remote port is open some response like a warning, error, etc is returned by the remote port service.

Ping Port with curl Command
Ping IP and port using Nmap
Another well-used tool is Nmap. In Nmap, you can ping a port by using the “-p” option including the IP or domain you would like to scan.
Nmap: the Network Mapper – Free Security ScannerNmap Free Security Scanner, Port Scanner, & Network Exploration Tool. Download open source software for Linux, Windows, UNIX, FreeBSD, etc.Free Security Scanner
A heads up – be aware of legal issues!
“When used properly, Nmap helps protect your network from invaders. But when used improperly, Nmap can (in rare cases) get you sued, fired, expelled, jailed, or banned by your ISP.” – Nmap website.
If you get an error telling you that Nmap is not available on your computer/server, you would have to install it.
Install Nmap on Linux
To install Nmap on your Linux machine, you can use the below command:
Install Nmap on Windows
Not as simple as Linux, but it’s still easy to use the official installer from Nmap’s website. Go to this page: Download Nmap and look under the Windows Binaries for the latest available installer file.
Once the installer has completed installing, you are now ready to use Nmap on your Windows computer.
Well, once again the port is returned as open on the server. This means that there is a service accepting data at port 443, which was just verified by Nmap.
Проверка портов
С помощью команды ping нельзя проверить открытость того или иного порта.
Для этих целей используется команда telnet или программа, например, nmap.

Была ли полезна вам эта инструкция?
HISTORY top
The ping command appeared in 4.3BSD.
The version described here is its descendant specific to Linux.
As of version s20150815, the ping6 binary doesn’t exist anymore.
It has been merged into ping. Creating a symlink named ping6
pointing to ping will result in the same functionality as before.
AVAILABILITY top
ping is part of iputils package.
Команда tracert
Команда tracert – самый популярный инструмент сетевой диагностики. С помощью tracert можно проверить путь запроса к серверу и выявить проблемы, связанные с доступностью удаленного сервера. Сообщения отправляются с эхо-запросом по протоколу ICMP, и после каждой передачи выводится сообщение с эхо-ответом.
Командой tracert можно проверить:
- маршрут от локального компьютера до удаленного узла;
- количество узлов в сети;
- время прохождения пакета до конечного, транзитного и промежуточного узлов;
- точку потери пакета;
- пинг порта через командную строку.
Открытие порта для Ping
Справедливо заметить, что не во всех случаях отсутствие ответа на ping означает, что удаленный узел недоступен. Администратор ресурса может намеренно отключить ответы на эхо-запросы.
Также важно знать, что ping не использует конкретный номер порта. Чтобы открыть возможность пинга, необходимо либо найти соответствующую опцию (во многих домашних роутерах) или разрешить ICMP (Internet Control Message Protocol) на брандмауэре. Ну, или наоборот — чтобы закрыть возможность пинга, блокируем запросы ICMP.
IPV6 LINK-LOCAL DESTINATIONS top
- Откройте меню «Пуск», кликните по пункту Выполнить или нажмите сочетание клавиш Win + R.
- В поиске введите команду «cmd» и кликните Enter.
- В открывшемся окне терминала введите команду:
tracert имя_сайта (домен) или .

Если у вас Linux
1. Откройте терминал. Для этого:
- в Unity (Ubuntu): перейдите в «Главное меню» и введите слово «Терминал» в поисковой строке или нажмитесочетание клавиш Ctrl+Alt+T;
- в Xfce (Xubuntu): перейдите в «Главное меню» — «Приложения», затем выберите «Система» — «Терминал»;
- в KDE (Kubuntu): перейдите в «Главное меню» — «Приложения», затем выберите «Система» — «Терминал».
2. В окне терминала введите команду:
traceroute имя_сайта (домен) или .

Если у вас MacOS
- В Spotlight выберите и запустите сетевую утилиту Network Utility.
- В открывшемся окне перейдите на нужную вкладку.

Готово, вы запустили утилиту tracert.
Ping Port with psping Command
Windows Sysinternals is used to debug, troubleshoot the Windows operating system. The psping is a Windows Sysinternals tool that can be used to ping a port. The syntax of the psping tool is like below.
Примеры использования
Простой пример использования команды ping
Примерный ответ с исправной связью:
Пример ответа, если узел недоступен:
* до удаленного узла нет сигнала. Возможно, существуют неполадки на сети.
При проверке связи не удалось обнаружить узел
Проверьте имя узла и повторите попытку.
* не удалось определить имя узла. Возможные неполадки: нет связи с DNS, не работает DNS, запрашиваемого имени узла не существует.
В Linux при отсутствии ответа, мы ничего не увидим, но если нам нужно видеть неудачные попытки, то используем ping с опцией -O:
Ping IP and port using Telnet
This is my favorite when working on both Windows and Linux. I also think that it’s the easiest one to use and it’s called Telnet. You can with a simple command using Telnet ping IP and port on the remote server you would like to check.
Telnet – WikipediaContributors to Wikimedia projects
If you want to, you can also use a domain instead of the IP. A domain is often easier for humans to remember instead of numbers to multiple different servers locally or externally.
Below are the commands to ping IP and port on a server using Telnet:
As I mentioned above, you can use Telnet on both Windows and Linux computers/servers which makes it a great choice for most sys-ops.
On most computers, telnet is not installed by default. If you get the annoying error “telnet: command not found”, you have to install Telnet on the machine using the commands below:
Install Telnet on Linux
If you are working on a Linux Server or Desktop, you can use the below command to install Telnet on that machine:
$ sudo apt install telnet
Install Telnet on Windows
- Click on Start.
- Select Control Panel.
- Choose Programs and Features.
- Click Turn Windows features on or off.
- Select the Telnet Client option.
- Click OK.A dialog box appears to confirm installation when it’s done. The telnet command should now be available in your Command Prompt. Remember to restart your CMD window.
Ping IP and port with Telnet example
Let’s check out how Telnet works. This website is running at IP: 172.67.161.26 – this is the public IP address of the website to which the domain is mapped to.
By default, all requests are redirected to HTTPS (port 443) if a request is made at port 80. This means that the server accepts connections on port 80 too – let’s try and ping both ports:
That went well. We got connected and could see that the server is responding on both ports. This simply means that the service on the port is up and running.
Как пользоваться ping
- Откройте меню «Пуск», кликните по пункту Выполнить или нажмите сочетание клавиш Win + R.
- В поиске введите команду «cmd» и кликните Enter.
- В окне терминала введите команду:
ping имя_сайта (домен) или .

- в Unity (Ubuntu): перейдите в «Главное меню» и введите слово «Терминал» в поисковой строке или наберите сочетание клавиш Ctrl+Alt+T;
- в Xfce (Xubuntu): перейдите в «Главное меню» — «Приложения», затем выберите «Система» — «Терминал»;
- в KDE (Kubuntu): перейдите в «Главное меню» — «Приложения», затем выберите «Система» — «Терминал».

Если у вас кириллический домен
Для Windows и Linux кириллические домены нужно вводить в формате Punycode. Перевести домен в формат Punycode можно через сервис. Сконвертируйте имя кириллического домена и вставьте его в окно терминала следующим образом:
Готово, вы запустили утилиту ping.
Summary
In this quick article on how to ping IP and port using different tools on Windows or Linux machines, we learned how we can use the terminal to check if a given port is open and accepting requests.
If you got any issues, questions, or suggestions, please let me know in the comments below. Happy pinging!
Ping Port with PaPing Tool
The PaPing tool is a 3rd party tool created to ping remote specified port. The PaPing project is open source and located in Google Code.
SYNOPSIS top
Normally when I’m not on my own machines, which means I’m working on production servers not related to my own business/platform and it’s a Windows Server Environment, I always use PowerShell to ping IP and port.
A great thing about PowerShell is that you can use the methods in scripts running automated stuff in the background or during the setup of service or multiple services. A great thing if deploying with PowerShell would be to check if the ports were active after deployment and return a status to the terminal.
Below is an example of what this would look like on a local network:
In the test above you can see that the TCP call to my gateway at home succeeded at port 80. If you can’t get through to the service you will status False in TcpTestSucceeded.
Ping Specific Port with telnet Command
The most popular and basic tool to ping a remote port is the telnet command. Telnet is a tool and protocol created to connect remote systems via the command line. Telnet work from the command line and provides simple access to the remote telnet server. Telnet command uses the TCP protocol and first tries to connect remote port which is very useful to check remote port.
By default, telnet is not installed for both Linux and Windows systems. In Linux systems like Ubuntu, Debian, Mint, Kali you can install the telnet command like below.
Alternatively, you can use 3rd party tools like Putty for telnet command but it is not practical as expected. Syntax of the telnet command to ping the remote port is like below. The telnet command only uses the TCP protocol which is the most popular transmission protocol. So only TCP ports can be pinged with the telnet command which can not be used for the UDP ports.
telnet IP PORT
telnet DOMAIN PORT
- IP or DOMAIN is used to specify the remote system.
- PORT is the remote system port number which is a number from 9 to 65000.
Let’s ping the remote HTTP port with the telnet command by providing the port number as 80. We will ping the google.com TCP port number 80 like below.
The output will be like below where the telnet will try to connect remote system port number 80 and when the connection is established e will see the message “Connected to google.com.”

Ping Specified Port with telnet
Alternatively, we can try to ping a remote port with the IP address. We will just change the domain name with the IP address below.
$ telnet 172.217.18.110 80

BUGS top
• Many Hosts and Gateways ignore the RECORD_ROUTE option.
• The maximum IP header length is too small for options like
RECORD_ROUTE to be completely useful. There’s not much that
can be done about this, however.
• Flood pinging is not recommended in general, and flood
pinging the broadcast address should only be done under very
controlled conditions.
COLOPHON top
Pages that refer to this page:
arping(8),
clockdiff(8),
tracepath(8),
traceroute(8)
OPTIONS top
The (inter)network layer should never treat packets differently
depending on the data contained in the data portion.
Unfortunately, data-dependent problems have been known to sneak
into networks and remain undetected for long periods of time. In
many cases the particular pattern that will have problems is
something that doesn’t have sufficient “transitions”, such as all
ones or all zeros, or a pattern right at the edge, such as almost
all zeros. It isn’t necessarily enough to specify a data pattern
of all zeros (for example) on the command line because the
pattern that is of interest is at the data link level, and the
relationship between what you type and what the controllers
transmit can be complicated.
This means that if you have a data-dependent problem you will
probably have to do a lot of testing to find it. If you are
lucky, you may manage to find a file that either can’t be sent
across your network or that takes much longer to transfer than
other similar length files. You can then examine this file for
repeated patterns that you can test using the -p option of ping.
Команда ping
Команда ping — один из базовых инструментов для работы с сетью. С помощью ping можно проверить сервер и его доступность с любого компьютера, а также соединение между устройствами.
Если вы задавались вопросом «Как я могу узнать мой IP адрес и порт?», то мы дадим вам ответ: командой пинг можно как узнать порт компьютера, так и определить его IP.
Также с помощью команды ping можно выполнить такие диагностические задачи, как:
- измерить время взаимодействия между двумя хостами;
- автоматически проверить сетевое устройство (например, когда ping является частью bash-скрипта);
- проверить пинг до сервера и др.
Ping Specific Port with nc (netcat) Command
The nc or with its well-known name netcat is a tool used by security professionals for remote connectivity and management. Similar to the telnet command nc command can be used to ping specific port numbers for a remote system.
The nc command is provided by the Linux distributions like Ubuntu, Debian, Mint, Kali and can be installed like below.
$ sudo apt install netcat
For Windows operating systems the nc command and executable can be downloaded from alternative locations where one of them is https://github.com/diegocr/netcat .
The syntax of the nc command is very similar to the telnet command. But the difference is -v and -z parameters should be specified. The -v parameter is used for verbose output in order to see the log or status information like connected or not connected. The -z parameter is used for scan mode which will check or scan the specified remote port.
nc -vz DOMAIN PORT
nc -vz IP PORT
- The DOMAIN is the remote system domain name.
- The IP is the remote system IP address.
- The PORT is the remote system port number we want to ping.
We can see that the connection is succeeded which means the remote port number 80 responds to ping requests. We can also use the IP address for the remote system.
$ nc -vz 172.217.18.110 80
$ nc -vz goole.com 89
nc: connect to goole.com port 89 (tcp) failed: Connection refused
As we can see from the result we will get the “Connection refused” message which means the remote port does not respond to ping.
Ping Specific Port with Test-Connection In PowerShell
The Windows operating system provides the strong command-line interface named PowerShell with its recent versions. PowerShell provides a lot of useful commands like Test-NetConnection . The Test-NetConnection can be used to ping specified remote ports easily and provides detailed information. The Test-NetConnection is the preferred tool over the telnet command for Windows systems. The Test-NetConnection command is by default with PowerShell and Windows so there is no need for an extra installation process.
The syntax of the Test-NetConnection command is like below.
Test-NetConnection TARGET -p PORT
- TARGET is an IP address or domain name to port ping.
- PORT is the remote system port number.
The output of the ping remote port with the Test-NetConnection command will be like below. We can see that remote system ComputerName, RemoteAddress, RemotePort, InterfaceAlias, SourceAddress, TcpTectSucceeded information is provided.
ComputerName : google.com
RemoteAddress : 172.217.18.110
RemotePort : 80
InterfaceAlias : Ethernet0
SourceAddress : 192.168.142.130
TcpTestSucceeded : True

Ping Port with PowerShell Test-NetConnection
Let’s make another test for port number 89 for google.com.
The output is like below which means the ping port is failed. For failed ping port operations extra information like PingRelyDetails (RTT), TcpTestSucceeded is provided.
WARNING: TCP connect to (172.217.18.110 : 89) failed
ComputerName : google.com
RemoteAddress : 172.217.18.110
RemotePort : 89
InterfaceAlias : Ethernet0
SourceAddress : 192.168.142.130
PingSucceeded : True
PingReplyDetails (RTT) : 46 ms
TcpTestSucceeded : False

DESCRIPTION top
ping will report duplicate and damaged packets. Duplicate packets
should never occur, and seem to be caused by inappropriate
link-level retransmissions. Duplicates may occur in many
situations and are rarely (if ever) a good sign, although the
presence of low levels of duplicates may not always be cause for
alarm.
Damaged packets are obviously serious cause for alarm and often
indicate broken hardware somewhere in the ping packet’s path (in
the network or in the hosts).



