Linux ping remote port

How To Ping Specified Port Number?

Ping is a very popular term used by the system or network administrators. Ping means checking the given remote system whether it is up. A ping is a simple tool which uses ICMP protocol to check remote host. Some times ping port can be used with similar intentions. In this tutorial, we will look at how to ping remote system given ports.

Ping Remote System

We will start with regular ping. This will show us that the remote system is up. In some situations, the remote systems may be up but do not respond ping.

Ping Remote Port with Nmap

nmap is a very useful tool used by system administrators, network administrators, and pen testers. nmap provides a lot of network-related scan features. For more information please follow tutorial below.

In this example we will specify the port we want to ping with -p option. Keep in mind that this will be a TCP port. We will ping google.com port 443 or we can use a port name like https .

As we can see the port is the open and remote host is up too.

Ping Remote Port with Netcat

netcat is another useful tool which provides remote connection, listening ports and port scan. Detailed information about netcat can be found in the following tutorial.

We can use netcat in order to scan remote systems ports. In this example, we will ping google.com port 443 .

After connecting remote port there will be meaningless responses which means the remote port is up.

Ping Remote Port with Telnet

telnet is another useful tool used to connect remote telnet servers. But we can use this tool in order to ping remote TCP ports. We will ping google.com port 443 with the following command.

The connection is established and then after a timeout, it is closed which means ping is successful.

Источник

ИТ База знаний

Курс по Asterisk

Полезно

— Узнать IP — адрес компьютера в интернете

— Онлайн генератор устойчивых паролей

— Онлайн калькулятор подсетей

— Калькулятор инсталляции IP — АТС Asterisk

— Руководство администратора FreePBX на русском языке

— Руководство администратора Cisco UCM/CME на русском языке

— Руководство администратора по Linux/Unix

Серверные решения

Телефония

FreePBX и Asterisk

Настройка программных телефонов

Корпоративные сети

Протоколы и стандарты

Как сделать пинг порта в Linux и Windows

Проверяем доступность порта

Команда ping — это сетевой инструмент для проверки работоспособности удаленной системы. Другими словами, команда определяет, доступен ли определенный IP-адрес или хост. Ping использует протокол сетевого уровня, называемый Internet Control Message Protocol (ICMP), и доступен во всех операционных системах.

С другой стороны, номера портов принадлежат протоколам транспортного уровня, таким как TCP и UDP. Номера портов помогают определить, куда пересылается Интернет или другое сетевое сообщение, когда оно приходит.

Онлайн курс по Linux

Мы собрали концентрат самых востребованных знаний, которые позволят тебе начать карьеру администратора Linux, расширить текущие знания и сделать уверенный шаг к DevOps

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

Можно ли пропинговать конкретный порт?

Сетевые устройства используют протокол ICMP для отправки сообщений об ошибках и информации о том, успешна ли связь с IP-адресом. ICMP отличается от транспортных протоколов, поскольку ICMP не используется для обмена данными между системами.

Ping использует пакеты ICMP, а ICMP не использует номера портов, что означает, что порт не может быть опрошен. Однако мы можем использовать ping с аналогичным намерением — чтобы проверить, открыт порт или нет.

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

Читайте также:  Повышение прав пользователя windows

Как пропинговать определенный порт в Linux?

Вы можете использовать три инструмента для проверки связи порта в Linux:

Пинг определенного порта с помощью Telnet

Telnet — это протокол, используемый для интерактивной связи с целевым хостом через соединение виртуального терминала.

1. Чтобы проверить, установлен ли уже telnet , откройте окно терминала и введите:

2. Если telnet не установлен, установите его с помощью следующей команды

  • Для CentOS/Fedora: yum -y install telnet
  • Для Ubuntu: sudo apt install telnet

3. Чтобы пропинговать порт с помощью telnet , введите в терминале следующую команду:

Где [address] — это домен или IP-адрес хоста, а [port_number] — это порт, который вы хотите проверить.

Если порт открыт, telnet устанавливает соединение. В противном случае он указывает на сбой.

4. Чтобы выйти из telnet , нажмите Ctrl +] и введите q .

Пинг определенного порта с помощью Netcat

Netcat (nc) позволяет устанавливать соединения TCP и UDP, принимать оттуда данные и передавать их. Этот инструмент командной строки может выполнять множество сетевых операций.

1. Чтобы проверить, установлен ли netcat :

  • Для Debian, Ubuntu и Mint: введите netcat -h
  • Для Fedora, Red Hat Enterprise Linux и CentOS: ncat -h

2. Если netcat не установлен, выполните в терминале следующую команду:

3. Чтобы пропинговать порт с помощью netcat , введите следующее:

Выходные данные информируют пользователя об успешном подключении к указанному порту. В случае успеха — порт открыт.

Пинг определенного порта с помощью Nmap

Nmap — это сетевой инструмент, используемый для сканирования уязвимостей и обнаружения сети. Утилита также полезна для поиска открытых портов и обнаружения угроз безопасности.

1. Убедитесь, что у вас установлен Nmap, введя nmap -version в терминал.

Если Nmap установлен, вывод информирует пользователя о версии приложения и платформе, на которой он работает.

2. Если в вашей системе нет Nmap, введите следующую команду:

  • Для CentOS или RHEL Linux: sudo yum install nmap
  • Для Ubuntu или Debian Linux: sudo apt install nmap

3. После установки Nmap в системе используйте следующую команду для проверки связи определенного порта:

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

4. Чтобы проверить связь с более чем одним портом, введите nmap -p [number-range] [address] .

Синтаксис [number-range] — это диапазон номеров портов, которые вы хотите пропинговать, разделенные дефисом. Например:

Как пропинговать определенный порт в Windows?

Проверить связь с портом в Windows можно двумя способами:

Пинг определенного порта с помощью Telnet

Перед использованием telnet убедитесь, что он активирован:

  1. Откройте панель управления.
  2. Щелкните «Программы», а затем «Программы и компоненты».
  3. Выберите «Включение или отключение компонентов Windows».
  4. Найдите клиент Telnet и установите флажок. Щелкните ОК.

Готово! Вы активировали клиент Telnet в системе.

После завершения активации можно пропинговать порт с помощью telnet. Для этого:

1. Введите cmd в поиске в меню «Пуск». Щелкните на приложение Командная строка.

2. В окне командной строки введите

Где [address] — это домен или IP-адрес хоста, а [port_number] — это порт, который вы хотите проверить.

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

Пинг определенного порта с помощью PowerShell

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

1. Введите PowerShell в поиске в меню «Пуск». Щелкните приложение Windows PowerShell.

2. В окне командной строке PowerShell введите:

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

Заключение

Теперь вы знаете, как выполнить эхо-запрос и проверить, открыт ли порт, с помощью нескольких сетевых инструментов и утилит в Linux и Windows.

Мини — курс по виртуализации

Знакомство с VMware vSphere 7 и технологией виртуализации в авторском мини — курсе от Михаила Якобсена

Источник

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.

Читайте также:  Установка антивируса касперского windows 10

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.

  • 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.

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.

  • 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.

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.

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.

  • 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.

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.

Читайте также:  Windows unable to restore

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.

  • 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.

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 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.

  • TARGET is an IP address or domain name to port ping.
  • PORT is the remote system port number.

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.

The paping.exe is used to ping remote port. The port number is proıvided with the -p option and the number of the ping packets are sent with the -c command. In the following example, we ping the wisetut.com port number 80 for 5 times.

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.

Источник

Оцените статью