Ping how to ping port
Ping how to ping port
How To Ping Specific Port (Windows and Linux)?
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.
Why Ping A Specific Port?
Pinging a specific port is used by different users and administrators to check remote service. A Linux Administrator, Windows Administrator, Network Administrator, Application Developer, Database Administrator generally ping specific ports to identify and solve problems. Below we will list some of the most popular reasons why ping a specific port.
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.
For Windows operating system the telnet client is provided via the Windows Features but not enabled by default. So you should turn on the telnet client feature. Take a look at the following tutorial about how to install a telnet client in Windows operating systems.
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.
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.”
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.
We have made a ping port example with a successful result but what will be the output if the ping port does not work. In the following example, we will ping port number 89 which is closed and will not reply to the ping request.
The output will be like below where the “Trying 172.217.18.110…” line will be shown for timeout and then the “telnet: Unable to connect to remote host: Network is unreachable” message will be displayed.
Ping Specified Port with telnet
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.
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.
Let’s make a ping to the HTTP port of google.com with the following nc command.
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.
In the following example, we will ping the google.com domain name pot number 89.
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 nmap
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.
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.
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.
Ping Specified Port with nmap
Alternatively, we can specify the IP address of the remote system we want to ping port.
As stated previously the nmap command can ping multiple ports and IP addresses with a single command. Other tools like nc, telnet can not ping multiple ports with a single command. In the following example, we will ping port numbers between 80 and 90.
The output will be like below where the open ports will be listed with the STATE open.
Ping Specific Port with Test-Connection In PowerShell
The syntax of the Test-NetConnection command is like below.
We will use the Test-NetConnection command to test google.com port number 80.
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.
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.
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.
Ping Port with curl Command
The curl command is created to download remote resources over the network by using the FTP, HTTP, HTTPS, and similar protocols. It can be also used to make a simple port checks which can be also called a ping port. The following syntax is used to ping port for the specified IP address or hostname.
In the following example, we ping the remote system with IP address 192.168.136.136 for port number 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 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.
Диагностика и логи
В этой статье мы расскажем:
Что такое порт
Когда решено обменяться данными по локальной сети, устройства связываются друг с другом. Для этого каждому устройству нужно иметь свой IP-адрес и открыть порты для взаимодействия.
Порт — это числовой идентификатор приложения или процесса в диапазоне от 0 до 65 535. На устройстве может находиться сразу несколько сетевых приложений, которые привязаны к разным портам, при этом за сеанс нужно подключиться только к одному приложению. Поэтому порт открывает соединение с конкретным приложением и обслуживает его, пока сеанс не завершится.
Проверить порт сервера на доступность можно следующими способами:
Как проверить, открыт ли порт, командой Telnet
Telnet — это утилита, с помощью которой можно соединиться с удалённым портом любого компьютера и установить канал связи. Это реализация клиентской части протокола с тем же названием (стандартный порт telnet — 23). Для использования telnet нужно знать, какой порт использует искомое приложение, а также имя или IP-адрес сервера. Если при работе с telnet не указать порт, утилита проверит доступность сервера аналогично команде ping.
Рассмотрим, как узнать, открыт ли порт на компьютере или сервере в Windows и Linux.
Важно: в Windows Vista и Windows 7/8/10 утилита telnet по умолчанию отключена. Вы можете установить утилиту по инструкции от Microsoft.
В командной строке введите команду:
telnet имя_сервера номер_порта
telnet IP_сервера номер_порта
Если командная строка или терминал возвращает ошибку, то порт закрыт: Как с помощью telnet в Windows 10 проверить порт
Если окно становится полностью пустым или на экране появляется приглашение сервера, порт открыт: Как выглядят в Windows и Linux (Ubuntu, Centos) открытые порты
Установите утилиту telnet:
sudo apt install telnet
В терминале введите команду:
telnet имя_сервера номер_порта
telnet IP_сервера номер_порта
Если командная строка возвращает ошибку, то порт закрыт:
Если порт открыт, появится следующее сообщение: Telnet: подключение к порту
Как пользоваться ping и traceroute
Ping — это утилита, с помощью которой возможна проверка доступности сервера по IP с компьютера. Опрашиваемому узлу отправляются эхо-запросы (ICMP-пакеты Echo Request). Если до узла дошёл запрос, в ответ он должен отправить ICMP-пакет с принятыми данными и эхо-ответ (Echo Reply). Подробнее в статье Команда Ping.
Traceroute — это утилита, с помощью которой можно отследить путь запроса к серверу, а также проблемы, связанные с доступностью удалённого сервера. Утилита отправляет запрос узлу и последовательно опрашивает все маршрутизаторы на пути. Подробнее о работе утилиты и её установке читайте в статье Утилиты Traceroute и Tracert.
Чтобы проверить доступность сайта или IP адреса, выберите инструкцию для вашей ОС.
ИТ База знаний
Курс по Asterisk
Полезно
— Онлайн генератор устойчивых паролей
— Онлайн калькулятор подсетей
— Руководство администратора FreePBX на русском языке
— Руководство администратора Cisco UCM/CME на русском языке
— Руководство администратора по Linux/Unix
Навигация
Серверные решения
Телефония
FreePBX и Asterisk
Настройка программных телефонов
Корпоративные сети
Протоколы и стандарты
Как сделать пинг порта в Linux и Windows
Проверяем доступность порта
С другой стороны, номера портов принадлежат протоколам транспортного уровня, таким как TCP и UDP. Номера портов помогают определить, куда пересылается Интернет или другое сетевое сообщение, когда оно приходит.
Онлайн курс по Linux
Мы собрали концентрат самых востребованных знаний, которые позволят тебе начать карьеру администратора Linux, расширить текущие знания и сделать уверенный шаг к DevOps
В этом руководстве вы узнаете, как проверить связь с портом в Windows и Linux с помощью различных инструментов.
Можно ли пропинговать конкретный порт?
Сетевые устройства используют протокол ICMP для отправки сообщений об ошибках и информации о том, успешна ли связь с IP-адресом. ICMP отличается от транспортных протоколов, поскольку ICMP не используется для обмена данными между системами.
Некоторые сетевые инструменты и утилиты могут имитировать попытку установить соединение с определенным портом и ждать ответа от целевого хоста. Если есть ответ, целевой порт открыт. В противном случае целевой порт закрывается или хост не может принять соединение, потому что нет службы, настроенной для прослушивания подключений на этом порту.
Как пропинговать определенный порт в Linux?
Вы можете использовать три инструмента для проверки связи порта в Linux:
Пинг определенного порта с помощью Telnet
2. Если telnet не установлен, установите его с помощью следующей команды
Если порт открыт, telnet устанавливает соединение. В противном случае он указывает на сбой.
Пинг определенного порта с помощью Netcat
Netcat (nc) позволяет устанавливать соединения TCP и UDP, принимать оттуда данные и передавать их. Этот инструмент командной строки может выполнять множество сетевых операций.
1. Чтобы проверить, установлен ли netcat :
2. Если netcat не установлен, выполните в терминале следующую команду:
Пинг определенного порта с помощью Nmap
Если Nmap установлен, вывод информирует пользователя о версии приложения и платформе, на которой он работает.
2. Если в вашей системе нет Nmap, введите следующую команду:
3. После установки Nmap в системе используйте следующую команду для проверки связи определенного порта:
Выходные данные информируют пользователя о состоянии порта и типе службы, задержке и времени, прошедшем до завершения задачи.
Как пропинговать определенный порт в Windows?
Проверить связь с портом в Windows можно двумя способами:
Пинг определенного порта с помощью Telnet
Перед использованием telnet убедитесь, что он активирован:
Готово! Вы активировали клиент Telnet в системе.
После завершения активации можно пропинговать порт с помощью telnet. Для этого:
1. Введите cmd в поиске в меню «Пуск». Щелкните на приложение Командная строка.
2. В окне командной строки введите
Выходные данные позволяют узнать, открыт ли порт и доступен ли он, иначе отображается сообщение об ошибке подключения.
Пинг определенного порта с помощью PowerShell
Чтобы проверить связь с портом с помощью PowerShell, выполните следующие действия:
1. Введите PowerShell в поиске в меню «Пуск». Щелкните приложение Windows PowerShell.
2. В окне командной строке PowerShell введите:
Если порт открыт и соединение прошло успешно, проверка TCP прошла успешно. В противном случае появится предупреждающее сообщение о том, что TCP-соединение не удалось.
Заключение
Теперь вы знаете, как выполнить эхо-запрос и проверить, открыт ли порт, с помощью нескольких сетевых инструментов и утилит в Linux и Windows.
Онлайн курс по Linux
Мы собрали концентрат самых востребованных знаний, которые позволят тебе начать карьеру администратора Linux, расширить текущие знания и сделать уверенный шаг к DevOps
RootUsers
Guides, tutorials, reviews and news for System Administrators.
How to “ping” a port
Most of us would be familiar with the simple ICMP based ‘ping’ command which allows us to test for a basic response from some network connected device. While great for basic troubleshooting it does not allow us to confirm if the particular host at the other end is responding on TCP or UDP ports where the majority of services are likely to be provided.
Ping isn’t the be all and end all of network troubleshooting, if a firewall blocks inbound ICMP traffic then a ping will not succeed which can produce a false perception that the host is down as it is not responding to the ping, however other services could still be responding fine.
Alternatively while ping may come back fine with a response it doesn’t indicate if a web server is responding on port 80 for HTTP requests, the web server may have failed and no longer be responding.
So if ping is ICMP based, can we hit a TCP or UDP port for response instead? The answer is yes, let’s take a look.
Enter tcping
tcping is one such tool that can be used to check that a TCP port is responding, there are a few versions available however I use this one: http://www.elifulkerson.com/projects/tcping.php
The manual is on the same page, basically you can run a command similar to the below.
Here we are using tcping to check port 443 at google.com. As can be seen the port is showing as being open and responding, if the port is not open it will show as no response after 2000ms by default.
You could also use telnet to test for TCP connectivity to a port, however the tcping tool provides further features as outlined in the usage section here. Some such features include being able to continually run the test allowing a way to generate traffic for you to watch out for in live packet captures as well as the response time.
What about UDP?
As UDP is a connectionless protocol, determining if it is responding is a bit different. A TCP ‘ping’ works by performing a three way hand shake, the source will send a SYN to the destination, the destination will reply with a SYN-ACK, and the source will then send an ACK completing the handshake and establishing the connection. As UDP does not establish a connection we can’t just look for this to determine if the port is responding, we instead need to send specific data and see if we receive a response.
NMAP is a great tool for this, you can download it and use it to port scan a destination address to determine what ports are open.
In this example we are querying if 8.8.8.8 is responding on UDP port 53, as it serves DNS we would expect it to be open.
The open|filtered result is used when nmap is unable to determine if the port is open or filtered, the open port may not have given a response. It shows that the service has been identified as ‘domain’ as it’s for serving DNS. I’ve tested this to some other DNS servers out on the Internet and some do show as open only confirming that they are responding.
Why a port may not respond
There are a few simple reasons that a port may not respond to your test.
You can check the connectivity along the path of the traffic by running a packet capture with something like Wireshark or tcpdump, this will show you where the traffic is getting through to and where it’s being stopped along the route. You could run it on the source and destination servers, as well as devices in between that you have access to such as firewalls or routers. Follow the flow of traffic until you determine where the problem is.
Summary
While performing a TCP ‘ping’ to a destination you can confirm if it is responding as intended, though there are a few reasons the port may not respond as noted. UDP can be checked however it’s a bit more difficult to be certain if you’re correctly receiving a response so the tests aren’t always reliable, which makes sense as UDP is not a reliable protocol. These tests can be useful when testing security by confirming if ports are open or closed.
How to ping IP and port from Windows or Linux
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.
I think most system administrators know the commands for this, but if you like me normally don’t work like an IT admin (at least not anymore) I tend to forget the commands. Due to that, I have written this article as a reference for myself but also everyone else, who is in need of pinging services they expect at a location.
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)
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.
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:
Install Telnet on Windows
By default, Telnet is not an enabled Windows Feature. If you run Telnet on your computer in a Command Prompt, you will get the following error: “Telnet is not recognized as an operable program or batch file.”. So – to install Telnet on Windows, you have to do the following:
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 that 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.
If you would like to escape out of the Telnet utility when connected, you can use “ CTRL + ] ” or the “ q ” 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.
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 using 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.
Ping IP and port using Nmap
Let’s try to ping a website at IP “ 172.67.161.26” on the global internet at the default HTTPS port – 443. If you test this yourself, then don’t use that IP. Cloudflare is protecting the website and will block your access and in the worst-case ban your IP from their global network. Only do this at IPs you own or services that won’t do any damage to others.
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 IP and port using PowerShell
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 a 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.
In PowerShell, we got something called Test-NetConnection which is a command where you specify either an IP or a domain followed by the port you would like to ping.
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.
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 is accepting requests.
If you got any issues, questions, or suggestions, please let me know in the comments below. Happy pinging! 🙂
Источники информации:
- http://help.reg.ru/hc/ru/articles/4408046869009-%D0%94%D0%B8%D0%B0%D0%B3%D0%BD%D0%BE%D1%81%D1%82%D0%B8%D0%BA%D0%B0-%D0%B8-%D0%BB%D0%BE%D0%B3%D0%B8
- http://wiki.merionet.ru/servernye-resheniya/92/kak-sdelat-ping-porta-v-linux-i-windows/
- http://www.rootusers.com/how-to-ping-a-port/
- http://christian-schou.dk/how-to-ping-ip-and-port-from-windows-or-linux/